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. 20210626-9-gf327e7d
Date: Sat, 22 Jan 2022 15:36:05 +0000 (GMT)	[thread overview]
Message-ID: <20220122153605.CCD533858D37@sourceware.org> (raw)




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

commit f327e7dd59641a89bcf58735964350238fa7c498
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date:   Fri Jan 21 17:01:48 2022 +0000

    Update top-level sha512.sum
    
    Update the top-level sha512.sum, rather than leaving it missing until
    another process later runs 'make-sha'.

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

commit 67e9143991f707627cafdb09798ea14bc1929cae
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date:   Fri Jan 21 16:33:11 2022 +0000

    Drop any special treatment of md5.sum
    
    Drop any special treatment of md5.sum files, which are no longer
    generated by mirror maintainance.


Diff:
---
 calm/calm.py    | 20 +++++++++++++-------
 calm/package.py |  6 +-----
 2 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/calm/calm.py b/calm/calm.py
index b43f65d..731bb7b 100755
--- a/calm/calm.py
+++ b/calm/calm.py
@@ -444,7 +444,8 @@ def do_output(args, state):
                     irk.irk("calm updated setup.ini for arch '%s'" % (arch))
 
                     # compress and re-sign
-                    for ext in ['.ini', '.bz2', '.xz', '.zst']:
+                    extensions = ['.ini', '.bz2', '.xz', '.zst']
+                    for ext in extensions:
                         extfile = os.path.join(basedir, 'setup' + ext)
                         try:
                             os.remove(extfile + '.sig')
@@ -461,12 +462,17 @@ def do_output(args, state):
                         keys = ' '.join(['-u' + k for k in args.keys])
                         utils.system('/usr/bin/gpg ' + keys + ' --batch --yes -b ' + extfile)
 
-                    # arrange for checksums to be recomputed
-                    for sumfile in ['md5.sum', 'sha512.sum']:
-                        try:
-                            os.remove(os.path.join(basedir, sumfile))
-                        except FileNotFoundError:
-                            pass
+                    # recompute checksums
+                    files = ['setup' + ext for ext in extensions] + ['setup' + ext + '.sig' for ext in extensions] + ['setup.ini.bak']
+
+                    hashfile = os.path.join(basedir, 'sha512.sum')
+                    with tempfile.NamedTemporaryFile(mode='w', delete=False) as tmphashfile:
+                        for fn in sorted(files):
+                            sha512 = package.sha512_file(os.path.join(basedir, fn))
+                            print('%s  %s' % (sha512, fn), file=tmphashfile)
+                    logging.info("moving %s to %s" % (tmphashfile.name, hashfile))
+                    shutil.move(tmphashfile.name, hashfile)
+
             else:
                 logging.debug("removing %s, unchanged %s" % (tmpfile.name, inifile))
                 os.remove(tmpfile.name)
diff --git a/calm/package.py b/calm/package.py
index 34424a8..4ec906f 100755
--- a/calm/package.py
+++ b/calm/package.py
@@ -201,7 +201,7 @@ def read_package_dir(packages, basedir, dirpath, files, remove=None, upload=Fals
     # no .hint files
     if not any([f.endswith('.hint') for f in files]):
         if (relpath.count(os.path.sep) > 1):
-            for s in ['md5.sum', 'sha512.sum']:
+            for s in ['sha512.sum']:
                 if s in files:
                     files.remove(s)
 
@@ -211,10 +211,6 @@ def read_package_dir(packages, basedir, dirpath, files, remove=None, upload=Fals
 
         return False
 
-    # discard obsolete md5.sum
-    if 'md5.sum' in files:
-        files.remove('md5.sum')
-
     # ignore dotfiles and backup files
     for f in files[:]:
         if f.startswith('.') or f.endswith('.bak'):



                 reply	other threads:[~2022-01-22 15:36 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=20220122153605.CCD533858D37@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).