diff options
author | Michał Górny <mgorny@gentoo.org> | 2017-11-02 09:24:44 +0100 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2017-11-02 09:24:44 +0100 |
commit | f53e6a5cdf4f345cb005ac34a61fa26704c1d288 (patch) | |
tree | 5667879743a0c15d2a894082143c26b7888f2fa3 | |
parent | cf5762cfd1dd07bbcf12987b32afaafca41ec527 (diff) | |
download | gemato-f53e6a5cdf4f345cb005ac34a61fa26704c1d288.tar.gz |
recursiveloader: Fix updating deeply nested compressed Manifests
-rw-r--r-- | gemato/recursiveloader.py | 6 | ||||
-rw-r--r-- | tests/test_recursiveloader.py | 10 |
2 files changed, 14 insertions, 2 deletions
diff --git a/gemato/recursiveloader.py b/gemato/recursiveloader.py index 0bc00b1..ed7d034 100644 --- a/gemato/recursiveloader.py +++ b/gemato/recursiveloader.py @@ -516,11 +516,13 @@ class ManifestRecursiveLoader(object): if e.tag != 'MANIFEST': continue - if e.path in renamed_manifests: - e.path = renamed_manifests[e.path] fullpath = os.path.join(relpath, e.path) if not force and fullpath not in self.updated_manifests: + assert fullpath not in renamed_manifests continue + if fullpath in renamed_manifests: + fullpath = renamed_manifests[fullpath] + e.path = os.path.relpath(fullpath, relpath) gemato.verify.update_entry_for_path( os.path.join(self.root_directory, fullpath), diff --git a/tests/test_recursiveloader.py b/tests/test_recursiveloader.py index c115763..a5ee83a 100644 --- a/tests/test_recursiveloader.py +++ b/tests/test_recursiveloader.py @@ -590,6 +590,16 @@ OPTIONAL nonstray self.assertNotEqual(m.find_timestamp().ts, datetime.datetime(2017, 1, 1, 1, 1, 1)) + def test_compress_manifests_low_watermark(self): + m = gemato.recursiveloader.ManifestRecursiveLoader( + os.path.join(self.dir, 'Manifest'), + hashes=['SHA256', 'SHA512']) + m.save_manifests(force=True, compress_watermark=0) + self.assertFalse(os.path.exists( + os.path.join(self.dir, 'Manifest'))) + self.assertTrue(os.path.exists( + os.path.join(self.dir, 'Manifest.gz'))) + class MultipleManifestTest(TempDirTestCase): DIRS = ['sub'] |