This is the mail archive of the cygwin-apps mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

calm: two patches


>From f35d1d01e83b6e319b249f736b69eb4e4e677d6d Mon Sep 17 00:00:00 2001
From: Achim Gratz <Achim.Gratz@Stromeko.DE>
Date: Sat, 17 Sep 2016 18:47:44 +0200
Subject: [PATCH 1/2] Use Base64URL encoding for the checksums

* calm/package.py (sha512_file): Import base64 and use Base64URL
  encoding for the checksums for higher coding effieiency and shorter
  setup files.
---
 calm/package.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/calm/package.py b/calm/package.py
index a5881e3..90b386e 100755
--- a/calm/package.py
+++ b/calm/package.py
@@ -26,6 +26,7 @@
 #
 
 from collections import defaultdict
+import base64
 import copy
 import difflib
 import hashlib
@@ -103,7 +104,7 @@ def sha512_file(fn, block_size=256*128):
         for chunk in iter(lambda: f.read(block_size), b''):
             sha512.update(chunk)
 
-    return sha512.hexdigest()
+    return base64.urlsafe_b64encode(sha512.digest())[:86].decode()
 
 
 # helper function to read hints
-- 
2.8.3

>From 3fa17efb7049f7cc20c119c0a696e4f4212dd6bc Mon Sep 17 00:00:00 2001
From: Achim Gratz <Achim.Gratz@Stromeko.DE>
Date: Sat, 17 Sep 2016 18:49:19 +0200
Subject: [PATCH 2/2] Write human-readable time in addition to machine-readable
 timestamp

* calm/package.py (write_setup_ini): In addition to the epoch
  timestamp write that time (as a comment) in human-readable form so
  that it can be more easily deciphered.
---
 calm/package.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/calm/package.py b/calm/package.py
index 90b386e..30eb0c4 100755
--- a/calm/package.py
+++ b/calm/package.py
@@ -655,7 +655,9 @@ def write_setup_ini(args, packages, arch):
         if args.release:
             print("release: %s" % args.release, file=f)
         print("arch: %s" % arch, file=f)
-        print("setup-timestamp: %d" % time.time(), file=f)
+        tz = time.time()
+        print("# Created on %s" % time.ctime(tz), file=f)
+        print("setup-timestamp: %d" % tz, file=f)
         if args.setup_version:
             print("setup-version: %s" % args.setup_version, file=f)
 
-- 
2.8.3




Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

SD adaptations for Waldorf Q V3.00R3 and Q+ V3.54R2:
http://Synth.Stromeko.net/Downloads.html#WaldorfSDada


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]