Bug 430234 - config_opts['macros'] seems ill
config_opts['macros'] seems ill
Product: Fedora
Classification: Fedora
Component: koji (Show other bugs)
All Linux
low Severity low
: ---
: ---
Assigned To: David Cantrell
Fedora Extras Quality Assurance
: Reopened
Depends On:
  Show dependency treegraph
Reported: 2008-01-25 08:46 EST by Bryce
Modified: 2013-01-09 20:46 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2008-09-16 17:30:53 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Bryce 2008-01-25 08:46:05 EST
Description of problem:

(fully updated f8 box)

When set in a mock config file
config_opts['macros'] = '%vendor me\n%_topdir
i386-linux-gnu\n%packager mr.trouble\n%distribution Unknown\n%_host_cpu i386'

(or even just as config_opts['macros'] = '')

mock seems to have issues as follows

ERROR: 'str' object has no attribute 'items'
Traceback (most recent call last):
  File "/usr/libexec/mock.py", line 593, in <module>
  File "/usr/libexec/mock.py", line 538, in main
    do_rebuild(config_opts, chroot, args)
  File "<peak.util.decorators.rewrap wrapping __main__.do_rebuild at
0x008CE1B8>", line 3, in do_rebuild
    def do_rebuild(config_opts, chroot, srpms): return __decorated(config_opts,
chroot, srpms)
  File "/usr/lib/python2.5/site-packages/mock/trace_decorator.py", line 70, in trace
    result = func(*args, **kw)
  File "/usr/libexec/mock.py", line 342, in do_rebuild
  File "<peak.util.decorators.rewrap wrapping mock.backend.init at 0x008BC1B8>",
line 3, in init
    def init(self): return __decorated(self)
  File "/usr/lib/python2.5/site-packages/mock/trace_decorator.py", line 70, in trace
    result = func(*args, **kw)
  File "/usr/lib/python2.5/site-packages/mock/backend.py", line 257, in init
  File "<peak.util.decorators.rewrap wrapping mock.backend._buildDirSetup at
0x008C5488>", line 3, in _buildDirSetup
    def _buildDirSetup(self): return __decorated(self)
  File "/usr/lib/python2.5/site-packages/mock/trace_decorator.py", line 70, in trace
    result = func(*args, **kw)
  File "/usr/lib/python2.5/site-packages/mock/backend.py", line 558, in
    for key, value in self.macros.items():
AttributeError: 'str' object has no attribute 'items'

Dropping the config_opts['macros'] directive from the mock.cfg file works
so am I doing something seriously dumb (though that macro line is passed by koji
so it probably is correctly formatted though I'm guessing thats not really the
issue here)

/usr/lib/python2.5/site-packages/mock/backend.py +558
            # rpmmacros default
            macrofile_out = self.makeChrootPath(self.homedir, ".rpmmacros")
            rpmmacros = open(macrofile_out, 'w+')
            for key, value in self.macros.items():
                rpmmacros.write( "%s %s\n" % (key, value) )

Phil (python weenie)
Comment 1 Michael E Brown 2008-01-25 09:29:30 EST
Format for the macros var changed in like, 0.8.0 or something.
/etc/mock/defaults.cfg has an example of the syntax.
Comment 2 Bryce 2008-01-25 11:33:27 EST

config_opts['macros']['Add_your_macro_name_here'] = "add macro value here"

ooook,.. well that makes sense. Right, looks like there is a disconnect between
what the koji folk are getting their code to generate vs what current mock expects

I guess this bug should be shifted over the the koji package (trying to shift
the bug over so don't scream too loudly if this update fails to do that)

Comment 3 Jesse Keating 2008-05-16 10:16:30 EDT
Koji 1.2.2 is known not to work with later mock releases.  Mock 0.9.x and koji
1.2.3 or later are needed.  This will be resolved in the next release.
Comment 4 Bryce 2008-09-16 17:30:53 EDT
Should have been closed a while back after 1.2.3 went out. closing.


Note You need to log in before you can comment on or make changes to this bug.