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-47-gd127682
Date: Sat, 18 Nov 2023 16:54:06 +0000 (GMT)	[thread overview]
Message-ID: <20231118165406.76AB03858D35@sourceware.org> (raw)




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

commit d1276826580890434e80b39774dfbd1be6294dbc
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date:   Sun Nov 12 14:47:22 2023 +0000

    Add token 'mock' to send announce only to maintainer
    
    Add token 'mock' to send announce only to maintainer, not the announce list.


Diff:
---
 calm/calm.py | 28 ++++++++++++++++------------
 1 file changed, 16 insertions(+), 12 deletions(-)

diff --git a/calm/calm.py b/calm/calm.py
index 73b0e05..66337ab 100755
--- a/calm/calm.py
+++ b/calm/calm.py
@@ -170,11 +170,7 @@ def process_uploads(args, state):
     def deploy_upload(r):
         m = mlist[r.user]
         with logfilters.AttrFilter(maint=m.name):
-            announce = ('announce' in r.tokens) and ('noannounce' not in r.tokens)
-            if announce and r.announce:
-                announce = r.announce
-
-            return process_maintainer_uploads(args, state, all_packages, m, os.path.join(args.stagingdir, str(r.id)), 'staging', scrub=True, announce=announce)
+            return process_maintainer_uploads(args, state, all_packages, m, os.path.join(args.stagingdir, str(r.id)), 'staging', scrub=True, record=r)
 
     scallywag_db.do_deploys(deploy_upload)
 
@@ -184,7 +180,7 @@ def process_uploads(args, state):
     return state.packages
 
 
-def process_maintainer_uploads(args, state, all_packages, m, basedir, desc, scrub=False, announce=False):
+def process_maintainer_uploads(args, state, all_packages, m, basedir, desc, scrub=False, record=None):
     # for each arch and noarch
     scan_result = {}
     success = True
@@ -206,8 +202,8 @@ def process_maintainer_uploads(args, state, all_packages, m, basedir, desc, scru
         success = _process_maintainer_uploads(scan_result, args, state, all_packages, m, basedir, desc)
 
     # automatically generate announce email if requested
-    if announce and success and any([scan_result[a].to_relarea for a in scan_result]):
-        _announce_upload(args, scan_result, m, announce)
+    if record and success and any([scan_result[a].to_relarea for a in scan_result]):
+        _announce_upload(args, scan_result, m, record)
 
     # remove upload files on success in homedir, always in stagingdir
     for arch in common_constants.ARCHES + ['noarch', 'src']:
@@ -221,7 +217,12 @@ def process_maintainer_uploads(args, state, all_packages, m, basedir, desc, scru
     return success
 
 
-def _announce_upload(args, scan_result, maintainer, announce):
+def _announce_upload(args, scan_result, maintainer, r):
+    announce = ('announce' in r.tokens) and ('noannounce' not in r.tokens)
+
+    if not announce:
+        return
+
     srcpkg = None
     pkglist = set()
     for arch in common_constants.ARCHES + ['noarch', 'src']:
@@ -244,9 +245,9 @@ def _announce_upload(args, scan_result, maintainer, announce):
     to = srcpkg.tar(version)
     tf = to.repopath.abspath(args.rel_area)
 
-    if isinstance(announce, str):
+    if r.announce:
         # use announce message extracted from cygport, if present
-        cl = announce
+        cl = r.announce
     else:
         # otherwise, look in the source tar file for one of the files we know
         # contains an announce message
@@ -289,9 +290,12 @@ def _announce_upload(args, scan_result, maintainer, announce):
     # build the email
     hdr = {}
     hdr['From'] = maintainer.name + ' <cygwin-no-reply@cygwin.com>'
-    hdr['To'] = 'cygwin-announce@cygwin.com'
     hdr['Reply-To'] = 'cygwin@cygwin.com'
     hdr['Bcc'] = ','.join(maintainer.email)
+    if 'mock' in r.tokens:
+        hdr['To'] = hdr['Bcc']
+    else:
+        hdr['To'] = 'cygwin-announce@cygwin.com'
     hdr['Subject'] = srcpkg.orig_name + ' ' + version + (' (TEST)' if test else '')
     hdr['X-Calm-Announce'] = '1'
 


                 reply	other threads:[~2023-11-18 16:54 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=20231118165406.76AB03858D35@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).