Bug 430234 - config_opts['macros'] seems ill
Summary: config_opts['macros'] seems ill
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: koji
Version: 8
Hardware: All
OS: Linux
low
low
Target Milestone: ---
Assignee: David Cantrell
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2008-01-25 13:46 UTC by Bryce
Modified: 2013-01-10 01:46 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2008-09-16 21:30:53 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Bryce 2008-01-25 13:46:05 UTC
Description of problem:

(fully updated f8 box)
mock-0.8.19-1.fc8

When set in a mock config file
eg
config_opts['macros'] = '%vendor me\n%_topdir
builddir/build\n%_rpmfilename%%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm\n%_host
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>
    main(retParams)
  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
    chroot.init()
  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
    self._buildDirSetup()
  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
_buildDirSetup
    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) )
            rpmmacros.close()

Phil (python weenie)
=--=

Comment 1 Michael E Brown 2008-01-25 14:29:30 UTC
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 16:33:27 UTC
mock-0.8.19-1.fc8
koji-1.2.2-2.fc8

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)

Phil
=--=

Comment 3 Jesse Keating 2008-05-16 14:16:30 UTC
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 21:30:53 UTC
Should have been closed a while back after 1.2.3 went out. closing.

Phil
=--=


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