Created attachment 954078 [details] fix for macros on mock cfg Description of problem: Whenever we set config_opts['macros'] in cfg improperly, mock builds without errors and warning messages about invalid arguments. In particularly, this consist of passing empty/one-word macros to mock. But using [-D] command line option we have at least error message if we try to write one-word macros (which is also invalid). Version-Release number of selected component (if applicable): 1.2.0-1 How reproducible: Write it to *.cfg file: 1. Empty macros name: config_opts['macros'][''] = '%this_macros_name this_is_macros_body!' 2. Empty value (single macros name): config_opts['macros']['%macros_name_only'] = '' 3. Empty all: config_opts['macros'][''] = '' Additional info: Actually, this works and successfully added to .rpmmacros in chroot. Cons are: 1. less readable *.cfg 2. if'll try to get self.config['macros']['name'], we can get result in empty string Proposed patch: Fixed with fix-config-macros.patch which disables invalid args.
Created attachment 954079 [details] fix fot --define command line option Additional patch fix-cmd-macros.patch fixes one-word macros with whitespace chars: * -D "%macros_name" -> error * -D " %macros_name " -> no error
Commited as 79d380a and 9a86fdb. Thanks for contribution.
For the record I changed in your patch: k = '%%%s' % k to: k = '{0}'.format(k) for better readability. And one fix to previos comment: Those commits are: 79d380a and 97abcbc
FYI, the config generated by fedpkg mock-config contains such item (the %distribution): # Auto-generated by the Koji build system config_opts['chroothome'] = '/builddir' config_opts['use_host_resolv'] = False config_opts['basedir'] = '/var/lib/mock' config_opts['rpmbuild_timeout'] = 86400 config_opts['yum.conf'] = '[main]\ncachedir=/var/cache/yum\ndebuglevel=1\nlogfile=/var/log/yum.log\nreposdir=/dev/null\nretries=20\nobsoletes=1\ngpgcheck=0\nassumeyes=1\n\n# repos\n\n[build]\nname=build\nbaseurl=http://kojipkgs.fedoraproject.org//repos/f22-build/432475/x86_64\n' config_opts['chroot_setup_cmd'] = 'groupinstall build' config_opts['target_arch'] = 'x86_64' config_opts['root'] = 'rawhide-x86_64' config_opts['plugin_conf']['root_cache_enable'] = False config_opts['plugin_conf']['yum_cache_enable'] = False config_opts['plugin_conf']['ccache_enable'] = False config_opts['macros']['%_host'] = 'x86_64-koji-linux-gnu' config_opts['macros']['%_host_cpu'] = 'x86_64' config_opts['macros']['%vendor'] = 'Koji' config_opts['macros']['%distribution'] = None config_opts['macros']['%_topdir'] = '/builddir/build' config_opts['macros']['%_rpmfilename'] = '%%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm' config_opts['macros']['%packager'] = 'Koji'
If it really needs, it's still possible to write something like this: config_opts['macros']['%distribution'] = '%{nil}'
The problem is not whether they need it. It's that the config is returned by koji. And we cannot easily change Koji. I assume the reason why you implemented this is because it's easy to make such mistake when entering macro defines on commandline. But in the config this doesn't seem to be possible to happen by accident. One doesn't simply type None by accident. Therefore I'd suggest to apply this check only to arguments passed on the commandline.
mock-1.2.1-1.fc21 has been submitted as an update for Fedora 21. https://admin.fedoraproject.org/updates/mock-1.2.1-1.fc21
mock-1.2.1-1.fc20 has been submitted as an update for Fedora 20. https://admin.fedoraproject.org/updates/mock-1.2.1-1.fc20
mock-1.2.1-1.el7 has been submitted as an update for Fedora EPEL 7. https://admin.fedoraproject.org/updates/mock-1.2.1-1.el7
mock-1.2.1-1.el6 has been submitted as an update for Fedora EPEL 6. https://admin.fedoraproject.org/updates/mock-1.2.1-1.el6
Package mock-1.2.1-1.fc20: * should fix your issue, * was pushed to the Fedora 20 testing repository, * should be available at your local mirror within two days. Update it with: # su -c 'yum update --enablerepo=updates-testing mock-1.2.1-1.fc20' as soon as you are able to. Please go to the following url: https://admin.fedoraproject.org/updates/FEDORA-2014-15217/mock-1.2.1-1.fc20 then log in and leave karma (feedback).
mock-1.2.3-1.fc21 has been submitted as an update for Fedora 21. https://admin.fedoraproject.org/updates/mock-1.2.3-1.fc21
mock-1.2.3-1.fc20 has been submitted as an update for Fedora 20. https://admin.fedoraproject.org/updates/mock-1.2.3-1.fc20
mock-1.2.3-1.el7 has been submitted as an update for Fedora EPEL 7. https://admin.fedoraproject.org/updates/mock-1.2.3-1.el7
mock-1.2.3-1.fc21 has been pushed to the Fedora 21 stable repository. If problems still persist, please make note of it in this bug report.
mock-1.2.3-1.fc20 has been pushed to the Fedora 20 stable repository. If problems still persist, please make note of it in this bug report.
mock-1.2.3-1.el7 has been pushed to the Fedora EPEL 7 stable repository. If problems still persist, please make note of it in this bug report.