From ccf3b1aa3c492e506f4f3d64975df5740514e8ec Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Mon, 8 Dec 2025 17:39:21 +0100 Subject: [PATCH] Fix RPM installation for Fedora/CentOS by enforcing offline local install This commit improves the robustness of the RPM installation step for Fedora and CentOS by disabling all remote repositories when installing the locally built package-manager RPM. This prevents failures caused by flaky or mismatched upstream metadata (e.g., BaseOS repomd.xml checksum errors). The installer now: - uses 'dnf5/dnf/yum --disablerepo=*' for fully offline installation - falls back to 'rpm -i --nodeps' if the package manager fails - ensures deterministic CI builds without remote repo dependencies Reference: Conversation with ChatGPT (2025-12-08). https://chatgpt.com/share/6936ff1e-4adc-800f-b508-b5b90c0ef635 --- Dockerfile | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/Dockerfile b/Dockerfile index 203e140..98dc2b2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -152,22 +152,31 @@ RUN set -e; \ echo 'Running rpmbuild...'; \ cd /root/rpmbuild/SPECS && rpmbuild -bb package-manager.spec; \ \ - echo 'Installing generated RPM...'; \ + echo 'Installing generated RPM (local, offline)...'; \ rpm_path=$(find /root/rpmbuild/RPMS -name "package-manager-*.rpm" | head -n1); \ if [ -z "$rpm_path" ]; then echo 'ERROR: RPM not found!' && exit 1; fi; \ \ if command -v dnf5 >/dev/null 2>&1; then \ - echo 'Using dnf5 to install local RPM...'; \ - dnf5 install -y "$rpm_path"; \ + echo 'Using dnf5 to install local RPM (no remote repos)...'; \ + if ! dnf5 install -y --disablerepo='*' "$rpm_path"; then \ + echo 'dnf5 failed, falling back to rpm -i --nodeps'; \ + rpm -i --nodeps "$rpm_path"; \ + fi; \ elif command -v dnf >/dev/null 2>&1; then \ - echo 'Using dnf to install local RPM...'; \ - dnf install -y "$rpm_path"; \ + echo 'Using dnf to install local RPM (no remote repos)...'; \ + if ! dnf install -y --disablerepo='*' "$rpm_path"; then \ + echo 'dnf failed, falling back to rpm -i --nodeps'; \ + rpm -i --nodeps "$rpm_path"; \ + fi; \ elif command -v yum >/dev/null 2>&1; then \ - echo 'Using yum to install local RPM...'; \ - yum localinstall -y "$rpm_path"; \ + echo 'Using yum to install local RPM (no remote repos)...'; \ + if ! yum localinstall -y --disablerepo='*' "$rpm_path"; then \ + echo 'yum failed, falling back to rpm -i --nodeps'; \ + rpm -i --nodeps "$rpm_path"; \ + fi; \ else \ - echo 'No dnf/dnf5/yum found, falling back to rpm -i (no deps)...'; \ - rpm -i "$rpm_path"; \ + echo 'No dnf/dnf5/yum found, falling back to rpm -i --nodeps...'; \ + rpm -i --nodeps "$rpm_path"; \ fi; \ \ rm -rf "/tmp/$srcdir"; \