Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/hummingbird.repo
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# and it takes precedence over Fedora via priority, which is how Hummingbird
# composes its own buildroot (mock/mock.cfg in redhat/hummingbird/containers).
[public-hummingbird-x86_64-rpms]
# utah-install: true
name=public-hummingbird-x86_64-rpms
baseurl=https://packages.redhat.com/api/pulp-content/public-hummingbird/x86_64/
enabled=1
Expand Down
2 changes: 2 additions & 0 deletions packages/utah-packages.repo
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
# RPMs are authenticated by the pinned package image and its OCI provenance;
# the repository itself does not carry an RPM GPG key.
[utah-packages]
# utah-install: true
# ci-mirror: https://projectbluefin.github.io/utah-packages/
name=Utah package factory
baseurl=file:///etc/utah-packages
enabled=1
Expand Down
64 changes: 56 additions & 8 deletions scripts/check-repo-availability.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,58 @@
import xml.etree.ElementTree as ET
from pathlib import Path

# The same repositories the image installs from, in the same precedence order:
# Hummingbird's own overlay plus the utah-packages factory (its Pages mirror,
# since check-repos runs in CI before the OCI repo is copied into the image).
REPOS = {
"public-hummingbird": "https://packages.redhat.com/api/pulp-content/public-hummingbird/x86_64/",
"utah-packages": "https://projectbluefin.github.io/utah-packages/",
}
def install_repos(repo_dir: Path) -> dict[str, str]:
"""The repositories the image's package transaction installs from.

Derived from packages/*.repo — the same files the build copies into
/etc/yum.repos.d — so a renamed or moved repository changes what this
check queries instead of leaving it validating a stale hardcoded copy.
A repo belongs to the install transaction when its section carries a
`# utah-install: true` marker; nvidia-container-toolkit is enabled on the
image but is consumed only by utah-install-nvidia, so it is unmarked.

A repo whose baseurl is a file:// path exists only inside the image (the
factory repository is copied in from a pinned OCI image). CI cannot query
that path, so such a section must also carry `# ci-mirror: <url>` naming
the published mirror to check instead.
"""
repos: dict[str, str] = {}
for repo_file in sorted(repo_dir.glob("*.repo")):
section_name = None
baseurl = mirror = marked = None
for line in repo_file.read_text().splitlines():
line = line.strip()
if line.startswith("[") and line.endswith("]"):
if section_name and marked:
repos[section_name] = _resolve(section_name, baseurl, mirror, repo_file)
section_name = line[1:-1]
baseurl = mirror = marked = None
elif line.startswith("#"):
comment = line.lstrip("# ")
if comment == "utah-install: true":
marked = True
elif comment.startswith("ci-mirror:"):
mirror = comment.split(":", 1)[1].strip()
elif line.startswith("baseurl="):
baseurl = line.split("=", 1)[1].strip()
if section_name and marked:
repos[section_name] = _resolve(section_name, baseurl, mirror, repo_file)
if not repos:
raise SystemExit(f"no repositories marked '# utah-install: true' under {repo_dir}")
return repos


def _resolve(section_name: str, baseurl: str | None, mirror: str | None, repo_file: Path) -> str:
if not baseurl:
raise SystemExit(f"{repo_file}: [{section_name}] is marked utah-install but has no baseurl")
if baseurl.startswith("file://"):
if not mirror:
raise SystemExit(
f"{repo_file}: [{section_name}] has an in-image file:// baseurl; "
"add a '# ci-mirror: <url>' annotation naming the mirror CI should query"
)
return mirror
return baseurl


def section(path: Path, name: str) -> list[str]:
Expand Down Expand Up @@ -90,8 +135,11 @@ def main() -> int:
| set(section(overlay, "gnome"))
| set(section(overlay, "build"))
)
# The manifests live in packages/ beside the .repo files, so the manifest
# path locates the repository definitions — no second hardcoded path.
repos = install_repos(args.manifest.parent)
names: set[str] = set()
for label, base in REPOS.items():
for label, base in repos.items():
found = repo_package_names(base)
print(f"{label}: {len(found)} binary packages")
names |= found
Expand Down
Loading