diff options
author | Jon Turney <jon.turney@dronecode.org.uk> | 2017-11-30 01:55:21 +0300 |
---|---|---|
committer | Jon Turney <jon.turney@dronecode.org.uk> | 2017-11-30 14:49:32 +0300 |
commit | cd23cb2d268a566d224785ae14f77ea4cc8e6061 (patch) | |
tree | 87e995f0a6d7443a942be997f1b76e66bc75b91b | |
parent | a44390655e05567726d4f511a4ec1a890569ffe6 (diff) |
Add mksetupini option --disable-check
Add mksetupini option --disable-check, as a more general replacement for
--okmissing
-rwxr-xr-x | calm/mksetupini.py | 11 | ||||
-rwxr-xr-x | calm/package.py | 14 |
2 files changed, 17 insertions, 8 deletions
diff --git a/calm/mksetupini.py b/calm/mksetupini.py index 6433d0f..deeaf80 100755 --- a/calm/mksetupini.py +++ b/calm/mksetupini.py @@ -101,8 +101,9 @@ def main(): parser = argparse.ArgumentParser(description='Make setup.ini') parser.add_argument('--arch', action='store', required=True, choices=common_constants.ARCHES) + parser.add_argument('--disable-check', action='append', help='checks to disable', choices=['missing-curr', 'missing-depended-package', 'missing-obsoleted-package', 'missing-required-package'], default=[]) parser.add_argument('--inifile', '-u', action='store', help='output filename', required=True) - parser.add_argument('--okmissing', action='append', help='missing things which are ok', choices=['curr', 'depended-package', 'obsoleted-package', 'required-package']) + parser.add_argument('--okmissing', action='append', help='superseded by --disable-check', choices=['curr', 'depended-package', 'obsoleted-package', 'required-package']) parser.add_argument('--pkglist', action='store', nargs='?', metavar='FILE', help="package maintainer list (default: " + pkglist_default + ")", const=pkglist_default) parser.add_argument('--release', action='store', help='value for setup-release key (default: cygwin)', default='cygwin') parser.add_argument('--releasearea', action='store', metavar='DIR', help="release directory (default: " + relarea_default + ")", default=relarea_default, dest='rel_area') @@ -117,6 +118,14 @@ def main(): logging.basicConfig(format=os.path.basename(sys.argv[0]) + ': %(message)s') + # The option name 'okmissing' was inherited from genini. The more general + # option 'disable-check' is intended to supersede that, eventually. + # + # For the moment '--okmissing=foo' is silently transformed into it's + # equivalent '--disable-check=missing-foo' + if args.okmissing: + args.disable_check.extend(['missing-' + m for m in args.okmissing]) + return do_main(args) diff --git a/calm/package.py b/calm/package.py index 73ba0ed..1ce28a8 100755 --- a/calm/package.py +++ b/calm/package.py @@ -416,9 +416,9 @@ def validate_packages(args, packages): for (v, hints) in packages[p].version_hints.items(): for (c, okmissing, splitchar) in [ - ('requires', 'required-package', None), - ('depends', 'depended-package', ','), - ('obsoletes', 'obsoleted-package', ',') + ('requires', 'missing-required-package', None), + ('depends', 'missing-depended-package', ','), + ('obsoletes', 'missing-obsoleted-package', ',') ]: if c in hints: for r in hints[c].split(splitchar): @@ -438,10 +438,10 @@ def validate_packages(args, packages): lvl = logging.WARNING if p not in past_mistakes.self_requires else logging.DEBUG logging.log(lvl, "package '%s' version '%s' %s itself" % (p, v, c)) - # all packages listed in a hint must exist (unless - # okmissing says that's ok) + # all packages listed in a hint must exist (unless the + # disable-check option says that's ok) if r not in packages: - if okmissing not in getattr(args, 'okmissing', []): + if okmissing not in getattr(args, 'disable_check', []): logging.error("package '%s' version '%s' %s nonexistent package '%s'" % (p, v, c, r)) error = True continue @@ -597,7 +597,7 @@ def validate_packages(args, packages): logging.error("no versions at any stability level for package '%s'" % (p)) error = True # it's also probably a really good idea if a curr version exists - elif 'curr' not in packages[p].stability and 'curr' not in getattr(args, 'okmissing', []): + elif 'curr' not in packages[p].stability and 'missing-curr' not in getattr(args, 'disable_check', []): logging.warning("package '%s' doesn't have a curr version" % (p)) # error if the curr: version isn't the most recent non-test: version |