Merge branch 'filepath' of https://github.com/meskio/tuf into meskio-filepath

This commit is contained in:
vladdd 2014-07-04 16:45:00 -04:00
commit 7746b3f059
2 changed files with 7 additions and 3 deletions

View file

@ -250,9 +250,10 @@ $ mkdir django; echo 'file4' > django/file4.txt
# In the example below, file permissions of the target (octal number specifying file
# access for owner, group, others (e.g., 0755) is added alongside the default fileinfo.
# All target objects in metadata include the target's filepath, hash, and length.
>>> octal_file_permissions = oct(os.stat(target2_filepath).st_mode)[4:]
>>> target3_filepath = "path/to/repository/targets/file3.txt"
>>> octal_file_permissions = oct(os.stat(target3_filepath).st_mode)[4:]
>>> custom_file_permissions = {'file_permissions': octal_file_permissions}
>>> repository.targets.add_target("path/to/repository/targets/file3.txt", custom_file_permissions)
>>> repository.targets.add_target(target3_filepath, custom_file_permissions)
# The private key of the updated targets metadata must be loaded before it can be signed and
# written (Note the load_repository() call above).

View file

@ -2615,7 +2615,10 @@ def updated_targets(self, targets, destination_directory):
for target in targets:
# Get the target's filepath located in 'destination_directory'.
# We will compare targets against this file.
target_filepath = os.path.join(destination_directory, target['filepath'])
filepath = target['filepath']
if filepath[0] == '/':
filepath = filepath[1:]
target_filepath = os.path.join(destination_directory, filepath)
if target_filepath in updated_targetpaths:
continue