From d357aae3608cb8cda5d86dc705f79c727f7cd23d Mon Sep 17 00:00:00 2001 From: Anders da Silva Rytter Hansen Date: Wed, 27 May 2026 13:14:52 -0300 Subject: [PATCH] Fix mock: use custom config with extra repos instead of --shell injection The --init/--shell/--no-clean approach caused a corrupted RPM database in the chroot. Instead, generate a custom mock config that includes both the Forgejo package registry and the xlibre Copr repos directly in config_opts['yum.conf'] before the chroot is created. This is the standard, reliable way to add extra repositories to mock. --- .forgejo/workflows/build-rpms.yml | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/.forgejo/workflows/build-rpms.yml b/.forgejo/workflows/build-rpms.yml index 1755c3d..5e91d9c 100644 --- a/.forgejo/workflows/build-rpms.yml +++ b/.forgejo/workflows/build-rpms.yml @@ -50,18 +50,29 @@ jobs: - name: Build RPM with mock run: | + cat > /tmp/mock-custom.cfg <<'MOCKEOF' + include('/etc/mock/alma+epel-10-x86_64.cfg') + config_opts['yum.conf'] += """ + [sonicde-rpm] + name=SonicDE RPM + baseurl=https://pc-rytteren.dk/forge/api/packages/anders/rpm + enabled=1 + gpgcheck=0 + + [xlibre-xserver] + name=Copr xlibre-xserver + baseurl=https://download.copr.fedorainfracloud.org/results/@xlibre/xlibre-xserver/rhel+epel-10-$basearch/ + type=rpm-md + skip_if_unavailable=True + gpgcheck=1 + gpgkey=https://download.copr.fedorainfracloud.org/results/@xlibre/xlibre-xserver/pubkey.gpg + repo_gpgcheck=0 + enabled=1 + """ + MOCKEOF mock \ - --root alma+epel-10-x86_64 \ - --init - FORGEJO_REPO=$(curl -fsSL https://pc-rytteren.dk/forge/api/packages/anders/rpm.repo) - COPR_REPO=$(curl -fsSL "https://copr.fedorainfracloud.org/coprs/g/xlibre/xlibre-xserver/repo/rhel+epel-10/group_xlibre-xlibre-xserver-rhel+epel-10.repo") - mock \ - --root alma+epel-10-x86_64 \ - --shell "mkdir -p /etc/yum.repos.d && echo '${FORGEJO_REPO}' > /etc/yum.repos.d/sonicde.repo && echo '${COPR_REPO}' > /etc/yum.repos.d/xlibre-xserver.repo" - mock \ - --root alma+epel-10-x86_64 \ + -r /tmp/mock-custom.cfg \ --resultdir "${HOME}/mock-results" \ - --no-clean \ --rebuild "${{ env.SRPM_PATH }}" - name: Upload RPMs to Forgejo Package Registry