rpmmd: no longer flush the caches on every call

When we used the dnf-based pipelines, we were relying on the fact
that the metadata was unlikely to have changed between we generated
the pipeline and called osbuild. We achieved this by always updating
to the most recent metadata on every call to rpmmd.Depsolve that
would end up in a pipelin.

Refreshing the metadata is time-consuming, and something we want
to avoid if at all possible. Now that our pipelines no longer
rely on this property, we can drop the flushing.

Signed-off-by: Tom Gundersen <teg@jklm.no>
This commit is contained in:
Tom Gundersen 2020-03-14 20:47:15 +01:00
parent 8b940d09e2
commit 819430e659
5 changed files with 12 additions and 17 deletions

View file

@ -38,16 +38,13 @@ def dnfrepo(desc, parent_conf=None):
return repo
def create_base(repos, module_platform_id, persistdir, cachedir, clean=False):
def create_base(repos, module_platform_id, persistdir, cachedir):
base = dnf.Base()
base.conf.module_platform_id = module_platform_id
base.conf.config_file_path = "/dev/null"
base.conf.persistdir = persistdir
base.conf.cachedir = cachedir
if clean:
shutil.rmtree(base.conf.cachedir, ignore_errors=True)
for repo in repos:
base.repos.add(dnfrepo(repo, base.conf))
@ -88,12 +85,11 @@ call = json.load(sys.stdin)
command = call["command"]
arguments = call["arguments"]
repos = arguments.get("repos", {})
clean = arguments.get("clean", False)
cachedir = arguments["cachedir"]
module_platform_id = arguments["module_platform_id"]
with tempfile.TemporaryDirectory() as persistdir:
base = create_base(repos, module_platform_id, persistdir, cachedir, clean)
base = create_base(repos, module_platform_id, persistdir, cachedir)
if command == "dump":
packages = []