From a71c8e23be717664942e4b130834398383dfdecf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= Date: Fri, 23 Sep 2022 10:14:12 +0200 Subject: [PATCH] pkgset: Stop reuse if configuration changed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When options controlling excluding arches change, it should break reuse. Signed-off-by: Lubomír Sedlář --- pungi/phases/pkgset/pkgsets.py | 12 ++++++++++++ tests/test_pkgset_pkgsets.py | 2 ++ 2 files changed, 14 insertions(+) diff --git a/pungi/phases/pkgset/pkgsets.py b/pungi/phases/pkgset/pkgsets.py index c0611747..dff9ebbf 100644 --- a/pungi/phases/pkgset/pkgsets.py +++ b/pungi/phases/pkgset/pkgsets.py @@ -728,6 +728,12 @@ class KojiPackageSet(PackageSetBase): "srpms_by_name": self.srpms_by_name, "extra_builds": self.extra_builds, "include_packages": include_packages, + "inherit_to_noarch": compose.conf[ + "pkgset_inherit_exclusive_arch_to_noarch" + ], + "exclusive_noarch": compose.conf[ + "pkgset_exclusive_arch_considers_noarch" + ], }, f, protocol=pickle.HIGHEST_PROTOCOL, @@ -822,6 +828,8 @@ class KojiPackageSet(PackageSetBase): self.log_debug("Failed to load reuse file: %s" % str(e)) return False + inherit_to_noarch = compose.conf["pkgset_inherit_exclusive_arch_to_noarch"] + exclusive_noarch = compose.conf["pkgset_exclusive_arch_considers_noarch"] if ( reuse_data["allow_invalid_sigkeys"] == self._allow_invalid_sigkeys and reuse_data["packages"] == self.packages @@ -829,6 +837,10 @@ class KojiPackageSet(PackageSetBase): and reuse_data["extra_builds"] == self.extra_builds and reuse_data["sigkeys"] == self.sigkey_ordering and reuse_data["include_packages"] == include_packages + # If the value is not present in reuse data, the compose was + # generated with older version of Pungi. Best to not reuse. + and reuse_data.get("inherit_to_noarch") == inherit_to_noarch + and reuse_data.get("exclusive_noarch") == exclusive_noarch ): self.log_info("Copying repo data for reuse: %s" % old_repo_dir) copy_all(old_repo_dir, repo_dir) diff --git a/tests/test_pkgset_pkgsets.py b/tests/test_pkgset_pkgsets.py index ee63c35b..793d8372 100644 --- a/tests/test_pkgset_pkgsets.py +++ b/tests/test_pkgset_pkgsets.py @@ -853,6 +853,8 @@ class TestReuseKojiPkgset(helpers.PungiTestCase): "include_packages": None, "rpms_by_arch": mock.Mock(), "srpms_by_name": mock.Mock(), + "exclusive_noarch": True, + "inherit_to_noarch": True, } ) self.pkgset.old_file_cache = mock.Mock()