From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 103667 invoked by alias); 7 Mar 2018 14:26:13 -0000 Mailing-List: contact cygwin-apps-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: cygwin-apps-cvs-owner@sourceware.org Received: (qmail 102680 invoked by uid 9795); 7 Mar 2018 14:26:12 -0000 Date: Wed, 07 Mar 2018 14:26:00 -0000 Message-ID: <20180307142612.102510.qmail@sourceware.org> From: jturney@sourceware.org To: cygwin-apps-cvs@sourceware.org Subject: [calm - Cygwin server-side packaging maintenance script] branch master, updated. 20180131-12-gabb1c0d X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: 58511d13883d29a4f1b54cf7ff12f2aa35589837 X-Git-Newrev: abb1c0d1b0e9c1e7d2e53bb32cf17848c232c523 X-SW-Source: 2018-q1/txt/msg00051.txt.bz2 https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/calm.git;h=abb1c0d1b0e9c1e7d2e53bb32cf17848c232c523 commit abb1c0d1b0e9c1e7d2e53bb32cf17848c232c523 Author: Jon Turney Date: Mon Mar 5 16:33:40 2018 +0000 Make test_scan_uploads repeatable setup.hint files get renamed at upload since 828b91be, so use a copy of testdata/homes to make the test repeatable. https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/calm.git;h=37099fb8b4007e7d10a6eded2bb2e849500f9b3f commit 37099fb8b4007e7d10a6eded2bb2e849500f9b3f Author: Jon Turney Date: Sun Mar 4 22:57:50 2018 +0000 Warn if replace-versions: lists a version which is also offered for install https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/calm.git;h=0c45049b6635216921348e00d7e88d782fe6868c commit 0c45049b6635216921348e00d7e88d782fe6868c Author: Jon Turney Date: Thu Mar 1 18:03:30 2018 +0000 Improve reasons for not migrating reported by hint-migrate Diff: --- calm/hint-migrate.py | 21 ++++++++++++++++++--- calm/package.py | 15 ++++++++++----- test/test_calm.py | 10 ++++++++++ 3 files changed, 38 insertions(+), 8 deletions(-) diff --git a/calm/hint-migrate.py b/calm/hint-migrate.py index 4d8156e..858e68b 100644 --- a/calm/hint-migrate.py +++ b/calm/hint-migrate.py @@ -50,6 +50,7 @@ def hint_migrate(args): setup_hint_fn = os.path.join(dirpath, 'setup.hint') migrate = set() + vr = set() for f in files: match = re.match(r'^(.*?)(-src|)\.tar\.(bz2|gz|lzma|xz)$', f) @@ -58,6 +59,7 @@ def hint_migrate(args): continue pvr = match.group(1) + vr.add(pvr) # pvr.hint already exists? if os.path.exists(os.path.join(dirpath, pvr + '.hint')): @@ -67,13 +69,26 @@ def hint_migrate(args): # nothing to migrate if not migrate: + # that's ok if all vr already have a pvr.hint, but if we didn't + # find any vr, something is wrong + if not vr: + print("can't migrate %s as it has no versions" % (setup_hint_fn)) continue - # does the setup.hint parse as a pvr.hint - # (i.e. does it not contain version keys) + # does the setup.hint parse as a pvr.hint? hints = hint.hint_file_parse(setup_hint_fn, hint.pvr) if 'parse-errors' in hints: - print("can't migrate %s as it contains version keys" % (setup_hint_fn)) + reason = "is invalid as a pvr.hint" + + # specifically mention if it doesn't parse as a pvr.hint because + # it contains version keys + for e in hints['parse-errors']: + if (e.startswith('unknown key prev') or + e.startswith('unknown key curr') or + e.startswith('test has non-empty value')): + reason = "contains version keys" + + print("can't migrate %s as it %s" % (setup_hint_fn, reason)) continue for pvr in migrate: diff --git a/calm/package.py b/calm/package.py index e54ed25..85d5368 100755 --- a/calm/package.py +++ b/calm/package.py @@ -647,15 +647,20 @@ def validate_packages(args, packages): packages[p].best_version = None error = True - # warn if replace-versions lists a version which is less than the - # current version (which is pointless as the current version will - # replace it anyhow) if 'replace-versions' in packages[p].override_hints: - if packages[p].best_version: - for rv in packages[p].override_hints['replace-versions'].split(): + for rv in packages[p].override_hints['replace-versions'].split(): + # warn if replace-versions lists a version which is less than + # the current version (which is pointless as the current version + # will replace it anyhow) + if packages[p].best_version: if SetupVersion(rv) <= SetupVersion(packages[p].best_version): logging.warning("package '%s' replace-versions: uselessly lists version '%s', which is <= current version" % (p, rv)) + # warn if replace-versions lists a version which is also + # available to install (as this doesn't work as expected) + if rv in packages[p].version_hints: + logging.warning("package '%s' replace-versions: lists version '%s', which is also available to install" % (p, rv)) + # If the install tarball is empty and there is no source tarball, we # should probably be marked obsolete if not packages[p].skip: diff --git a/test/test_calm.py b/test/test_calm.py index 35f0e24..f514b7d 100755 --- a/test/test_calm.py +++ b/test/test_calm.py @@ -290,11 +290,18 @@ class CalmTest(unittest.TestCase): def test_scan_uploads(self): self.maxDiff = None + test_root = tempfile.mktemp() + logging.info('test_root = %s', test_root) + args = types.SimpleNamespace() setattr(args, 'arch', 'x86') setattr(args, 'rel_area', 'testdata/relarea') setattr(args, 'dryrun', False) + shutil.copytree('testdata/homes', os.path.join(test_root, 'testdata/homes')) + oldcwd = os.getcwd() + os.chdir(test_root) + pkglist = ['after-ready', 'not-ready', 'testpackage', 'testpackage2'] mlist = {} @@ -311,6 +318,9 @@ class CalmTest(unittest.TestCase): scan_result = uploads.scan(m, pkglist + ['not-on-maintainer-list'], args.arch, args) + os.chdir(oldcwd) + shutil.rmtree(test_root) + self.assertEqual(scan_result.error, False) compare_with_expected_file(self, 'testdata/uploads', dict(scan_result.to_relarea), 'move') self.assertCountEqual(scan_result.to_vault, {'x86/release/testpackage': ['x86/release/testpackage/testpackage-0.1-1.tar.bz2']})