Skip to content

Commit 9bd68a3

Browse files
committed
fetch/konflux: use all repos
Make sure to generate a lock file that have all the repos ids. Otherwise rpm-ostree fails during the compose because it expects the repos defined in the manifest to be available.
1 parent 12937d1 commit 9bd68a3

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/konflux-rpm-lockfile

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,19 @@ def get_repo_url(repo_path, repoid):
3434
return line.split('=', 1)[1].strip()
3535

3636

37-
def write_hermeto_lockfile(pkgs):
37+
def write_hermeto_lockfile(pkgs, repos):
3838

39+
# TODO make sure to have the matching repo for
40+
# repo-packages entries.
3941
packages = []
42+
# trick to make sure we have at least an entry for each repoid
43+
# this way hermeto will create all the matching repo definitions
44+
# and rpm-ostree will find all the expected repos.
45+
repo_numbers = len(repos)
46+
i = 0
4047
for pkg in pkgs:
41-
packages.append({"url": pkg})
48+
packages.append({"url": pkg, "repoid": repos[i % repo_numbers]})
49+
i = i+1
4250

4351
lockfile = {
4452
'lockfileVersion': 1,
@@ -95,7 +103,7 @@ def generate_lockfile(contextdir, manifest, output_path):
95103
print(f"Error running dnf repoquery:\n{result.stderr}", file=sys.stderr)
96104
sys.exit(1)
97105

98-
lockfile = write_hermeto_lockfile(pkg_urls)
106+
lockfile = write_hermeto_lockfile(pkg_urls, repos)
99107

100108
try:
101109
with open(output_path, 'w', encoding="utf8") as f:

0 commit comments

Comments
 (0)