Bug 1021001

Summary: set --target noarch for noarch packages in koji
Product: [Fedora] Fedora Reporter: Till Maas <opensource>
Component: kojiAssignee: Dennis Gilmore <dennis>
Status: CLOSED EOL QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 19CC: dennis, ffesti, jzeleny, mikem, novyjindrich, opensource, packaging-team-maint, pknirsch, pmatilai, redhat-bugzilla
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-02-17 17:44:11 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Till Maas 2013-10-18 18:11:04 UTC
Description of problem:
koji/mock runs "rpmbuild --target arm -bs" for noarch builds on arm, but since
/usr/lib/rpm/platform/arm-linux/macros
does not exist, %{_arch} is not defined in this case, making builds fail on arm if e.g. %if %{_arch} is used in a spec file.

Version-Release number of selected component (if applicable):
rpm-4.11.1-3.fc19

How reproducible:
always

Steps to Reproduce:
1. try to build a noarch spec that contains %{_arch}
rpmbuild --target arm -bs foo.spec

Actual results:
rpmbuild fails because %{_arch} is not defined

Expected results:
%{_arch} should be defined.

Additional info:

Comment 1 Panu Matilainen 2013-10-21 05:54:46 UTC
That's because there's no such architecture as "arm", only a dozen or so variants. And for noarch builds target should arguably be set to "noarch" instead, so this sounds like a configuration thinko/typo in ... koji I guess.

Till, do you have a koji pointer to such a failure case to make tracking down it easier?

Comment 2 Till Maas 2013-10-21 06:46:42 UTC
I noticed it here:
http://koji.fedoraproject.org/koji/taskinfo?taskID=6074032
http://kojipkgs.fedoraproject.org//packages/youtube-dl/2013.10.18.2/1.fc20/data/logs/noarch/build.log

It was possible to remove the if condition there, so it is not an issue anymore.

Comment 3 Panu Matilainen 2013-10-21 07:13:43 UTC
Right, the fail case (--target arm) can be seen here: http://kojipkgs.fedoraproject.org//work/tasks/4032/6074032/build.log

Just FWIW, the arch-conditional in youtube-dl spec was strangely constructed anyway:

%if %{_arch} == x86_64 || %{_arch} == i686
BuildRequires:  pandoc
%endif

rpm has a better (and simpler) way to express that:
%ifarch x86_64 i686
BuildRequires:  pandoc
%endif

Comment 4 Till Maas 2013-10-21 07:33:26 UTC
(In reply to Panu Matilainen from comment #3)
> Right, the fail case (--target arm) can be seen here:
> http://kojipkgs.fedoraproject.org//work/tasks/4032/6074032/build.log
> 
> Just FWIW, the arch-conditional in youtube-dl spec was strangely constructed
> anyway:
> 
> %if %{_arch} == x86_64 || %{_arch} == i686
> BuildRequires:  pandoc
> %endif
> 
> rpm has a better (and simpler) way to express that:
> %ifarch x86_64 i686
> BuildRequires:  pandoc
> %endif

%ifarch won't work, therefore the other way was recommended here:
https://lists.fedoraproject.org/pipermail/devel/2013-October/190036.html

How to do it correctly is also still an unsolved problem:
https://fedorahosted.org/fpc/ticket/355

Also the if condition for BRs will be prohibited by future guidelines:
https://fedorahosted.org/fpc/ticket/303

Comment 5 Panu Matilainen 2013-10-21 07:53:17 UTC
Ah... I remember seeing Spot's mail on the subject but apparently didn't actually register the content :)

Comment 6 Dennis Gilmore 2013-10-21 08:26:39 UTC
both spots and this use case really are not valid, they result in the binary rpms having different content depending on what host machine built them, which can mean something needed like the syslinux splash screens being available or not.

Comment 7 Panu Matilainen 2013-10-21 09:08:57 UTC
Sure.

Anyway the actual issue here is that "--target arm" getting set by something (koji?) when no such architecture exists, and this seems strange anyway since its done for a noarch package.

Comment 8 Mike McLean 2013-11-07 22:54:21 UTC
For tasks like the one listed (a buildSRPMFromSCM task), Koji doesn't pass --target to mock, but it does place a target_arch value in the mock config, which has a similar effect.

The value of arm is set when the build arch is set to armhfp. The change is relatively recent:

https://git.fedorahosted.org/cgit/koji/commit/?id=0537e4ac71f816161481c356d74104766303d92d

There is no such thing as a noarch buildroot. When Koji makes a buildroot for a noarch build (or a noarch activity like building the srpm), it has to chose an arch for the buildroot. It looks at the the arch list for the builder and the tag and picks something in the overlap.

In the referenced task, the builder has a single arch: armhfp. The tag has an archlist of: armv7hl i686 x86_64. The armv7hl arch canonicalizes to armhfp.

Comment 9 Mike McLean 2014-05-12 17:44:43 UTC
So a couple more remarks.

1. The subject makes it sound like this affects noarch builds. That is not true. For building a noarch rpm, koji does explicitly pass --target noarch to mock on the command line. As near as I can tell, the behavior in question is limited to building srpms in koji.

2. When we build the srpm in koji, we use mock's --buildsrpm option. It doesn't seem like a --target option should be necessary here, but we could add one and it looks like mock will pass this through to rpm.

3. I've gotta wonder whether a change like this might break other packages.

Comment 10 Fedora End Of Life 2015-01-09 20:18:02 UTC
This message is a notice that Fedora 19 is now at end of life. Fedora 
has stopped maintaining and issuing updates for Fedora 19. It is 
Fedora's policy to close all bug reports from releases that are no 
longer maintained. Approximately 4 (four) weeks from now this bug will
be closed as EOL if it remains open with a Fedora 'version' of '19'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 19 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 11 Fedora End Of Life 2015-02-17 17:44:11 UTC
Fedora 19 changed to end-of-life (EOL) status on 2015-01-06. Fedora 19 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.