[calm - Cygwin server-side packaging maintenance script] branch master, updated. 20190530-33-gd75abce

jturney-9JcytcrH/[email protected]
Newsgroups gmane.os.cygwin.cvs.apps
Message-ID <[email protected]>


https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/calm.git;h=d75abceedb46749982669236c5c102796a1fbfb1

commit d75abceedb46749982669236c5c102796a1fbfb1
Author: Jon Turney <[email protected]>
Date:   Sun Apr 28 19:32:17 2019 +0100

    Don't depend on an obsoleting package


Diff:
---
 calm/package.py |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/calm/package.py b/calm/package.py
index 008d01c..4ce1660 100755
--- a/calm/package.py
+++ b/calm/package.py
@@ -464,6 +464,27 @@ def validate_packages(args, packages):
                     logging.error("package '%s' version '%s' refers to nonexistent or errored external-source '%s'" % (p, v, e))
                     error = True
 
+        # If package A is obsoleted by package B, B should appear in the
+        # requires: for A (so the upgrade occurs with pre-depends: aware
+        # versions of setup), but not in the depends: for A (as that creates an
+        # unsatisfiable dependency when explicitly installing A with lisolv
+        # versions of setup, which should just install B).  This condition can
+        # occur since we might have synthesized the depends: from the requires:
+        # in read_hints(), so fix that up here.
+        for (v, hints) in packages[p].version_hints.items():
+            obsoletes = hints.get('obsoletes', '')
+            if obsoletes:
+                for o in obsoletes.split(','):
+                    o = o.strip()
+                    o = re.sub(r'(.*) +\(.*\)', r'\1', o)
+
+                    for (ov, ohints) in packages[o].version_hints.items():
+                        if 'depends' in ohints:
+                            depends = ohints['depends'].split(',')
+                            depends = [d for d in depends if d != p]
+                            packages[o].version_hints[ov]['depends'] = ','.join(depends)
+                            logging.debug("removed obsoleting '%s' from the depends: of package '%s'" % (p, o))
+
         packages[p].vermap = defaultdict(defaultdict)
         is_empty = {}
         has_install = False
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.