#711 Koji build for Fedora 8 fails - thinks it's Fedora 9!
Closed: Fixed None Opened 15 years ago by dwheeler.

Fedora's Koji installation currently has a serious configuration bug for dist-f8,
at least for scratch builds. When it compiles for dist-f8,
it incorrectly thinks it's compiling for dist-f9,
instead of correctly compiling for dist-f8.
That is, when compiling for Fedora 8, %fedora == 9!!!

Proof: If your .spec file has:
{{{
%if %fedora == 9
ExcludeArch: ppc64
%endif
}}}

then "rpmbuild -bs X.spec" followed by:
koji build --scratch dist-f8 ../SRPMS/...src.rpm
will NOT build for ppc64 (wrong!).
But change "== 9" to "== 8", and it WILL build for ppc64
(wrong!). Ooooops.

Maybe it IS building for 9 instead of 8, but the result
is the same: No joy when building for Fedora 8.

I've placed this as "high" severity - this bug has a strong
potential to block security updates of Fedora 8.
It's probably trivial to fix!


Please refer to http://fedoraproject.org/wiki/Packaging/DistTag#Conditionals as it'd appear that your if statements are incorrect (most most likely been ignored).

If it still exists can you please let us know the task number?

The conditional looks to me like it should work (but yes, using 0%{?fedora} instead of %fedora is safer).

What if you build for dist-f8-updates-candidate rather than dist-f8? (That's what non-scratch F8 builds go to. dist-f8 is supposed to be read-only.)

Replying to [comment:2 kkofler]:

The conditional looks to me like it should work (but yes, using 0%{?fedora} instead of %fedora is safer).
It's a numerical value been compared to a string, it should be "9" for the above comparison iirc

What if you build for dist-f8-updates-candidate rather than dist-f8? (That's what non-scratch F8 builds go to. dist-f8 is supposed to be read-only.)
dist-f8 is a tag and a build-target.

This is either a problem with the spec file, or RPM, not the buildsystem, sorry.

I've already read http://fedoraproject.org/wiki/Packaging/DistTag#Conditionals ;
I thought the most direct example would help.

Below is a test ".spec" file.

Building for dist-f8 produces the same results as %fedora == 9;
shouldn't it produce the results for %fedora == 8 instead?
Building for "dist-f8-updates-candidate" does work, in that case %fedora == 8.

{{{
Name: test
Version: 0
Release: 1%{?dist}
Summary: Test of fedora macro
Group: Applications/Engineering
License: BSD
URL: http://www.dwheeler.com
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

Run this test using:

koji build --scratch dist-f8 ../SRPMS/test-0-1.fc9.src.rpm

koji build --scratch dist-f9 ../SRPMS/test-0-1.fc9.src.rpm

koji build --scratch dist-f8-updates-candidate ../SRPMS/test-0-1.fc9.src.rpm

Expected result:

dist-f8 and dist-f8-updates-candidate excludes ppc64; Fedora 9 includes ONLY i386.

Actual result on Koji:

dist-f8 includes only i386, as does Fedora 9... because when

koji is told to build for dist-f8, macro "fedora" is actually 9 (oops)

dist-f8-updates-candidate correctly excludes ppc64.

%if 0%{?fedora} < 9
ExcludeArch: ppc64
%endif

%{?fc8:ExcludeArch: ppc64}

%if 0%{?fc8} == 8
ExcludeArch: ppc64
%endif

%if 0%{?fedora} >= 09
ExclusiveArch: i386
%endif

%description
This is a stupid test. On Fedora 8, it should NOT build ppc64.
But it will, because Fedora 8 thinks it's Fedora 9.

%prep

%build
echo '#!/bin/sh' > stub
echo 'echo "This is a test"' >> stub
chmod a+x stub

%install
rm -rf %{buildroot}
install -d %{buildroot}/%{_bindir}/
cp -p stub %{buildroot}/%{_bindir}/

%clean
rm -rf %{buildroot}

%files
%defattr(-,root,root,-)
%{_bindir}/*

%changelog
* Fri Jun 27 2008 David A. Wheeler - 0-1
- Initial package

}}}

%if 0%{?fc8} == 8
ExcludeArch: ppc64
%endif

is clearly wrong it will be either 1 or undefined never 8

please show us the build numbers from your attempted builds. its not a bug in the buildsystem. all the macros are defined by the packages that are in the buildroot. there is no control on them from outside.

[dennis@bratac ~]$ rpmbuild -bs --define="fedora 8" --define="dist .fc8" fedora/SPECS/test.spec
Wrote: /home/dennis/fedora/SRPMS/test-0-1.fc8.src.rpm
[dennis@bratac ~]$ koji build --scratch dist-f8-updates-candidate /home/dennis/fedora/SRPMS/test-0-1.fc8.src.rpm
Uploading srpm: /home/dennis/fedora/SRPMS/test-0-1.fc8.src.rpm
[====================================] 100% 00:00:02 2.18 KiB 985.69 B/sec
Created task: 726760
Task info: http://koji.fedoraproject.org/koji/taskinfo?taskID=726760
Watching tasks (this may be safely interrupted)...
726760 build (dist-f8-updates-candidate, test-0-1.fc8.src.rpm): open (x86-1.fedora.phx.redhat.com)
726761 buildArch (test-0-1.fc8.src.rpm, ppc): free
726763 buildArch (test-0-1.fc8.src.rpm, i386): free
726762 buildArch (test-0-1.fc8.src.rpm, x86_64): free
726761 buildArch (test-0-1.fc8.src.rpm, ppc): free -> open (ppc3.fedora.redhat.com)
726762 buildArch (test-0-1.fc8.src.rpm, x86_64): free -> open (x86-7.fedora.phx.redhat.com)
726763 buildArch (test-0-1.fc8.src.rpm, i386): free -> open (x86-2.fedora.phx.redhat.com)

Define the macros correctly when you build the srpm and it does the right thing. when you do a make build koji checks out and creates the srpm using correct defines. they are embeded in the srpm which is what koji uses to determine what arches to build for. scratch builds withouth the srpm being created correctly wont do the right thing.

This is not fixed and it breaks the qt4 F8 build and several other Qt/KDE packages and who knows how many other packages on F8.

qt4.spec has:
%if 0%{?fedora} > 8
Name: qt
%else
Name: qt4
%endif

This has always worked, and I don't see how that wouldn't be valid. But now I get this when running make tag:
cvs tag -c qt-4_4_0-13_fc8
ERROR: Tag qt-4_4_0-13_fc8 is not in a valid tag format
cvs tag: Pre-tag check failed
cvs [tag aborted]: correct the above errors first!
make: *** [tag] Fehler 1

Grrr, with proper formatting:
{{{
%if 0%{?fedora} > 8
Name: qt
%else
Name: qt4
%endif
}}}

And this is a non-scratch build and I'm working with a .spec file, not a SRPM, so I don't see how "Define the macros correctly when you build the srpm and it does the right thing." would be relevant.

And the error from make tag with proper formatting too (Trac's wiki bug tracker is really wacky...):
{{{
cvs tag -c qt-4_4_0-13_fc8
ERROR: Tag qt-4_4_0-13_fc8 is not in a valid tag format
cvs tag: Pre-tag check failed
cvs [tag aborted]: correct the above errors first!
make: *** [tag] Fehler 1
}}}

OK, time to put the donkey hat on, duh, I accidentally copied the makefile from qt/devel to qt4/F-8, so this isn't related.

Re-closing as invalid, see ausil's explanation of why the original report is invalid, and my qt4 issue was also located between keyboard and chair. ;-)

My thanks to ausil, for explaining this really weird behavior!

Okay, it appears that the problem is just poor documentation about scratch builds, coupled with what I think is sub-optimal behavior. For other readers: the macros %fedora, %fc8, etc., are defined in the SRPM, and NOT (as I think they should) by the surrounding build environment. So if you build the SRPM on Fedora 9, and use koji to do a scratch build of the SRPM on dist-f8, %fedora will be 9 and not 8 (!), because %fedora's value was set by the SRPM-builder and not the underlying environment. This isn't a problem in the full CVS-based build environment because "make build" takes the files from CVS and re-builds the SRPM first, and then builds using the new SRPM. That's unfortunate, because this oddity makes scratch builds much less useful, and I think it's the wrong behavior anyway. But KNOWING that is the expected behavior is at least the first step :-).

Hopefully someone will document this in the Wiki pages about scratch builds soon. If no one does that within a few days, I'll modify the documentation pages so that others don't fall into this trap.

Login to comment on this ticket.

Metadata