fedpkg / koji error

Tom Callaway tcallawa at redhat.com
Thu Sep 6 02:07:16 UTC 2012

On 09/05/2012 12:48 PM, Simone Caronni wrote:
> This means that even for the EPEL branch the first %if block is
> evaluated; so the fedpkg on my system (Fedora 17) sets %rhel to 6 but
> does not unset %fedora and they are both present.

Confirmed. fedpkg is inheriting the value of "%fedora" from the base OS
on EPEL targets.

The reason why is because fedpkg determines the dist tag values from the
branch name, and then passes them to rpm via the "--define" flag, which
overrides those specific macros if present, but leaves all the other RPM
macros intact. RPM has no "--undefine" flag to disable a macro, so the
best thing we can do is to --define the unused dist tag target to 0
(%fedora for EL branches, %rhel for Fedora branches). There is some
legacy code in fedmsg handling now-obsolete OLPC branches, so in my
patch, I just told it to treat "rhel" as the unused dist tag for the
OLPC branch case.

This change might cause a slight change in evaluated behavior, if anyone
was doing something depending on %rhel or %fedora being unset, but the
common case of checking value like you do (and like we document):

%if 0%{rhel}

should evaluate to:

00, or 0. I've tested and confirmed this fix resolves your specific
conditionals such that only one resolves on each branch.

(If you want to see this in action on a Fedora box, check out a package
that has an EPEL branch, go to the EPEL branch, and add the following
under %setup:

echo "fedora is %{?fedora}"
echo "rhel is %{?rhel}"

Then, run fedpkg prep and note the output.)

Jesse, I'm not sure if you're still the correct upstream here, please
correct me if you're not, and I'll send the patch somewhere else.


Fedora Project
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fedpkg-1.9-unset-unused-distvar.patch
Type: text/x-patch
Size: 2239 bytes
Desc: not available
URL: <http://lists.fedoraproject.org/pipermail/devel/attachments/20120905/e7cafe69/attachment.bin>

More information about the devel mailing list