#71 cenptkg sources does not set the %rhel macro properly
Closed a year ago by churchyard. Opened a year ago by churchyard.

Consider this spec fragment:

Source0:        pip-22.3.1.tar.gz
%if 0%{?rhel} == 8
Source1:        pip-22.3.1-man.tar.gz
%endif

And the following sources:

SHA512 (pip-22.3.1-man.tar.gz) = 6dc14a0565747e30911d23d6c618a396e30d957e6bd8d1c8248bc9e51ebebc01751b051b761e846cf0223d26a57c1bae732a004d171ba9ad18a6cc9c55a60be3
SHA512 (pip-22.3.1.tar.gz) = c7865c4ce79b0fea7ba469fe593af3be205b3bdb574a6ae019842e0f82a0af406ec905d8c6ff02fbbafe01630c8899a398d071ce74501ca830249160f2f6df98

Then centpkg sources skips the conditionalized source:

[python3.11-pip (c8s)]$ centpkg sources
Not downloading unused pip-22.3.1-man.tar.gz
Downloading pip-22.3.1.tar.gz
######################################################################## 100.0%

And centpkg srpm fails:

[python3.11-pip (c8s)]$ centpkg srpm
...
error: Bad file: .../centpkg/python3.11-pip/pip-22.3.1-man.tar.gz: No such file or directory

Conditional sources are evil and I will get this conditional removed from the package, but this is a bug in centpkg nevertheless.

This is more or less a different occurrence of https://git.centos.org/centos/centpkg/issue/33 that kicks us back now when rpkg has this feature to skip unused sources. I have not checked yet whether this needs to be fixed in centpkg or rpkg.

I've debugged this further with:

%if 0%{?rhel} == 8
%{error:This is RHEL 8}
%endif
%if 0%{?rhel} == 9
%{error:This is RHEL 9}
%endif
%if %{undefined rhel}
%{error:This is not RHEL at all}
%endif

[python3.11-pip (c8s *)]$ centpkg sources
error: This is not RHEL at all
...

rhpkg --release rhel-8.9.0 sources behaves the same, and even fedpkg. So this is likely a problem with rpkg itself not setting any distro-macros for the sources command (notice how (rh|cent|fed)pkg sources works on arbitrary branches without --release).

[python-pip (rawhide *)]$ git diff
...
+%{error:%{!?fedora:This is not Fedora at all}%{?fedora:This is Fedora %{fedora}}}
...

[python-pip (rawhide *)]$ fedpkg sources
error: This is Fedora 37
...

(It should be 39 on the rawhide branch.)

Thank you for catching this.
We will not be able to look into this until next week.

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

a year ago

Login to comment on this ticket.

Metadata