From 4ef7331c2fb8073b2eeba90af1a427bd1f3c811a Mon Sep 17 00:00:00 2001 From: Michał Górny Date: Mon, 20 Nov 2017 21:27:56 +0100 Subject: recursiveloader: Fix adding top-level ignore entries to sub-Manifests --- gemato/recursiveloader.py | 11 ++++++----- tests/test_profile.py | 13 +++++++++++++ 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/gemato/recursiveloader.py b/gemato/recursiveloader.py index 270b6ce..262552f 100644 --- a/gemato/recursiveloader.py +++ b/gemato/recursiveloader.py @@ -148,11 +148,12 @@ class ManifestRecursiveLoader(object): # trigger saving self.updated_manifests.add(relpath) - # add initial IGNORE entries - for ip in (self.profile - .get_ignore_paths_for_new_manifest('')): - ie = gemato.manifest.ManifestEntryIGNORE(ip) - m.entries.append(ie) + # add initial IGNORE entries to top-level Manifest + if relpath == 'Manifest': + for ip in (self.profile + .get_ignore_paths_for_new_manifest('')): + ie = gemato.manifest.ManifestEntryIGNORE(ip) + m.entries.append(ie) else: raise err diff --git a/tests/test_profile.py b/tests/test_profile.py index bf4156f..a19b269 100644 --- a/tests/test_profile.py +++ b/tests/test_profile.py @@ -138,6 +138,19 @@ class EbuildRepositoryTests(TempDirTestCase): "type mismatch for {}".format(f)) return m + def test_regression_top_level_ignore_in_all_manifests(self): + assert 'distfiles' in self.EXPECTED_IGNORE[0] + assert 'dev-foo/Manifest' in self.EXPECTED_MANIFESTS + + m = gemato.recursiveloader.ManifestRecursiveLoader( + os.path.join(self.dir, 'Manifest'), + hashes=['SHA256', 'SHA512'], + allow_create=True, + profile=self.PROFILE()) + m.update_entries_for_directory('') + + self.assertIsNone(m.find_path_entry('dev-foo/distfiles')) + def test_set_loader_options(self): m = gemato.recursiveloader.ManifestRecursiveLoader( os.path.join(self.dir, 'Manifest'), -- cgit v1.2.3