mirror of
https://github.com/coreos/fedora-coreos-config.git
synced 2026-11-03 22:59:47 -09:00
build-rootfs: simplify local overrides handling
We don't need the 'packages' intermediate key. I think I initially did
that so it follows the same schema as regular lockfiles, but anyway we
desugar them to the `{pkgname: evra}` format pretty quickly.
This commit is contained in:
parent
270d4775c9
commit
c47ec9f5fa
1 changed files with 5 additions and 5 deletions
10
build-rootfs
10
build-rootfs
|
|
@ -191,14 +191,14 @@ def prepare_local_rpm_overrides(rootfs):
|
|||
pkglist = subprocess.check_output(['dnf', 'repoquery', f'--repofrompath=overrides,file://{overrides_repo}',
|
||||
'--repo=overrides', '--latest-limit=1', f'--arch={ARCH},noarch',
|
||||
'--qf', 'pkg: %{name} %{evr} %{arch}\n'], encoding='utf-8')
|
||||
lockfile = {"packages": {}}
|
||||
lockfile = {}
|
||||
for line in pkglist.splitlines():
|
||||
if not line.startswith("pkg: "):
|
||||
continue
|
||||
_, name, evr, arch = line.strip().split()
|
||||
lockfile["packages"][name] = {"evra": f"{evr}.{arch}"}
|
||||
lockfile[name] = {"evra": f"{evr}.{arch}"}
|
||||
|
||||
if len(lockfile['packages']) == 0:
|
||||
if len(lockfile) == 0:
|
||||
return None
|
||||
|
||||
with open('/etc/yum.repos.d/overrides.repo', 'w') as f:
|
||||
|
|
@ -211,7 +211,7 @@ cost=500
|
|||
priority=1
|
||||
''')
|
||||
|
||||
print("Injected", len(lockfile['packages']), 'package overrides')
|
||||
print("Injected", len(lockfile), 'package overrides')
|
||||
return lockfile
|
||||
|
||||
|
||||
|
|
@ -248,7 +248,7 @@ def get_locked_nevras(local_overrides):
|
|||
# want to support dumb `koji download-build` flows. For everything else
|
||||
# that's unlocked, we rely on the overrides repo having priority=1.
|
||||
locks.update({pkgname: v['evra'] if 'evra' in v else v['evr']
|
||||
for (pkgname, v) in local_overrides['packages'].items()
|
||||
for (pkgname, v) in local_overrides.items()
|
||||
if pkgname in locks})
|
||||
return [f'{k}-{v}' for (k, v) in locks.items()]
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue