public inbox for cygwin-apps-cvs@sourceware.org
help / color / mirror / Atom feed
* [calm - Cygwin server-side packaging maintenance script] branch master, updated. 20160705-30-g062aa6f
@ 2016-11-03 12:47 jturney
0 siblings, 0 replies; only message in thread
From: jturney @ 2016-11-03 12:47 UTC (permalink / raw)
To: cygwin-apps-cvs
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 7268 bytes --]
https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/calm.git;h=062aa6f6fa6f3e4859c940243b5c15b4db16c989
commit 062aa6f6fa6f3e4859c940243b5c15b4db16c989
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date: Wed Nov 2 14:06:47 2016 +0000
Fix merging of stability level hints
Absent stability level hints are now explicitly noted, so they can be
handled more correctly when merging a package.
https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/calm.git;h=b961780b6c3d5b28ca97a3581050c993ed57bf46
commit b961780b6c3d5b28ca97a3581050c993ed57bf46
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date: Wed Sep 14 19:35:03 2016 +0100
Fix reporting of changed legacy hints
Keep a copy of legacy hints so we can report if they change
https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/calm.git;h=b88b8977d0b7c0a038a868b1ace88fc4a7cdbd66
commit b88b8977d0b7c0a038a868b1ace88fc4a7cdbd66
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date: Wed Nov 2 13:19:11 2016 +0000
Fix keep-count: implementation
Diff:
---
calm/package.py | 33 +++++++++++++++++++++++++++----
test/testdata/uploads/pkglist.expected | 6 ++--
2 files changed, 31 insertions(+), 8 deletions(-)
diff --git a/calm/package.py b/calm/package.py
index 087e554..7861d2d 100755
--- a/calm/package.py
+++ b/calm/package.py
@@ -193,6 +193,13 @@ def read_package(packages, basedir, dirpath, files, strict=False):
if level in hints:
override_hints[level] = hints[level]
+ # explicitly note any absent stability level hints
+ for level in ['test', 'curr', 'prev']:
+ if level not in override_hints:
+ override_hints[level] = None
+
+ # after we have migrated them to override hints, remove stability
+ # level hints from legacy hints
for level in ['test', 'curr', 'prev']:
if level in hints:
del hints[level]
@@ -295,6 +302,7 @@ def read_package(packages, basedir, dirpath, files, strict=False):
packages[p].version_hints = version_hints
packages[p].override_hints = override_hints
+ packages[p].legacy_hints = hints
packages[p].tars = tars
packages[p].hint_files = hint_files
packages[p].path = relpath
@@ -432,8 +440,12 @@ def validate_packages(args, packages):
levels = ['test', 'curr', 'prev']
for l in levels:
if l in packages[p].override_hints:
- # check that version exists
+ # check that if a version was specified, it exists
v = packages[p].override_hints[l]
+
+ if v is None:
+ continue
+
if v not in packages[p].vermap:
logging.error("package '%s' stability '%s' selects non-existent version '%s'" % (p, l, v))
error = True
@@ -456,7 +468,7 @@ def validate_packages(args, packages):
l = levels[0]
# if current stability level has an override
- if l in packages[p].override_hints:
+ if (l in packages[p].override_hints) and (packages[p].override_hints[l] is not None):
# if we haven't reached that version yet
if v != packages[p].override_hints[l]:
break
@@ -485,7 +497,8 @@ def validate_packages(args, packages):
# stability level was overriden to a lower version
for l in levels:
if l in packages[p].override_hints:
- packages[p].stability[l] = packages[p].override_hints[l]
+ if packages[p].override_hints[l] is not None:
+ packages[p].stability[l] = packages[p].override_hints[l]
# the package must have some versions
if not packages[p].stability:
@@ -779,7 +792,17 @@ def merge(a, *l):
pprint.pformat(a[p].version_hints[vr]).splitlines(),
pprint.pformat(b[p].version_hints[vr]).splitlines()))
- logging.warning("package '%s' hints changed\n%s" % (p, diff))
+ logging.warning("package '%s' version '%s' hints changed\n%s" % (p, vr, diff))
+
+ # XXX: we should really do something complex here, like
+ # assign the legacy hints from b to all vr in a which didn't
+ # have a pvr.hint. Instead, just report if it's going to
+ # change and let things get sorted out later on...
+ if a[p].legacy_hints != b[p].legacy_hints:
+ diff = '\n'.join(difflib.ndiff(
+ pprint.pformat(a[p].legacy_hints).splitlines(),
+ pprint.pformat(b[p].legacy_hints).splitlines()))
+ logging.warning("package '%s' hints changed\n%s" % (p, diff))
# overrides from b take precedence
c[p].override_hints.update(b[p].override_hints)
@@ -878,7 +901,7 @@ def stale_packages(packages):
# mark as fresh the highest n versions, where n is given by the
# keep-count: override hint, (defaulting to DEFAULT_KEEP_COUNT)
- keep_count = po.override_hints.get('keep-count', common_constants.DEFAULT_KEEP_COUNT)
+ keep_count = int(po.override_hints.get('keep-count', common_constants.DEFAULT_KEEP_COUNT))
for v in sorted(po.vermap.keys(), key=lambda v: SetupVersion(v), reverse=True)[0:keep_count]:
mark_package_fresh(packages, pn, v)
diff --git a/test/testdata/uploads/pkglist.expected b/test/testdata/uploads/pkglist.expected
index f36b2a4..0e4c587 100644
--- a/test/testdata/uploads/pkglist.expected
+++ b/test/testdata/uploads/pkglist.expected
@@ -6,11 +6,11 @@
'Like itâs youâre Markup Language⢠Nokogiriâs toolâthat '
'Bézier."',
'category': 'Devel',
- 'requires': 'cygwin'}}, {}, False),
+ 'requires': 'cygwin'}}, {'curr': None, 'prev': None, 'test': None}, False),
'testpackage-subpackage': Package('x86/release/testpackage/testpackage-subpackage', {'testpackage-subpackage-1.0-1.tar.bz2': Tar('aff488008bee3486e25b539fe6ccd1397bd3c5c0ba2ee2cf34af279554baa195af7493ee51d6f8510735c9a2ea54436d776a71e768165716762aec286abbbf83', 195, False)}, {'1.0-1': {'sdesc': '"A test subpackage"',
'ldesc': '"A test subpackage"',
'category': 'Devel',
- 'external-source': 'testpackage'}}, {}, False),
+ 'external-source': 'testpackage'}}, {'curr': None, 'prev': None, 'test': None}, False),
'testpackage2-subpackage': Package('x86/release/testpackage2/testpackage2-subpackage', {'testpackage2-subpackage-1.0-1.tar.bz2': Tar('6de201dfed1d45412509c65deb34690dc2d09c6aafccfe491fd2f440f92842b9c755b61dc7bcdd4cc0c9f18cf46c2b3a1241e99c4c2a33fff5555e7b2f0b6348', 14, True)}, {'1.0-1': {'sdesc': '"A test subpackage 2"',
'ldesc': '"A test subpackage 2"',
- 'category': 'Devel'}}, {}, False)}
+ 'category': 'Devel'}}, {'curr': None, 'prev': None, 'test': None}, False)}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2016-11-03 12:47 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-03 12:47 [calm - Cygwin server-side packaging maintenance script] branch master, updated. 20160705-30-g062aa6f jturney
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).