* calm: two patches
@ 2016-09-17 16:51 Achim Gratz
2016-09-19 13:50 ` Jon Turney
0 siblings, 1 reply; 3+ messages in thread
From: Achim Gratz @ 2016-09-17 16:51 UTC (permalink / raw)
To: cygwin-apps
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: calm: two patches
2016-09-17 16:51 calm: two patches Achim Gratz
@ 2016-09-19 13:50 ` Jon Turney
2016-09-19 18:21 ` Achim Gratz
0 siblings, 1 reply; 3+ messages in thread
From: Jon Turney @ 2016-09-19 13:50 UTC (permalink / raw)
To: cygwin-apps
On 17/09/2016 17:51, Achim Gratz wrote:
> From 3fa17efb7049f7cc20c119c0a696e4f4212dd6bc Mon Sep 17 00:00:00 2001
> From: Achim Gratz <Achim.Gratz-GL6zORMxvAD+tKtrA809HA@public.gmane.org>
> 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.
This is a good idea. Applied, with updated tests. Thanks.
> From f35d1d01e83b6e319b249f736b69eb4e4e677d6d Mon Sep 17 00:00:00 2001
> From: Achim Gratz <Achim.Gratz-GL6zORMxvAD+tKtrA809HA@public.gmane.org>
> 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 efficiency and shorter
> setup files.
[...]
> - return sha512.hexdigest()
> + return base64.urlsafe_b64encode(sha512.digest())[:86].decode()
I'm not so sure about this.
Firstly, this doesn't do what's wanted (always use Base64 encoded
hashes), as the hash is only computed here if it's not available from a
sha512.sum file (which mirror maintenance scripts on sourceware generate
for us)
So, I guess the correct change would be to re-encode the sha512 hashes
from hex to base64 somewhere.
I'm not sure I really see the value in that, though. It would reduce
the length of the hashes from 86 to 128 characters, so setup.ini gets
somewhat less that 33% smaller, but I'm sceptical that the size of the
compressed setup.ini file changes much.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: calm: two patches
2016-09-19 13:50 ` Jon Turney
@ 2016-09-19 18:21 ` Achim Gratz
0 siblings, 0 replies; 3+ messages in thread
From: Achim Gratz @ 2016-09-19 18:21 UTC (permalink / raw)
To: cygwin-apps
Jon Turney writes:
> Firstly, this doesn't do what's wanted (always use Base64 encoded
> hashes), as the hash is only computed here if it's not available from
> a sha512.sum file (which mirror maintenance scripts on sourceware
> generate for us)
>
> So, I guess the correct change would be to re-encode the sha512 hashes
> from hex to base64 somewhere.
OK, then that's the correct solution.
> I'm not sure I really see the value in that, though. It would reduce
> the length of the hashes from 86 to 128 characters, so setup.ini gets
> somewhat less that 33% smaller, but I'm sceptical that the size of the
> compressed setup.ini file changes much.
It shrinks by about 4% when compressed as .xz last I looked, but more
importantly for me anyway is that more of the lines don't wrap when I
look at those files.
Regards,
Achim.
--
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+
Waldorf MIDI Implementation & additional documentation:
http://Synth.Stromeko.net/Downloads.html#WaldorfDocs
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-09-19 18:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-17 16:51 calm: two patches Achim Gratz
2016-09-19 13:50 ` Jon Turney
2016-09-19 18:21 ` Achim Gratz
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).