Red Hat Bugzilla – Bug 166815
Better handling of "BuildArch" tag
Last modified: 2007-11-30 17:11:12 EST
Description of problem:
A good use for the "BuildArch" tag would be to replace --target command line.
So, if a spec file has, for example:
BuildArch: i686 pentium4
Building it with "rpm -ba foo.spec" would automatically build .i686.rpm and
.pentium4.rpm packages without having to worry about using the correct --target
I'm attaching a patch which we had for rpm-4.2.2 which does this. We have been
using it for more than a year now. I can't, however, comment on the technical
aspects of the patch since I'm not the author (Gustavo Niemeyer did it). It
applied to rpm-4.4.2 with some offsets.
Created attachment 118133 [details]
The intent here appears to be to have BuildArch: within a *.spec
override --target arguments. That's wrong imho, don't use --target
rather than appending BuildArch: targets to --target.
Is that the intent, changing the precedence of BA and -=-target handling so that BuildArch: overrides
No, --target should always be obeyed regardless of BuildArch contents. The
intent is that BuildArch behaves like --target if no --target is given. It's
like a default target but with the added benefit of supporting multiple targets
and automatically rebuilding for all of them.
I had a quick look at the patch, and I have a comment. As I understand the code,
without the patch, rpm-build will reparse the spec file for each compatible
BuildArch listed, so the %ifarch sections are processed correctly. This patch
bypasses this, leading to potentially wrongly interpreted spec files.
As I said, we have been using this patch for many years, and I don't know of
such an issue. At one time we regularly built packages for alpha and ppc.
However, I can't comment on the code. Even if it doesn't work correctly, at
least consider it as a suggestion.
This report targets the FC3 or FC4 products, which have now been EOL'd.
Could you please check that it still applies to a current Fedora release, and
either update the target product or close it ?
I'm sorry, this was more than a year ago.