pkgset: Update processing file cache
The cache is now always saved when the repo is created on disk. The loading procedure in Koji source is updated to look for cache for correct tag. Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
parent
fe2df01e8b
commit
11779f6644
@ -425,13 +425,13 @@ class WorkPaths(object):
|
||||
makedirs(path)
|
||||
return path
|
||||
|
||||
def pkgset_file_cache(self):
|
||||
def pkgset_file_cache(self, pkgset_name):
|
||||
"""
|
||||
Returns the path to file in which the cached version of
|
||||
PackageSetBase.file_cache should be stored.
|
||||
"""
|
||||
return os.path.join(
|
||||
self.topdir(arch="global"), "pkgset_file_cache.pickle")
|
||||
filename = "pkgset_%s_file_cache.pickle" % pkgset_name
|
||||
return os.path.join(self.topdir(arch="global"), filename)
|
||||
|
||||
|
||||
class ComposePaths(object):
|
||||
|
@ -59,6 +59,7 @@ def get_create_global_repo_cmd(compose, path_prefix, repo_dir_global, pkgset):
|
||||
compose.paths.work.package_list(arch="global", pkgset=pkgset),
|
||||
remove_path_prefix=path_prefix,
|
||||
)
|
||||
pkgset.save_file_cache(compose.paths.work.pkgset_file_cache(pkgset.name))
|
||||
|
||||
# find an old compose suitable for repodata reuse
|
||||
old_compose_path = None
|
||||
|
@ -476,7 +476,7 @@ def _get_modules_from_koji_tags(
|
||||
)
|
||||
|
||||
|
||||
def _find_old_file_cache_path(compose):
|
||||
def _find_old_file_cache_path(compose, tag_name):
|
||||
"""
|
||||
Finds the old compose with "pkgset_file_cache.pickled" and returns
|
||||
the path to it. If no compose is found, returns None.
|
||||
@ -492,7 +492,7 @@ def _find_old_file_cache_path(compose):
|
||||
if not old_compose_path:
|
||||
return None
|
||||
|
||||
old_file_cache_dir = compose.paths.work.pkgset_file_cache()
|
||||
old_file_cache_dir = compose.paths.work.pkgset_file_cache(tag_name)
|
||||
rel_dir = relative_path(old_file_cache_dir, compose.topdir.rstrip('/') + '/')
|
||||
old_file_cache_path = os.path.join(old_compose_path, rel_dir)
|
||||
if not os.path.exists(old_file_cache_path):
|
||||
@ -596,7 +596,16 @@ 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)
|
||||
# TODO find cache for this tag
|
||||
|
||||
# Check if we have cache for this tag from previous compose. If so, use
|
||||
# it.
|
||||
old_cache_path = _find_old_file_cache_path(compose, compose_tag)
|
||||
if old_cache_path:
|
||||
pkgset.set_old_file_cache(
|
||||
pungi.phases.pkgset.pkgsets.KojiPackageSet.load_old_file_cache(
|
||||
old_cache_path
|
||||
)
|
||||
)
|
||||
|
||||
is_traditional = compose_tag in compose.conf.get("pkgset_koji_tag", [])
|
||||
should_inherit = inherit if is_traditional else inherit_modules
|
||||
@ -640,8 +649,6 @@ def populate_global_pkgset(compose, koji_wrapper, path_prefix, event):
|
||||
# Optimization for case where we have just single compose
|
||||
# tag - we do not have to merge in this case...
|
||||
variant.pkgsets.add(compose_tag)
|
||||
# TODO pickle pkgset to disk
|
||||
# TODO save pkgset file cache
|
||||
pkgsets.append(
|
||||
MaterializedPackageSet.create(
|
||||
compose, pkgset, path_prefix, mmd=tag_to_mmd.get(pkgset.name)
|
||||
|
Loading…
Reference in New Issue
Block a user