1

Wednesday 15th July 2009

Problems with Yum and Arch/Noarch Packages

The yum tool as shipped in Fedora 11 will choose an arch-specific package over a "later" arch-independent package - Bug #502401. This is a bit of a blow for those of us trying to move ahead with Features/NoarchSubpackages and it's been closed UPSTREAM and not fixed in Fedora (a pet hate of mine). So I built the Rawhide version of yum (which contains the fix) for F-11 and stuck it in my local repository. This allowed me to build the perl-IO-Zlib update today (the package has build requirements that have changed from arch-specific to arch-independent, and F-11's yum was selecting the arch-specific version, which was too old for perl-IO-Zlib).

Using this update was not without its consequences. My custom repocheck script (a modified version of repoclosure) broke:

Running: repocheck --config=/home/paul/lib/repoc-rhel5-i386.conf --newest --checkrepo city-fan.org-rhel5-i386
Traceback (most recent call last):
  File "/home/paul/bin/repocheck", line 258, in <module>
    main()
  File "/home/paul/bin/repocheck", line 158, in main
    my = RepoClosure(arch = opts.arch, config = opts.config, builddeps = opts.builddeps)
  File "/home/paul/bin/repocheck", line 69, in __init__
    self.doConfigSetup(fn = config,init_plugins=False)
  File "/usr/lib/python2.6/site-packages/yum/__init__.py", line 168, in doConfigSetup
    return self.conf
  File "/usr/lib/python2.6/site-packages/yum/__init__.py", line 681, in <lambda>
    conf = property(fget=lambda self: self._getConfig(),
  File "/usr/lib/python2.6/site-packages/yum/__init__.py", line 210, in _getConfig
    arch = self.arch.canonarch
AttributeError: 'list' object has no attribute 'canonarch'

Now I don't know much python but after a bit of googling around and looking at the code, I made these changes, which seemed to fix things:

--- repoclosure.orig    2009-07-15 17:21:13.168971727 +0100
+++ repoclosure 2009-07-15 17:26:10.748969996 +0100
@@ -69,10 +69,11 @@
     def __init__(self, arch=[], config="/etc/yum.conf", builddeps=False, pkgonly=None):
         yum.YumBase.__init__(self)
         self.logger = logging.getLogger("yum.verbose.repoclosure")
-        self.arch = arch
+        self.arch.archlist = arch
         self.builddeps = builddeps
         self.pkgonly = pkgonly
-        self.doConfigSetup(fn = config,init_plugins=False)
+        self.preconf.fn = config
+        self.preconf.init_plugins = False
         if hasattr(self.repos, 'sqlite'):
             self.repos.sqlite = False
             self.repos._selectSackType()
@@ -98,10 +99,10 @@
     def readMetadata(self):
         self.doRepoSetup()
         archs = []
-        if not self.arch:
+        if not self.arch.archlist:
             archs.extend(rpmUtils.arch.getArchList())
         else:
-            for arch in self.arch:
+            for arch in self.arch.archlist:
                 archs.extend(rpmUtils.arch.getArchList(arch))
         if self.builddeps and 'src' not in archs:
             archs.append('src')

Fedora Project

Local Packages