diff --git a/pungi/phases/pkgset/pkgsets.py b/pungi/phases/pkgset/pkgsets.py index 8786015e..aff893e0 100644 --- a/pungi/phases/pkgset/pkgsets.py +++ b/pungi/phases/pkgset/pkgsets.py @@ -236,12 +236,17 @@ class PackageSetBase(kobo.log.LoggingBase): rpm_path = rpm_path[len(remove_path_prefix):] f.write("%s\n" % rpm_path) - def load_old_file_cache(self, file_path): + @staticmethod + def load_old_file_cache(file_path): """ Loads the cached FileCache stored in pickle format in `file_path`. """ with open(file_path, "rb") as f: - self.old_file_cache = pickle.load(f) + return pickle.load(f) + + def set_old_file_cache(self, old_file_cache): + """Set cache of old files.""" + self.old_file_cache = old_file_cache def save_file_cache(self, file_path): """ diff --git a/pungi/phases/pkgset/sources/source_koji.py b/pungi/phases/pkgset/sources/source_koji.py index 640e2fb5..90300a65 100644 --- a/pungi/phases/pkgset/sources/source_koji.py +++ b/pungi/phases/pkgset/sources/source_koji.py @@ -617,10 +617,16 @@ def populate_global_pkgset(compose, koji_wrapper, path_prefix, event): global_pkgset = pungi.phases.pkgset.pkgsets.KojiPackageSet( koji_wrapper, compose.conf["sigkeys"], logger=compose._logger, arches=all_arches) + old_file_cache_path = _find_old_file_cache_path(compose) + old_file_cache = None if old_file_cache_path: compose.log_info("Reusing old PKGSET file cache from %s" % old_file_cache_path) - global_pkgset.load_old_file_cache(old_file_cache_path) + old_file_cache = pungi.phases.pkgset.pkgsets.KojiPackageSet.load_old_file_cache( + old_file_cache_path + ) + global_pkgset.set_old_file_cache(old_file_cache) + # Get package set for each compose tag and merge it to global package # list. Also prepare per-variant pkgset, because we do not have list # of binary RPMs in module definition - there is just list of SRPMs. @@ -638,8 +644,8 @@ def populate_global_pkgset(compose, koji_wrapper, path_prefix, event): populate_only_packages=populate_only_packages_to_gather, cache_region=compose.cache_region, extra_builds=extra_builds) - if old_file_cache_path: - pkgset.load_old_file_cache(old_file_cache_path) + if old_file_cache: + pkgset.set_old_file_cache(old_file_cache) # Create a filename for log with package-to-tag mapping. The tag # name is included in filename, so any slashes in it are replaced # with underscores just to be safe.