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. ~tom == Fedora Project
diff -up fedpkg-1.9/src/pyrpkg/fedpkg/__init__.py.unset-fix fedpkg-1.9/src/pyrpkg/fedpkg/__init__.py --- fedpkg-1.9/src/pyrpkg/fedpkg/__init__.py.unset-fix 2012-09-05 21:51:48.394497326 -0400 +++ fedpkg-1.9/src/pyrpkg/fedpkg/__init__.py 2012-09-05 21:55:16.011500434 -0400 @@ -162,6 +162,7 @@ class Commands(pyrpkg.Commands): self.dist = 'fc%s' % self._distval self.mockconfig = 'fedora-%s-%s' % (self._distval, self.localarch) self.override = 'dist-f%s-override' % self._distval + self._distunset = 'rhel' # Works until RHEL 10 elif re.match(r'el\d$', self.branch_merge): self._distval = self.branch_merge.split('el')[1] @@ -169,11 +170,13 @@ class Commands(pyrpkg.Commands): self.dist = 'el%s' % self._distval self.mockconfig = 'epel-%s-%s' % (self._distval, self.localarch) self.override = 'dist-%sE-epel-override' % self._distval + self._distunset = 'fedora' elif re.match(r'olpc\d$', self.branch_merge): self._distval = self.branch_merge.split('olpc')[1] self._distvar = 'olpc' self.dist = 'olpc%s' % self._distval self.override = 'dist-olpc%s-override' % self._distval + self._distunset = 'rhel' # master elif re.match(r'master$', self.branch_merge): self._distval = self._findmasterbranch() @@ -181,6 +184,7 @@ class Commands(pyrpkg.Commands): self.dist = 'fc%s' % self._distval self.mockconfig = 'fedora-devel-%s' % self.localarch self.override = None + self._distunset = 'rhel' # If we don't match one of the above, punt else: raise pyrpkg.rpkgError('Could not find the dist from branch name ' @@ -193,6 +197,7 @@ class Commands(pyrpkg.Commands): "--define '_rpmdir %s'" % self.path, "--define 'dist .%s'" % self.dist, "--define '%s %s'" % (self._distvar, self._distval), + "--define '%s 0'" % self._distunset, "--define '%s 1'" % self.dist] def load_target(self):
-- devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxxx https://admin.fedoraproject.org/mailman/listinfo/devel