diff options
author | Jon Turney <jon.turney@dronecode.org.uk> | 2017-10-05 14:23:19 +0300 |
---|---|---|
committer | Jon Turney <jon.turney@dronecode.org.uk> | 2017-10-06 16:33:17 +0300 |
commit | 6aa625a6a83ae615a859f61993696a1665340690 (patch) | |
tree | 2eb1279624bdeedd8fb4a14de2db2eac9a9b73c2 | |
parent | 4a10c12553a645bd719c056fdc9b463f1065702f (diff) |
Upgrade some checks from a warning to an error
Make "curr: version isn't the most recent non-test: version" and "empty but
not in _obsolete category" errors.
Fix tests by fixing up package timestamps
-rwxr-xr-x | calm/package.py | 14 | ||||
-rwxr-xr-x | test/test_calm.py | 37 |
2 files changed, 48 insertions, 3 deletions
diff --git a/calm/package.py b/calm/package.py index 75bb88d..ed4cf00 100755 --- a/calm/package.py +++ b/calm/package.py @@ -559,13 +559,17 @@ def validate_packages(args, packages): elif 'curr' not in packages[p].stability and 'curr' not in getattr(args, 'okmissing', []): logging.warning("package '%s' doesn't have a curr version" % (p)) - # warn if the curr: version isn't the most recent non-test: version + # error if the curr: version isn't the most recent non-test: version for v in sorted(packages[p].vermap.keys(), key=lambda v: packages[p].vermap[v]['mtime'], reverse=True): if 'test' in packages[p].version_hints[v]: continue if packages[p].stability['curr'] != v: - lvl = logging.WARNING if p not in past_mistakes.mtime_anomalies else logging.DEBUG + if p in past_mistakes.mtime_anomalies: + lvl = logging.DEBUG + else: + lvl = logging.ERROR + error = True logging.log(lvl, "package '%s' version '%s' is most recent non-test version, but version '%s' is curr:" % (p, v, packages[p].stability['curr'])) break @@ -590,7 +594,11 @@ def validate_packages(args, packages): if 'source' not in packages[p].vermap[vr]: if 'install' in packages[p].vermap[vr]: if packages[p].tars[packages[p].vermap[vr]['install']].is_empty: - lvl = logging.WARNING if p not in past_mistakes.empty_but_not_obsolete else logging.DEBUG + if p in past_mistakes.empty_but_not_obsolete: + lvl = logging.DEBUG + else: + lvl = logging.ERROR + error = True logging.log(lvl, "package '%s' version '%s' has empty install tar file and no source, but it's not in the _obsolete category" % (p, vr)) # make another pass to verify a source tarfile exists for every install diff --git a/test/test_calm.py b/test/test_calm.py index 805b7d7..0f30e85 100755 --- a/test/test_calm.py +++ b/test/test_calm.py @@ -376,6 +376,43 @@ class CalmTest(unittest.TestCase): # remove !ready files os.system("find testdata/homes -name !ready -exec rm {} \;") + # fix up package timestamps so highest version is also latest + # (git doesn't store timestamps, so they will all be dated the time of checkout) + relarea_x86 = os.path.join('testdata', 'relarea', 'x86', 'release') + relarea_noarch = os.path.join('testdata', 'relarea', 'noarch', 'release') + touches = [(os.path.join(relarea_x86, 'cygwin', 'cygwin-2.2.0-1.tar.xz'), '2016-11-01'), + (os.path.join(relarea_x86, 'cygwin', 'cygwin-2.2.0-1-src.tar.xz'), '2016-11-01'), + (os.path.join(relarea_x86, 'cygwin', 'cygwin-2.2.1-1.tar.xz'), '2016-11-02'), + (os.path.join(relarea_x86, 'cygwin', 'cygwin-2.2.1-1-src.tar.xz'), '2016-11-02'), + (os.path.join(relarea_x86, 'cygwin', 'cygwin-debuginfo', 'cygwin-debuginfo-2.2.0-1.tar.xz'), '2016-11-01'), + (os.path.join(relarea_x86, 'cygwin', 'cygwin-debuginfo', 'cygwin-debuginfo-2.2.1-1.tar.xz'), '2016-11-02'), + (os.path.join(relarea_x86, 'cygwin', 'cygwin-devel', 'cygwin-devel-2.2.0-1.tar.xz'), '2016-11-01'), + (os.path.join(relarea_x86, 'cygwin', 'cygwin-devel', 'cygwin-devel-2.2.1-1.tar.xz'), '2016-11-02'), + (os.path.join(relarea_x86, 'base-cygwin', 'base-cygwin-3.6-1.tar.xz'), '2016-11-02'), + (os.path.join(relarea_x86, 'per-version', 'per-version-4.0-1.tar.xz'), '2017-04-09'), + (os.path.join(relarea_x86, 'per-version', 'per-version-4.0-1-src.tar.xz'), '2017-04-09'), + (os.path.join(relarea_x86, 'rpm-doc', 'rpm-doc-4.1-2.tar.bz2'), '2016-11-02'), + (os.path.join(relarea_x86, 'rpm-doc', 'rpm-doc-4.1-2-src.tar.bz2'), '2016-11-02'), + (os.path.join(relarea_x86, 'staleversion', 'staleversion-240-1.tar.xz'), '2017-04-07'), + (os.path.join(relarea_x86, 'staleversion', 'staleversion-240-1-src.tar.xz'), '2017-04-07'), + (os.path.join(relarea_x86, 'staleversion', 'staleversion-242-0.tar.xz'), '2017-04-08'), + (os.path.join(relarea_x86, 'staleversion', 'staleversion-242-0-src.tar.xz'), '2017-04-08'), + (os.path.join(relarea_x86, 'staleversion', 'staleversion-243-0.tar.xz'), '2017-04-09'), + (os.path.join(relarea_x86, 'staleversion', 'staleversion-243-0-src.tar.xz'), '2017-04-09'), + (os.path.join(relarea_x86, 'staleversion', 'staleversion-250-0.tar.xz'), '2017-04-10'), + (os.path.join(relarea_x86, 'staleversion', 'staleversion-250-0-src.tar.xz'), '2017-04-10'), + (os.path.join(relarea_x86, 'staleversion', 'staleversion-251-0.tar.xz'), '2017-04-09'), + (os.path.join(relarea_x86, 'staleversion', 'staleversion-251-0-src.tar.xz'), '2017-04-09'), + (os.path.join(relarea_x86, 'staleversion', 'staleversion-260-0.tar.xz'), '2017-04-12'), + (os.path.join(relarea_x86, 'staleversion', 'staleversion-260-0-src.tar.xz'), '2017-04-12'), + (os.path.join(relarea_x86, 'keychain', 'keychain-2.6.8-1.tar.bz2'), '2016-11-02'), + (os.path.join(relarea_x86, 'keychain', 'keychain-2.6.8-1-src.tar.bz2'), '2016-11-02'), + (os.path.join(relarea_noarch, 'perl-Net-SMTP-SSL', 'perl-Net-SMTP-SSL-1.03-1.tar.xz'), '2016-11-01'), + (os.path.join(relarea_noarch, 'perl-Net-SMTP-SSL', 'perl-Net-SMTP-SSL-1.03-1-src.tar.xz'), '2016-11-01'), + ] + for (f, t) in touches: + os.system('touch %s -d %s' % (f, t)) + if __name__ == '__main__': logging.getLogger().setLevel(logging.INFO) |