public inbox for cygwin-apps-cvs@sourceware.org
help / color / mirror / Atom feed
From: Jon Turney <jturney@sourceware.org>
To: cygwin-apps-cvs@sourceware.org
Subject: [calm - Cygwin server-side packaging maintenance script] branch master, updated. 20230209-15-g1e16eb1
Date: Thu,  6 Apr 2023 18:41:10 +0000 (GMT)	[thread overview]
Message-ID: <20230406184110.A163F3858D28@sourceware.org> (raw)




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

commit 1e16eb115b67f70c293860d54ef399dd35d81d33
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date:   Thu Apr 6 16:59:14 2023 +0100

    Add obsoletes_by to package summary page
    
    It would be nice to also show rdepends and rbuild_depends, but those
    could be huge lists.

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

commit 9616ae8068814cd07e5e935827e84930921be118
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date:   Thu Apr 6 16:58:43 2023 +0100

    Improve error handling for untest|vault with invalid package name
    
    Produce an error message for untest|vault with invalid package name, rather than a python backtrace.


Diff:
---
 calm/pkg2html.py                                 | 16 +++++++++++-----
 calm/tool_util.py                                |  6 +++++-
 test/testdata/htdocs.expected/summary/obs-a.html |  1 +
 test/testdata/htdocs.expected/summary/obs-b.html |  1 +
 4 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/calm/pkg2html.py b/calm/pkg2html.py
index ee8fdea..a4cd59a 100755
--- a/calm/pkg2html.py
+++ b/calm/pkg2html.py
@@ -212,7 +212,9 @@ def update_package_listings(args, packages):
                     if po.kind == package.Kind.source:
                         details = ['build-depends']
                     else:
-                        details = ['depends', 'obsoletes', 'provides', 'conflicts']
+                        details = ['depends', 'obsoletes', 'obsoleted_by', 'provides', 'conflicts']
+
+                    detail_is_attr = ['obsoleted_by']
 
                     for key in details:
                         # make the union of the package list for this detail
@@ -221,11 +223,15 @@ def update_package_listings(args, packages):
                         value = {}
                         values = set()
                         for arch in pos:
-                            t = pos[arch].version_hints[pos[arch].best_version].get(key, None)
-                            if t:
-                                value[arch] = set(t.split(', '))
+                            if key in detail_is_attr:
+                                value[arch] = getattr(pos[arch], key, set())
                             else:
-                                value[arch] = set()
+                                t = pos[arch].version_hints[pos[arch].best_version].get(key, None)
+
+                                if t:
+                                    value[arch] = set(t.split(', '))
+                                else:
+                                    value[arch] = set()
                             values.update(value[arch])
 
                         if values:
diff --git a/calm/tool_util.py b/calm/tool_util.py
index f677f86..dc4d882 100644
--- a/calm/tool_util.py
+++ b/calm/tool_util.py
@@ -48,8 +48,12 @@ def permitted(p):
         logging.error("who are you?")
         return False
 
-    # CYGNAME is a maintainer for package
     pkg_list = maintainers.pkg_list(common_constants.PKGMAINT)
+    if p not in pkg_list:
+        logging.error("%s is not a package name" % p)
+        return False
+
+    # CYGNAME is a maintainer for package
     if cygname in pkg_list[p].maintainers():
         return True
 
diff --git a/test/testdata/htdocs.expected/summary/obs-a.html b/test/testdata/htdocs.expected/summary/obs-a.html
index 32c9da9..c7164d7 100644
--- a/test/testdata/htdocs.expected/summary/obs-a.html
+++ b/test/testdata/htdocs.expected/summary/obs-a.html
@@ -13,6 +13,7 @@
 <span class="detail">summary</span>: obsolete package A<br><br>
 <span class="detail">description</span>: obsolete package A<br><br>
 <span class="detail">categories</span>: Devel<br><br>
+<span class="detail">obsoleted_by</span>: <a href="test-c.html">test-c</a><br><br>
 <span class="detail">source package</span>: <a href="obs-a-src.html">obs-a</a><br><br>
 <span class="detail">maintainer(s)</span>: ORPHANED 
 <span class="smaller">(Use <a href="/lists.html#cygwin">the mailing list</a> to report bugs or ask questions.
diff --git a/test/testdata/htdocs.expected/summary/obs-b.html b/test/testdata/htdocs.expected/summary/obs-b.html
index 935c0c5..a560262 100644
--- a/test/testdata/htdocs.expected/summary/obs-b.html
+++ b/test/testdata/htdocs.expected/summary/obs-b.html
@@ -13,6 +13,7 @@
 <span class="detail">summary</span>: obsolete package B<br><br>
 <span class="detail">description</span>: obsolete package B<br><br>
 <span class="detail">categories</span>: Devel<br><br>
+<span class="detail">obsoleted_by</span>: <a href="test-c.html">test-c</a><br><br>
 <span class="detail">source package</span>: <a href="obs-b-src.html">obs-b</a><br><br>
 <span class="detail">maintainer(s)</span>: ORPHANED 
 <span class="smaller">(Use <a href="/lists.html#cygwin">the mailing list</a> to report bugs or ask questions.


                 reply	other threads:[~2023-04-06 18:41 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230406184110.A163F3858D28@sourceware.org \
    --to=jturney@sourceware.org \
    --cc=cygwin-apps-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).