From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2201) id 6000B385840D; Tue, 23 Apr 2024 18:17:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6000B385840D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1713896227; bh=BCnCuL9h2tHucrttBPJV/qwS1PJF/y55IWChOZ7Bh8Q=; h=To:Subject:Date:From:From; b=lXisP3Psip0J/0khHNy9X7DNDphya4k5BAWuJ3SYbTDYG9avcpJHsrKK3rEt0Z7Fg YuyaWxk3suG39xKtmejNUQ1u9h85hoy5QdlK7vz5c2jkBtPHPab3eV4I32MaW1tQSO hbnFp7e5/kTqiJYYZlqkwQq5/pK1q56Cazq5pWDc= To: cygwin-apps-cvs@sourceware.org Subject: [calm - Cygwin server-side packaging maintenance script] branch master, updated. 20230209-100-g8078633 X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: f1ccc9033618d24da93cd10529faea5a7eaa20be X-Git-Newrev: 8078633ef0e976911e845cceace9bb1826f062d0 Message-Id: <20240423181707.6000B385840D@sourceware.org> Date: Tue, 23 Apr 2024 18:17:07 +0000 (GMT) From: Jon Turney List-Id: https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/calm.git;h=8078633ef0e976911e845cceace9bb1826f062d0 commit 8078633ef0e976911e845cceace9bb1826f062d0 Author: Jon Turney Date: Wed Apr 17 23:08:31 2024 +0100 Be a bit more aggressive about expiring old soversions Allow the source package responsible for the old soversion to be completely expired if it wouldn't normally be kept, and all of it's install packages have no external rdepends. https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/calm.git;h=f4dd6de8b226852989861754b574bf6e9cf65f84 commit f4dd6de8b226852989861754b574bf6e9cf65f84 Author: Jon Turney Date: Wed Apr 17 14:19:57 2024 +0100 Drop 'noretain' hint This was pretty much useless, even more so now we have the 'vault' command to do the same thing. This effectively reverts commit aec1dcf7. Diff: --- calm/hint.py | 1 - calm/package.py | 47 +++++++++++++++++++++++++++++++---------------- 2 files changed, 31 insertions(+), 17 deletions(-) diff --git a/calm/hint.py b/calm/hint.py index 41f55f8..680e3f7 100755 --- a/calm/hint.py +++ b/calm/hint.py @@ -94,7 +94,6 @@ hintkeys[override] = { 'keep-superseded-test': 'noval', 'disable-check': 'val', 'replace-versions': 'val', - 'noretain': 'val', } # valid categories diff --git a/calm/package.py b/calm/package.py index d03989a..2205376 100755 --- a/calm/package.py +++ b/calm/package.py @@ -1660,7 +1660,7 @@ def mark_fn(packages, po, v, certain_age, vault_requests): # shouldn't retain anything. # if pn.endswith('-debuginfo'): - return Freshness.conditional + return (Freshness.conditional, False) # - shared library packages which don't come from the current version of # source (i.e. is superseded or removed), have no packages from a @@ -1674,21 +1674,14 @@ def mark_fn(packages, po, v, certain_age, vault_requests): mtime = po.tar(v).mtime if mtime < certain_age: logging.debug("deprecated soversion package '%s' version '%s' mtime '%s' is over cut-off age" % (pn, v, time.strftime("%F %T %Z", time.localtime(mtime)))) - return Freshness.conditional + return (Freshness.conditional, True) # - if package depends on anything in expired_provides # requires = po.version_hints[v].get('depends', []) if any(ep in requires for ep in past_mistakes.expired_provides): logging.debug("package '%s' version '%s' not retained as it requires a provide known to be expired" % (pn, v)) - return Freshness.conditional - - # - explicitly marked as 'noretain' - # - if 'noretain' in po.override_hints: - noretain_versions = po.override_hints.get('noretain', '').split() - if (v in noretain_versions) or ('all' in noretain_versions): - return Freshness.conditional + return (Freshness.conditional, False) # - marked via 'calm-tool vault' # @@ -1696,10 +1689,10 @@ def mark_fn(packages, po, v, certain_age, vault_requests): if es in vault_requests: if v in vault_requests[es]: logging.info("package '%s' version '%s' not retained due vault request" % (pn, v)) - return Freshness.conditional + return (Freshness.conditional, False) # otherwise, make no change - return Freshness.fresh + return (Freshness.fresh, False) # @@ -1715,9 +1708,6 @@ def stale_packages(packages, vault_requests): # mark install packages for freshness for pn, po in packages.items(): - if po.kind != Kind.binary: - continue - # mark as fresh any versions explicitly listed in the keep: override # hint (unconditionally) for v in po.override_hints.get('keep', '').split(): @@ -1766,13 +1756,38 @@ def stale_packages(packages, vault_requests): if newer: mark_package_fresh(packages, pn, v) + for pn, po in packages.items(): + if po.kind != Kind.binary: + continue + # overwrite with 'conditional' package retention mark if it meets # various criteria for v in sorted(po.versions(), key=lambda v: SetupVersion(v)): - mark = mark_fn(packages, po, v, certain_age, vault_requests) + (mark, others) = mark_fn(packages, po, v, certain_age, vault_requests) if mark != Freshness.fresh: mark_package_fresh(packages, pn, v, mark) + # also look over the other install packages generated by the + # source... + if others: + es = po.version_hints[v].get('external-source', None) + if es: + es_po = packages[es] + # ... if the source package version doesn't count as kept ... + # + # (set above using same critera as for install package + # e.g. we have an excess number of packages) + logging.warning("considering other packages from source package '%s' version '%s'" % (es, v)) + if getattr(es_po.tar(v), 'fresh', Freshness.stale) != Freshness.fresh: + # ... additionally mark anything with no other-source + # rdepends + for opn in sorted(es_po.is_used_by): + if v in packages[opn].versions(): + if not any(packages[p].srcpackage(v) != es for p in packages[opn].rdepends): + mark_package_fresh(packages, opn, v, mark) + else: + logging.warning("package '%s' version '%s' retained due to being used" % (opn, v)) + # mark source packages as fresh if any install package which uses it is fresh for po in packages.values(): if po.kind == Kind.source: