public inbox for cygwin-apps-cvs@sourceware.org
help / color / mirror / Atom feed
* [calm - Cygwin server-side packaging maintenance script] branch master, updated. 20210626-36-g417126b
@ 2022-05-08 14:56 Jon TURNEY
  0 siblings, 0 replies; only message in thread
From: Jon TURNEY @ 2022-05-08 14:56 UTC (permalink / raw)
  To: cygwin-apps-cvs




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

commit 417126bee6afcf6f5f3110d7fa8f7d5c5316c8fa
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date:   Sat Mar 5 16:33:05 2022 +0000

    Factor out navigating from pkg to srcpkg

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

commit 8a55677b7ddc5f268ffd8a0759ae970a0c099ca3
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date:   Mon Feb 28 16:34:29 2022 +0000

    Give unmaintained packages the 'unmaintained' pseudo-category
    
    Give unmaintained packages the 'unmaintained' pseudo-category in
    setup.ini

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

commit 2842bf596c73a76dab7dc26d4d85b8009a6016c1
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date:   Thu Mar 3 16:34:17 2022 +0000

    Drop MoveList.copy()
    
    Unneeded since 46bebfc1

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

commit c4c43f1c5813ba64cefd98354ec0d321a319f883
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date:   Fri Mar 4 17:00:17 2022 +0000

    Drop mailhost & mailport from BufferingSMTPHandler
    
    Drop mailhost & mailport from BufferingSMTPHandler, unused since
    356b1abe changed from using SMTP to sendmail.


Diff:
---
 calm/buffering_smtp_handler.py                |  3 --
 calm/common_constants.py                      |  4 ---
 calm/movelist.py                              | 16 ---------
 calm/package.py                               | 49 +++++++++++++++++++--------
 calm/pkg2html.py                              |  2 +-
 test/testdata/inifile/setup.ini.expected      |  6 ++--
 test/testdata/process_arch/setup.ini.expected |  6 ++--
 7 files changed, 41 insertions(+), 45 deletions(-)

diff --git a/calm/buffering_smtp_handler.py b/calm/buffering_smtp_handler.py
index c826d34..10b1e7b 100644
--- a/calm/buffering_smtp_handler.py
+++ b/calm/buffering_smtp_handler.py
@@ -34,12 +34,9 @@ class BufferingSMTPHandler(logging.handlers.BufferingHandler):
     def __init__(self,
                  toaddrs,
                  subject,
-                 mailhost=common_constants.MAILHOST,
                  fromaddr='cygwin-apps@cygwin.com',
                  logging_format='%(levelname)s: %(message)s'):
         logging.handlers.BufferingHandler.__init__(self, capacity=0)
-        self.mailhost = mailhost
-        self.mailport = None
         self.fromaddr = fromaddr
         self.toaddrs = toaddrs
         self.subject = subject
diff --git a/calm/common_constants.py b/calm/common_constants.py
index ebbe834..203685d 100644
--- a/calm/common_constants.py
+++ b/calm/common_constants.py
@@ -66,9 +66,6 @@ PKGMAINT = '/www/sourceware/htdocs/cygwin/cygwin-pkg-maint'
 # removed files archive directory
 VAULT = '/sourceware/snapshot-tmp/cygwin'
 
-# SMTP smarthost
-MAILHOST = 'localhost'
-
 # defaults for package freshness
 DEFAULT_KEEP_COUNT = 3
 DEFAULT_KEEP_COUNT_TEST = 2
@@ -79,7 +76,6 @@ DEFAULT_KEEP_DAYS = 0
 if os.uname()[1] == 'tambora':
     EMAILS = 'jon.turney@dronecode.org.uk'
     ALWAYS_BCC = ''
-    MAILHOST = 'allegra'
 
 # package compressions
 PACKAGE_COMPRESSIONS = ['bz2', 'gz', 'lzma', 'xz', 'zst']
diff --git a/calm/movelist.py b/calm/movelist.py
index c7bdde8..7bf445f 100644
--- a/calm/movelist.py
+++ b/calm/movelist.py
@@ -23,7 +23,6 @@
 
 import logging
 import os
-import shutil
 
 from collections import defaultdict
 from . import utils
@@ -91,18 +90,3 @@ class MoveList(object):
             if pi:
                 i.movelist[p] = pi
         return i
-
-    # copy the files in a movelist
-    def copy(self, args, fromdir, todir):
-        for p in sorted(self.movelist):
-            logging.debug("mkdir %s" % os.path.join(todir, p))
-            if not args.dryrun:
-                utils.makedirs(os.path.join(todir, p))
-            logging.debug("copy from '%s' to '%s':" % (os.path.join(fromdir, p), os.path.join(todir, p)))
-            for f in sorted(self.movelist[p]):
-                if os.path.exists(os.path.join(fromdir, p, f)):
-                    logging.debug("%s" % (f))
-                    if not args.dryrun:
-                        shutil.copy2(os.path.join(fromdir, p, f), os.path.join(todir, p, f))
-                else:
-                    logging.error("%s can't be copied as it doesn't exist" % (f))
diff --git a/calm/package.py b/calm/package.py
index 8c6a3f1..522689e 100755
--- a/calm/package.py
+++ b/calm/package.py
@@ -79,6 +79,22 @@ class Package(object):
     def versions(self):
         return self.tarfiles.keys()
 
+    def srcpackage(self, vr, suffix=True):
+        if self.kind == Kind.source:
+            spn = self.name
+        else:
+            # source tarfile is in the external-source package, if specified,
+            # otherwise it's in the sibling source package
+            hints = self.version_hints.get(vr, {})
+            spn = hints.get('external-source', self.name + '-src')
+
+        # strip '-src' suffix?
+        if not suffix:
+            if spn.endswith('-src'):
+                spn = spn[:-4]
+
+        return spn
+
 
 # information we keep about a tar file
 class Tar(object):
@@ -419,6 +435,7 @@ def read_one_package(packages, p, relpath, dirpath, files, remove, kind, strict)
             actual_tars[ovr] = tars[vr]
 
     packages[pn] = Package()
+    packages[pn].name = pn
     packages[pn].version_hints = version_hints
     packages[pn].override_hints = override_hints
     packages[pn].tarfiles = actual_tars
@@ -503,6 +520,7 @@ def validate_packages(args, packages, valid_requires_extra=None):
             packages[p].obsolete = False
             packages[p].rdepends = set()
             packages[p].build_rdepends = set()
+            packages[p].orphaned = False
 
     # perform various package validations
     for p in sorted(packages.keys()):
@@ -754,12 +772,7 @@ def validate_packages(args, packages, valid_requires_extra=None):
             sourceless = False
             missing_source = True
 
-            # source tarfile is in the external-source package, if specified,
-            # otherwise it's in the sibling source package
-            if 'external-source' in packages[p].version_hints[v]:
-                es_p = packages[p].version_hints[v]['external-source']
-            else:
-                es_p = p + '-src'
+            es_p = packages[p].srcpackage(v)
 
             # mark the source tarfile as being used by an install tarfile
             if es_p in packages:
@@ -836,7 +849,7 @@ def validate_packages(args, packages, valid_requires_extra=None):
 
             # ignore packages which have a different external-source:
             # (e.g. where a different source package supersedes this one)
-            es = packages[install_p].version_hints[packages[install_p].best_version].get('external-source', source_p)
+            es = packages[install_p].srcpackage(packages[install_p].best_version)
             if es != source_p:
                 continue
 
@@ -878,6 +891,7 @@ def validate_package_maintainers(args, packages):
     # read maintainer list
     mlist = {}
     mlist = maintainers.add_packages(mlist, args.pkglist)
+    pkg_maintainers = maintainers.invert(mlist)
 
     # make the list of all packages
     all_packages = maintainers.all_packages(mlist)
@@ -900,7 +914,7 @@ def validate_package_maintainers(args, packages):
         # validate that the source package has a maintainer
         bv = packages[p].best_version
         if bv:
-            es = packages[p].version_hints[bv].get('external-source', p)
+            es = packages[p].srcpackage(bv)
             if es in packages:
                 es_pn = packages[es].orig_name
                 if es_pn not in all_packages and p not in all_packages:
@@ -908,6 +922,10 @@ def validate_package_maintainers(args, packages):
                         logging.error("package '%s' is not obsolete, but has no maintainer" % (p))
                         error = True
 
+        if 'ORPHANED' in pkg_maintainers[packages[p].orig_name]:
+            # note orphaned packages
+            packages[p].orphaned = True
+
     return error
 
 
@@ -969,9 +987,13 @@ def write_setup_ini(args, packages, arch):
             if 'ldesc' in po.version_hints[bv]:
                 print("ldesc: %s" % po.version_hints[bv]['ldesc'], file=f)
 
+            # mark orphaned packages with the 'unmaintained' pseudo-category
+            category = po.version_hints[bv]['category']
+            if po.orphaned:
+                category += ' unmaintained'
             # for historical reasons, category names must start with a capital
             # letter
-            category = ' '.join(map(upper_first_character, po.version_hints[bv]['category'].split()))
+            category = ' '.join(map(upper_first_character, category.split()))
             print("category: %s" % category, file=f)
 
             # compute the union of requires for all versions
@@ -1074,12 +1096,9 @@ def write_setup_ini(args, packages, arch):
                 hints = po.version_hints.get(version, {})
 
                 # follow external-source
-                if 'external-source' in hints:
-                    s = hints['external-source']
-                else:
-                    s = sibling_src
-                    if s not in packages:
-                        s = None
+                s = po.srcpackage(version)
+                if s not in packages:
+                    s = None
 
                 # external-source points to a source file in another package
                 if s:
diff --git a/calm/pkg2html.py b/calm/pkg2html.py
index b2080dc..ae6a6a7 100755
--- a/calm/pkg2html.py
+++ b/calm/pkg2html.py
@@ -243,7 +243,7 @@ def update_package_listings(args, packages):
                         if homepage:
                             print('<span class="detail">homepage</span>: <a href="%s">%s</a><br><br>' % (homepage, homepage), file=f)
                     else:
-                        es = po.version_hints[bv].get('external-source', p + '-src')
+                        es = po.srcpackage(bv)
                         print('<span class="detail">source package</span>: %s<br><br>' % linkify_package(es), file=f)
 
                     es_po = arch_package(packages, es)
diff --git a/test/testdata/inifile/setup.ini.expected b/test/testdata/inifile/setup.ini.expected
index 3f583d7..b96b8a9 100644
--- a/test/testdata/inifile/setup.ini.expected
+++ b/test/testdata/inifile/setup.ini.expected
@@ -339,7 +339,7 @@
  '\n'
  '@ test-c\n'
  'sdesc: "test package C"\n'
- 'category: Devel\n'
+ 'category: Devel Unmaintained\n'
  'requires: test-d test-e\n'
  'version: 1.0-1\n'
  'install: noarch/release/test-c/test-c-1.0-1.tar.xz 256 '
@@ -351,7 +351,7 @@
  '\n'
  '@ test-d\n'
  'sdesc: "test package D"\n'
- 'category: Devel\n'
+ 'category: Devel Unmaintained\n'
  'version: 1.0.42590-1\n'
  'install: noarch/release/test-d/test-d-1.0-1.tar.xz 236 '
  '2e47817b620a7dbfe6810d47aee0adbcdf4663dc57932bcc51fc4b9bcfafa00dbbc2bfbefb1692dd5f6cc5333f23aea324d7c4d9b2ca091b917811fcdb70ca1f\n'
@@ -360,7 +360,7 @@
  '\n'
  '@ test-e\n'
  'sdesc: "test package E"\n'
- 'category: Devel\n'
+ 'category: Devel Unmaintained\n'
  'version: 1.0-1\n'
  'install: noarch/release/test-e/test-e-1.0-1.tar.xz 236 '
  '2e47817b620a7dbfe6810d47aee0adbcdf4663dc57932bcc51fc4b9bcfafa00dbbc2bfbefb1692dd5f6cc5333f23aea324d7c4d9b2ca091b917811fcdb70ca1f\n'
diff --git a/test/testdata/process_arch/setup.ini.expected b/test/testdata/process_arch/setup.ini.expected
index d97f1a3..9e9fb93 100644
--- a/test/testdata/process_arch/setup.ini.expected
+++ b/test/testdata/process_arch/setup.ini.expected
@@ -328,7 +328,7 @@
  '\n'
  '@ test-c\n'
  'sdesc: "test package C"\n'
- 'category: Devel\n'
+ 'category: Devel Unmaintained\n'
  'requires: test-d test-e\n'
  'version: 1.0-1\n'
  'install: noarch/release/test-c/test-c-1.0-1.tar.xz 256 '
@@ -340,7 +340,7 @@
  '\n'
  '@ test-d\n'
  'sdesc: "test package D"\n'
- 'category: Devel\n'
+ 'category: Devel Unmaintained\n'
  'version: 1.0.42590-1\n'
  'install: noarch/release/test-d/test-d-1.0-1.tar.xz 236 '
  '2e47817b620a7dbfe6810d47aee0adbcdf4663dc57932bcc51fc4b9bcfafa00dbbc2bfbefb1692dd5f6cc5333f23aea324d7c4d9b2ca091b917811fcdb70ca1f\n'
@@ -349,7 +349,7 @@
  '\n'
  '@ test-e\n'
  'sdesc: "test package E"\n'
- 'category: Devel\n'
+ 'category: Devel Unmaintained\n'
  'version: 1.0-1\n'
  'install: noarch/release/test-e/test-e-1.0-1.tar.xz 236 '
  '2e47817b620a7dbfe6810d47aee0adbcdf4663dc57932bcc51fc4b9bcfafa00dbbc2bfbefb1692dd5f6cc5333f23aea324d7c4d9b2ca091b917811fcdb70ca1f\n'



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-05-08 14:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-08 14:56 [calm - Cygwin server-side packaging maintenance script] branch master, updated. 20210626-36-g417126b Jon TURNEY

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).