diff options
author | Jon Turney <jon.turney@dronecode.org.uk> | 2018-05-14 21:46:29 +0300 |
---|---|---|
committer | Jon Turney <jon.turney@dronecode.org.uk> | 2018-05-14 23:53:02 +0300 |
commit | 1add34cdb5d4713f808fa9e11805ec8d5a3b7f75 (patch) | |
tree | aa52033526f3a2c5b54b1729b34b258c03d61bf0 | |
parent | 360ce8ab8fad46abe3611abf207c643595ca5fd8 (diff) |
Add support for 'missing-curr' token in disabled-check: key in pvr.hint
in pvr.hint, disable-check can contain:
missing-curr:
check that package has a current version
Move identification of best-version earlier to support this.
Also fix looking for empty-obsolete in disable-check.
-rwxr-xr-x | calm/package.py | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/calm/package.py b/calm/package.py index 3fe2c40..cbae949 100755 --- a/calm/package.py +++ b/calm/package.py @@ -598,12 +598,25 @@ def validate_packages(args, packages): packages[p].version_hints[v][l] = '' break + # identify a 'best' version to take certain information from: this is + # the curr version, if we have one, otherwise, the highest version. + if ('curr' in packages[p].stability) and (packages[p].stability['curr'] in packages[p].vermap): + packages[p].best_version = packages[p].stability['curr'] + elif len(packages[p].vermap): + packages[p].best_version = sorted(packages[p].vermap.keys(), key=lambda v: SetupVersion(v), reverse=True)[0] + else: + logging.error("package '%s' doesn't have any versions" % (p)) + packages[p].best_version = None + error = True + # the package must have some versions if not packages[p].stability: 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 'missing-curr' not in getattr(args, 'disable_check', []): + elif (('curr' not in packages[p].stability) and + ('missing-curr' not in packages[p].version_hints[packages[p].best_version].get('disable-check', '')) 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 @@ -632,17 +645,6 @@ def validate_packages(args, packages): break - # identify a 'best' version to take certain information from: this is - # the curr version, if we have one, otherwise, the highest version. - if ('curr' in packages[p].stability) and (packages[p].stability['curr'] in packages[p].vermap): - packages[p].best_version = packages[p].stability['curr'] - elif len(packages[p].vermap): - packages[p].best_version = sorted(packages[p].vermap.keys(), key=lambda v: SetupVersion(v), reverse=True)[0] - else: - logging.error("package '%s' doesn't have any versions" % (p)) - packages[p].best_version = None - error = True - if 'replace-versions' in packages[p].override_hints: for rv in packages[p].override_hints['replace-versions'].split(): # warn if replace-versions lists a version which is less than @@ -666,7 +668,7 @@ def validate_packages(args, packages): if 'install' in packages[p].vermap[vr]: if packages[p].tar(vr, 'install').is_empty: if ((p in past_mistakes.empty_but_not_obsolete) or - ('empty-obsolete' in packages[p].version_hints.get('disable-check', ''))): + ('empty-obsolete' in packages[p].version_hints[vr].get('disable-check', ''))): lvl = logging.DEBUG else: lvl = logging.ERROR |