summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorKali Kaneko <kali@leap.se>2014-11-03 12:13:46 +0100
committerKali Kaneko <kali@leap.se>2014-11-03 12:13:46 +0100
commit0fc71d08381c7e750dabc2fc6cf5ef957d51bb5a (patch)
tree907c872b37be164b7095fbf97a2d466b59b31b7e /pkg
parentfa5fe88d47dd3e90d8336dbd56e9bf6b38acd811 (diff)
parent7b0dda2fde310fff5ea6ee57a5f18a554b8e665f (diff)
Merge tag '0.7.0rc3' into deb-0.7.1-rc3
Tag leap.bitmask version 0.7.0rc3 Conflicts: src/leap/bitmask/services/soledad/soledadbootstrapper.py
Diffstat (limited to 'pkg')
-rw-r--r--pkg/requirements.pip2
-rwxr-xr-xpkg/tuf/release.py23
2 files changed, 23 insertions, 2 deletions
diff --git a/pkg/requirements.pip b/pkg/requirements.pip
index 3338fe4f..bab134f5 100644
--- a/pkg/requirements.pip
+++ b/pkg/requirements.pip
@@ -27,7 +27,7 @@ zope.proxy
pyzmq
leap.common>=0.3.7
-leap.soledad.client>=0.5.0
+leap.soledad.client>=0.6.0
leap.keymanager>=0.3.8
leap.mail>=0.3.9
diff --git a/pkg/tuf/release.py b/pkg/tuf/release.py
index c4abcd0d..0e1c989c 100755
--- a/pkg/tuf/release.py
+++ b/pkg/tuf/release.py
@@ -29,7 +29,6 @@ import sys
from tuf.repository_tool import load_repository
from tuf.repository_tool import import_rsa_privatekey_from_file
-from tuf.repository_tool import import_rsa_publickey_from_file
"""
Days until the expiration of targets.json and snapshot.json. After this ammount
@@ -102,6 +101,8 @@ class Targets(object):
recursive_walk=True,
followlinks=True)
+ self._remove_obsolete_targets(target_list)
+
for target in target_list:
octal_file_permissions = oct(os.stat(target).st_mode)[3:]
custom_file_permissions = {
@@ -109,6 +110,26 @@ class Targets(object):
}
self._repo.targets.add_target(target, custom_file_permissions)
+ def _remove_obsolete_targets(self, target_list):
+ """
+ Remove obsolete targets from TUF targets
+
+ :param target_list: list of targets on full path comming from TUF
+ get_filepaths_in_directory
+ :type target_list: list(str)
+ """
+ targets_path = os.path.join(self._repo_path, 'targets')
+ relative_path_list = map(lambda t: t.split("/targets")[1], target_list)
+ removed_targets = (set(self._repo.targets.target_files.keys())
+ - set(relative_path_list))
+
+ for target in removed_targets:
+ target_rel_path = target
+ if target[0] == '/':
+ target_rel_path = target[1:]
+ target_path = os.path.join(targets_path, target_rel_path)
+ self._repo.targets.remove_target(target_path)
+
if __name__ == "__main__":
main()