COPR fedoraproject.org 构建器拒绝下载我的 .spec 文件中指定的源

COPR fedoraproject.org builder refuses to download sources specified in my .spec file

我在 https://copr.fedoraproject.org. My spec for rpkg is here 中构建了一个包。构建失败,出现以下

Generated rpkg config:
[rpkg]
preprocess_spec = True

[git]
anon_clone_url = https://github.com/%(repo_path)s

[lookaside]
download_url = https://${git_props:remote_netloc}/repo/pkgs/%(repo_path)s/%(filename)s/%(hashtype)s/%(hash)s/%(filename)s

Writing config into /var/lib/copr-rpmbuild/workspace/workdir-ce16hwto/.config/rpkg.conf
Running: rpkg srpm --outdir /var/lib/copr-rpmbuild/results --spec /var/lib/copr-rpmbuild/workspace/workdir-ce16hwto/skupper-router

cmd: ['rpkg', 'srpm', '--outdir', '/var/lib/copr-rpmbuild/results', '--spec', '/var/lib/copr-rpmbuild/workspace/workdir-ce16hwto/skupper-router']
cwd: /var/lib/copr-rpmbuild/workspace/workdir-ce16hwto/skupper-router
rc: 1
stdout: Wrote: /var/lib/copr-rpmbuild/results/skupper-router.spec
stderr: git_dir_pack: archiving /var/lib/copr-rpmbuild/workspace/workdir-ce16hwto/skupper-router:
commit cb2a29004b1660168cc4a6894e521b0cf71cb25d (HEAD -> jd_2022_03_15_rpm, origin/jd_2022_03_15_rpm)
Date:   Sat Apr 9 01:04:32 2022 +0200

    add static build rpm
git_dir_pack: Wrote: /var/lib/copr-rpmbuild/results/skupper-router-cb2a2900.tar.gz
error: Bad source: /var/lib/copr-rpmbuild/results/qpid-proton-0.37.0.tar.gz: No such file or directory

Copr build error: git_dir_pack: archiving /var/lib/copr-rpmbuild/workspace/workdir-ce16hwto/skupper-router:
commit cb2a29004b1660168cc4a6894e521b0cf71cb25d (HEAD -> jd_2022_03_15_rpm, origin/jd_2022_03_15_rpm)
Date:   Sat Apr 9 01:04:32 2022 +0200

    add static build rpm
git_dir_pack: Wrote: /var/lib/copr-rpmbuild/results/skupper-router-cb2a2900.tar.gz
error: Bad source: /var/lib/copr-rpmbuild/results/qpid-proton-0.37.0.tar.gz: No such file or directory

https://download.copr.fedorainfracloud.org/results/jdanek/skupper-router/srpm-builds/04126008/builder-live.log.gz 处的完整日志)

在我的机器上,运行 rpkg srpm 成功。

我四处搜索了一下,在我看来,如果源代码是通过 https 分发的,COPR 应该愿意下载源代码,我的就是这样。

我能否以某种方式为我的源使用后备缓存功能?

您的构建在 git_dir_pack 时失败(rpkg-util,又名 rpkg 失败)。这甚至发生在 rpmbuild 进程开始之前。

A few weeks ago 我们将 Copr 构建器迁移到了 Fedora 35, 因此也 rpkg-util v3。随意看看如何 解决类似问题。 或者联系 rpkg-util upstream 寻求指导。

问题是源文件显然必须从后备缓存中下载。所以,让我们自己创造一个。或者至少,一个外观

首先,将所需的源存档下载到您的计算机,到 git 回购检查目录,然后使用 rpkg

进行“离线上传”
wget https://www.apache.org/dist/qpid/proton/0.37.0/qpid-proton-0.37.0.tar.gz
rpkg upload --offline qpid-proton-0.37.0.tar.gz

这将创建 sources 文件。将其提交给回购协议。撤消对 .gitignore 所做的编辑。 (如果该 rpkg 命令失败,请忽略它,只要 sources 文件已创建。)

使用以下内容创建新文件rpkg.conf,并将其提交到 repo。

[lookaside]
download_url = https://www.apache.org/dist/qpid/proton/0.37.0/%(filename)s

现在推送它并在 COPR 中构建它。

(不要被下面打印的明显错误的 download_url 搞糊涂了;我们在 repo 目录中的 rpkg.conf 覆盖了它。)

Running: git checkout jd_2022_03_15_rpm_cstdint

cmd: ['git', 'checkout', 'jd_2022_03_15_rpm_cstdint']
cwd: /var/lib/copr-rpmbuild/workspace/workdir-rmzys1po/skupper-router
rc: 0
stdout: branch 'jd_2022_03_15_rpm_cstdint' set up to track 'origin/jd_2022_03_15_rpm_cstdint'.
stderr: Switched to a new branch 'jd_2022_03_15_rpm_cstdint'

Generated rpkg config:
[rpkg]
preprocess_spec = True

[git]
anon_clone_url = https://github.com/%(repo_path)s

[lookaside]
download_url = https://${git_props:remote_netloc}/repo/pkgs/%(repo_path)s/%(filename)s/%(hashtype)s/%(hash)s/%(filename)s

Writing config into /var/lib/copr-rpmbuild/workspace/workdir-rmzys1po/.config/rpkg.conf
Running: rpkg srpm --outdir /var/lib/copr-rpmbuild/results --spec /var/lib/copr-rpmbuild/workspace/workdir-rmzys1po/skupper-router

cmd: ['rpkg', 'srpm', '--outdir', '/var/lib/copr-rpmbuild/results', '--spec', '/var/lib/copr-rpmbuild/workspace/workdir-rmzys1po/skupper-router']
cwd: /var/lib/copr-rpmbuild/workspace/workdir-rmzys1po/skupper-router
rc: 0
stdout: Downloading qpid-proton-0.37.0.tar.gz from jiridanek/skupper-router at www.apache.org:

Wrote: /var/lib/copr-rpmbuild/results/skupper-router.spec
Wrote: /var/lib/copr-rpmbuild/results/skupper-router-0.0.git.3560.d7714b9c-2.0.0.fc35.src.rpm
stderr: git_dir_pack: archiving /var/lib/copr-rpmbuild/workspace/workdir-rmzys1po/skupper-router:
commit d7714b9cac0641d4e34c0774b875fcb67cee8793 (HEAD -> jd_2022_03_15_rpm_cstdint, origin/jd_2022_03_15_rpm_cstdint)
Author: Jiri Daněk <jdanek@redhat.com>
Date:   Wed Apr 13 17:13:22 2022 +0200

    add autopack
git_dir_pack: Wrote: /var/lib/copr-rpmbuild/results/skupper-router-d7714b9c.tar.gz

Output: ['skupper-router.spec', 'qpid-proton-0.37.0.tar.gz', 'skupper-router-0.0.git.3560.d7714b9c-2.0.0.fc35.src.rpm', 'skupper-router-d7714b9c.tar.gz']

成功!

通常情况下,通过 https 下载 qpid-proton 文件可以在 Copr 中使用。如果在某处的 rpm 宏中定义了 %_disable_source_fetch 0,则由 rpmbuild(由 rpkg 调用)完成。

问题是 spec file 中的一行是:%undefine _disable_source_fetch 禁用给定规范文件的此行为。