#24 even though sources are downloaded from dist-git, rpkg-util tries to download Sources
Closed 4 years ago by praiskup. Opened 4 years ago by praiskup.

From: https://copr-be.cloud.fedoraproject.org/results/@python/python3.9/srpm-builds/01162692/builder-live.log.gz

cmd: ['rpkg', 'srpm', '--outdir', '/var/lib/copr-rpmbuild/results52nyspci', '--spec', '/tmp/tmpll4ka_io/trytond-dashboard']
cwd: /tmp/tmpll4ka_io/trytond-dashboard
rc: 0
stdout: Downloading trytond_dashboard-4.0.1.tar.gz from lookaside cache at src.fedoraproject.org

Wrote: /var/lib/copr-rpmbuild/results52nyspci/trytond-dashboard.spec
stderr: warning: Downloading http://downloads.tryton.org/4.0/trytond-dashboard-4.0.1.tar.gz to /var/lib/copr-rpmbuild/results52nyspci/trytond-dashboard-4.0.1.tar.gz
curl: (1) Protocol "http" not supported or disabled in libcurl
error: Couldn't download http://downloads.tryton.org/4.0/trytond-dashboard-4.0.1.tar.gz
Failed to execute command.

Output: ['trytond-dashboard.spec', 'trytond_dashboard-4.0.1.tar.gz']

It looks like we have spec file and tarball, so nothing should block us to create src.rpm.

Original report:
https://pagure.io/copr/copr/issue/1219

Build result dir:
https://copr-be.cloud.fedoraproject.org/results/@python/python3.9/srpm-builds/01162692/


Metadata Update from @clime:
- Issue assigned to clime

4 years ago

Hello Pavel!

The problem is that we have downloaded trytond_dashboard-4.0.1.tar.gz (with underscode) from lookaside cache whereas rpm recognizes the Source0 URL as http://downloads.tryton.org/4.0/trytond-dashboard-4.0.1.tar.gz (with dash between trytond and dashboard).

This happens even when using raw rpmbuild (without rpkg) as you can see below, where i tried to reproduce the problem in the srpm build directory downloaded to localhost:

clime@34-97-F6-31-7F-9B ~/copr-be.cloud.fedoraproject.org/results/@python/python3.9/srpm-builds/01162692 $ rpmbuild --define "_topdir `pwd`" trytond-dashboard.spec --define "_sourcedir `pwd`" --define "_specdir `pwd`" --define "_builddir `pwd`" --define "_buildrootdir `pwd`" --define "_srcrpmdir `pwd`" --define "_rpmdir `pwd`" -bs trytond-dashboard.spec
warning: Downloading http://downloads.tryton.org/4.0/trytond-dashboard-4.0.1.tar.gz to /home/clime/copr-be.cloud.fedoraproject.org/results/@python/python3.9/srpm-builds/01162692/trytond-dashboard-4.0.1.tar.gz
curl: (22) The requested URL returned error: 404 Not Found
error: Couldn't download http://downloads.tryton.org/4.0/trytond-dashboard-4.0.1.tar.gz

Quite strange because if i do $ rpmspec -P trytond-dashboard.spec on the specfile i get:

...
Source0:        http://downloads.tryton.org/4.0/trytond_dashboard-4.0.1.tar.gz
...
+ rpmbuild --define '_sourcedir+ rpmbuild --define '_sourcedir /tmp/test' --define '_rpmdir /tmp/test' --define '_builddir /tmp/test' --define '_specdir /tmp/test' --define '_srcrpmdir /tmp/test' -bs trytond-dashboard.spec
setting SOURCE_DATE_EPOCH=1570060800
Zapsáno: /tmp/test/trytond-dashboard-4.0.1-11.fc31.src.rpm /tmp/test' --define '_rpmdir /tmp/test' --define '_builddir /tmp/test' --define '_specdir /tmp/test' --define '_srcrpmdir /tmp/test' -bs trytond-dashboard.spec
setting SOURCE_DATE_EPOCH=1570060800
Zapsáno: /tmp/test/trytond-dashboard-4.0.1-11.fc31.src.rpm

Indeed, --undefine=_disable_source_fetch seems to breake it. This should be filled
against rpm, but don't we want to keep _disable_source_fetch when we correctly
downloaded (even part of) the sources from dist-git before?

Yes, i had %_disable_source_fetch 0 in ~/.rpmmacros for that example. I have should have put into the command-line explicitly.

This should be filled
against rpm, but don't we want to keep _disable_source_fetch when we correctly
downloaded (even part of) the sources from dist-git before?

it could be solved like that but rpm is supposed not to download a file when it is already downloaded. Therefore i rely on that behavior in rpkg. The problem is that it tries to find trytond-dashboard-4.0.1.tar.gz instead of trytond_dashboard-4.0.1.tar.gz - reeanbling _disable_source_fetch after the dist-git download would workaround that but maybe rpm can solve that problem.

See https://github.com/rpm-software-management/rpm/blob/master/build/parsePreamble.c#L224

OK, this is neither RPM issue, but packaging issue.

At the time of evaluating %pkgname contents, the %name is undefined...
so echo %name | sed 's/-/_/' expands to %name. And since there's
used %global (not %define) the macro is expanded later once Name: is
specified.

Metadata Update from @praiskup:
- Issue status updated to: Closed (was: Open)

4 years ago

Thanks for taking a look anyways!

No problem! Glad you figured it out!

Login to comment on this ticket.

Metadata