Skip to content

Commit 3a77f8c

Browse files
tkopecekpraiskup
authored andcommitted
Support yum for hermetic build
1 parent 90f552e commit 3a77f8c

File tree

3 files changed

+19
-6
lines changed

3 files changed

+19
-6
lines changed

mock/py/mock-hermetic-repo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ def _main():
191191
log.error("RPM deps downloading failed")
192192
sys.exit(1)
193193

194-
subprocess.check_call(["createrepo_c", options.output_repo])
194+
subprocess.check_call(["createrepo_c", "--compatibility", options.output_repo])
195195

196196
prepare_image(data["config"]["bootstrap_image"], data["bootstrap"],
197197
options.output_repo)

mock/py/mockbuild/installed_packages.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,13 +113,21 @@ def query_packages_location(packages, chrootpath=None,
113113
}]
114114
"""
115115

116-
# Note: we do not support YUM in 2024+
117-
query_locations_cmd = [dnf_cmd]
118-
if chrootpath:
119-
query_locations_cmd += [f"--installroot={chrootpath}"]
116+
if 'yum' in dnf_cmd:
117+
# yum (yum-utils must be installed)
118+
repoquery_cmd = '/usr/bin/repoquery'
119+
if not os.path.exists(repoquery_cmd):
120+
raise mockbuild.exception.Error(f"Missing {repoquery_cmd}")
121+
query_locations_cmd = [repoquery_cmd]
122+
else:
123+
# dnf
124+
query_locations_cmd = [dnf_cmd]
125+
if chrootpath:
126+
query_locations_cmd += [f"--installroot={chrootpath}"]
127+
query_locations_cmd += ["repoquery"]
120128
# The -q is necessary because of and similar:
121129
# https://github.com/rpm-software-management/dnf5/issues/1361
122-
query_locations_cmd += ["repoquery", "-q", "--location"]
130+
query_locations_cmd += ["-q", "--location"]
123131
query_locations_cmd += [
124132
f"{p['name']}-{p['version']}-{p['release']}.{p['arch']}"
125133
for p in packages
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
The ``--calculate-dependencies`` command now also supports the ``yum`` package
2+
manager for building older distributions. Using the correct bootstrap image
3+
with yum now works without problems. Also, ``mock-hermetic-repo`` was altered
4+
to create repositories compatible with both ``dnf`` and ``yum`` package
5+
managers (added ``--compatibility`` flag).

0 commit comments

Comments
 (0)