#1703 rpkg build cannot handle includes/loads from spec file
Closed: Fixed 2 years ago by schlupov. Opened 3 years ago by churchyard.

See e.g. https://copr.fedorainfracloud.org/coprs/g/python/python3.10/build/2016375/

It appears that the "rpkg" build chokes on this change https://src.fedoraproject.org/rpms/python-rpm-macros/pull-request/91

The "distgit" build can handle this, but it cannot build from forks, see https://pagure.io/copr/copr/issue/1633


Running: rpkg srpm --outdir /tmp/copr-rpmbuild-hwa4rsu0 --spec /tmp/copr-rpmbuild-hwa4rsu0/obtain-sources/python-rpm-macros

cmd: ['rpkg', 'srpm', '--outdir', '/tmp/copr-rpmbuild-hwa4rsu0', '--spec', '/tmp/copr-rpmbuild-hwa4rsu0/obtain-sources/python-rpm-macros']
cwd: /tmp/copr-rpmbuild-hwa4rsu0/obtain-sources/python-rpm-macros
rc: 0
stdout: Wrote: /tmp/copr-rpmbuild-hwa4rsu0/python-rpm-macros.spec
stderr: error: /tmp/copr-rpmbuild-hwa4rsu0/python-rpm-macros.spec: line 23: failed to load macro file /tmp/copr-rpmbuild-hwa4rsu0/macros.python-srpm
can't parse specfile

Output: ['python-rpm-macros.spec']

Hmmm. The %{load:%{SOURCE102}}, is an interesting approach (warning, I entirely missed that statement at the first sight because of the weird indent).

Should this be reported against rpkg-util? I assume that we should in copr
concentrate on #1633.

Yes to both. BTW I think gdb fails for the same reason, it has %include.

https://copr.fedorainfracloud.org/coprs/churchyard/dirty-tests/build/2019389/

cmd: ['rpkg', 'srpm', '--outdir', '/tmp/copr-rpmbuild-aprlkn9j', '--spec', '/tmp/copr-rpmbuild-aprlkn9j/obtain-sources/gdb']
cwd: /tmp/copr-rpmbuild-aprlkn9j/obtain-sources/gdb
rc: 0
stdout: Downloading gdb-libstdc++-v3-python-8.1.1-20180626.tar.xz from lookaside cache at src.fedoraproject.org

Downloading v2.0.2.tar.gz from lookaside cache at src.fedoraproject.org

Downloading gdb-10.1.tar.xz from lookaside cache at src.fedoraproject.org

Wrote: /tmp/copr-rpmbuild-aprlkn9j/gdb.spec
stderr: warning: Macro expanded in comment on line 14: %define _lto_cflags %{nil}

warning: Macro expanded in comment on line 45: %{tarname}.tar.xz

warning: extra tokens at the end of %endif directive in line 54:  %endif # 0%{?_build_minimal}

error: Unable to open /tmp/copr-rpmbuild-aprlkn9j/_gdb.spec.Patch.include: No such file or directory
can't parse specfile

Output: ['gdb.spec']

Should this be reported against rpkg-util?

OTOH Maybe the problem is not in rpkg-util but in a way it is invoked?

OTOH Maybe the problem is not in rpkg-util but in a way it is invoked?

Hmpf, ideas? There seems to be:
cwd: /tmp/copr-rpmbuild-aprlkn9j/obtain-sources/gdb

So the current working directory should have spec file and relative paths to sources?

So, on RPM level, we need to set the sources directory to /tmp/copr-rpmbuild-aprlkn9j/obtain-sources/gdb as well. Does rpkg have a --define option? We need --define '_sourcedir /tmp/copr-rpmbuild-aprlkn9j/obtain-sources/gdb'.

Does rpkg have a --define option?

I don't think it has ... but yeah, I think we should set sourcedir somehow.

Metadata Update from @praiskup:
- Issue tagged with: bug

3 years ago

Metadata Update from @praiskup:
- Issue assigned to schlupov

2 years ago

Hello, this should be already fixed (both in 2.10, and 3.0).

Tested with rpkg-2.10 using spec file from https://src.fedoraproject.org/rpms/python-rpm-macros/pull-request/91 and it works so I'm closing this issue.

Metadata Update from @schlupov:
- Issue close_status updated to: Fixed
- Issue status updated to: Closed (was: Open)

2 years ago

Login to comment on this ticket.

Metadata