diff options
| author | Michael E Brown <michael_e_brown@dell.com> | 2007-10-20 02:40:09 -0500 |
|---|---|---|
| committer | Michael E Brown <michael_e_brown@dell.com> | 2007-10-20 02:40:09 -0500 |
| commit | 4389ce2a4b22ddcec984af0b419771b2767df2eb (patch) | |
| tree | 947d38d562e41f463527e5c6d158a42a1e81827c /src | |
| parent | c44bc774dcbdc67b1a91f029da7a6869650ad3b5 (diff) | |
| download | mock-4389ce2a4b22ddcec984af0b419771b2767df2eb.tar.gz mock-4389ce2a4b22ddcec984af0b419771b2767df2eb.tar.xz mock-4389ce2a4b22ddcec984af0b419771b2767df2eb.zip | |
make --enable-cache consistent with other opts in '-' vs '_' department. add better help if user gets it wrong.
Diffstat (limited to 'src')
| -rwxr-xr-x | src/mock.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/mock.py b/src/mock.py index aee15e9..f613e4a 100755 --- a/src/mock.py +++ b/src/mock.py @@ -89,9 +89,9 @@ def command_parse(): default=None, help="Fail build if rpmbuild takes longer than 'timeout' seconds ") # caching - parser.add_option("--enable_cache", action="append", dest="enabled_caches", type="string", + parser.add_option("--enable-cache", action="append", dest="enabled_caches", type="string", default=[], help="Disable types of caching. Valid values: 'root_cache', 'yum_cache', 'ccache'") - parser.add_option("--disable_cache", action="append", dest="disabled_caches", type="string", + parser.add_option("--disable-cache", action="append", dest="disabled_caches", type="string", default=[], help="Disable types of caching. Valid values: 'root_cache', 'yum_cache', 'ccache'") return parser.parse_args() @@ -154,9 +154,14 @@ def set_config_opts_per_cmdline(config_opts, options): if options.rpmbuild_timeout is not None: config_opts['rpmbuild_timeout'] = options.rpmbuild_timeout + legalCacheOpts = ("yum_cache", "root_cache", "ccache") for i in options.disabled_caches: + if i not in legalCacheOpts: + raise mock.exception.BadCmdline("Bad option for '--disable-cache=%s'. Expecting one of: %s" % (i, legalCacheOpts)) config_opts['enable_%s' % i] = False for i in options.enabled_caches: + if i not in legalCacheOpts: + raise mock.exception.BadCmdline("Bad option for '--enable-cache=%s'. Expecting one of: %s" % (i, legalCacheOpts)) config_opts['enable_%s' % i] = True if options.cleanup_after and not options.resultdir: |
