How to set %vendor in mock?

Ralf Corsepius rc040203 at freenet.de
Mon Nov 5 20:51:57 UTC 2007


On Mon, 2007-11-05 at 11:10 -0600, Michael E Brown wrote:
> On Mon, Nov 05, 2007 at 09:52:18AM +0100, Ralf Corsepius wrote:
> > On Mon, 2007-11-05 at 02:24 -0500, Todd Zullinger wrote:
> > > Ralf Corsepius wrote:
> > > > Hi,
> > > > 
> > > > in the past, I used to set up %vendor in mock by adding
> > > > ...
> > > > config_opts['macros'] += '%vendor       VENDOR'
> > > > ...
> > > > to customized mock *.cfgs.
> > > > 
> > > > 
> > > > This stopped working with FC7's recent upgrade to mock-0.8.x:
> > > > 
> > > > # mock --configdir=/foo/etc/mock -r fedora-7-i386-test init
> > > > INFO: mock suid wrapper version 0.8.4 
> > > > ERROR: unsupported operand type(s) for +=: 'dict' and 'str'
> > > > Traceback (most recent call last):
> > > >  File "/usr/libexec/mock.py", line 333, in <module>
> > > >    main(retParams)
> > > >  File "/usr/libexec/mock.py", line 249, in main
> > > >    execfile(cfg)
> > > >  File "/foo/etc/mock/fedora-7-i386-test.cfg", line 7, in <module>
> > > >    config_opts['macros'] += '%vendor   VENDOR'
> > > > TypeError: unsupported operand type(s) for +=: 'dict' and 'str'
> > > > 
> > > > Any ideas?
> > > 
> > > I haven't tested this, but I just updated mock today and was looking
> > > at the changes in the defaults.cfg file.  The example given there is:
> > > 
> > > config_opts['macros']['Add_your_macro_name_here'] = "add macro value here"
> > > 
> > > So I'd guess that you want to try something like this:
> > > 
> > > config_opts['macros']['vendor'] = "VENDOR"
> > 
> > Thanks, using
> > config_opts['macros']['%vendor'] = "VENDOR"
> > in *.cfgs seems to do it on fc7.
> > 
> > Problem: This change seems incompatible to older mocks and is breaking
> > sharing *.cfg's with them:
> > 
> > (On a machine using an older mock)
> > ...
> > Traceback (most recent call last):
> >   File "/usr/bin/mock", line 995, in ?
> >     main()
> >   File "/usr/bin/mock", line 951, in main
> >     execfile(cfg)
> >   File "/home/build/etc/mock//fedora-7-i386-test.cfg", line 7, in ?
> >     config_opts['macros']['%vendor'] = 'VENDOR'
> > TypeError: object does not support item assignment
> 
> If you want to share configs between different versions, then you will
> need a bit of python magic. The config file is (for now) a
> fully-interpreted python source file.
Right, this change in mock broke what has been functional for a long
time. You have incompatibly changed the command-line interface and the
configuration file format.

Ralf





More information about the devel mailing list