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




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'):



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

only message in thread, other threads:[~2022-01-22 15:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-22 15:36 [calm - Cygwin server-side packaging maintenance script] branch master, updated. 20210626-9-gf327e7d 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).