diff mbox series

[bug#44447] gnu: pwsafe: Reset timestamps in zip archives

Message ID 87k0v1w0t2.fsf@yahoo.de
State New
Headers show
Series [bug#44447] gnu: pwsafe: Reset timestamps in zip archives | expand

Checks

Context Check Description
cbaines/issue success View issue
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch fail View Laminar job

Commit Message

Tim Gesthuizen Nov. 4, 2020, 4:20 p.m. UTC
Hi,
I had a look at the old discussion and made a second attempt at fixing
the timestamps in the zip files. I wrote a version in C that does the
this back then but was unsuitable for usage in Guix.
Ludo created a draft for directly reading the zip files and zeroing the
time stamps in Scheme as a response.
But he also mentioned that Debians strip-nondeterminism probobaly
already does what we want.
So I took the this route for solving our problems.
strip-nondeterminism is written in Perl. I don't have any experience
with Perl, so probably my package definitions need some cleanup.
In addition, the tests for strip-nondeterminism fail. Yet using it makes
the build of pwsafe deterministic.
The strip-nondeterminism executable will also fail to run without
changes to the environment when run from a profile.
I am also not sure whether debian.scm is the right file for it.

So the patches below are probably more of a draft and it would be really
nice if someone with Perl experience could tweak them.
As there is a very similar problem with jar files in ant-build-system it
might be benefitial to port this approach to it, but I am not sure about
that.

Tim.
diff mbox series

Patch

From 95ce6fe3180f78c38b85853ad9689d191ed25e0c Mon Sep 17 00:00:00 2001
From: Tim Gesthuizen <tim.gesthuizen@yahoo.de>
Date: Wed, 4 Nov 2020 16:10:20 +0100
Subject: [PATCH 3/3] gnu: pwsafe: Reset timestamps in in zip archives

* gnu/packages/password-utils.scm (pwsafe):
  [native-inputs] Add strip-nondeterminism.
  [arguments]: Add a new phase resetting timestamps in zip archives and adapt
  modules for it.
---
 gnu/packages/password-utils.scm | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/password-utils.scm b/gnu/packages/password-utils.scm
index c1bd212f09..85c2248a20 100644
--- a/gnu/packages/password-utils.scm
+++ b/gnu/packages/password-utils.scm
@@ -64,6 +64,7 @@ 
   #:use-module (gnu packages crypto)
   #:use-module (gnu packages cryptsetup)
   #:use-module (gnu packages curl)
+  #:use-module (gnu packages debian)
   #:use-module (gnu packages docbook)
   #:use-module (gnu packages file)
   #:use-module (gnu packages freedesktop)
@@ -227,6 +228,7 @@  algorithms AES or Twofish.")
      `(("gettext" ,gettext-minimal)
        ("gtest" ,googletest)
        ("perl" ,perl)
+       ("strip-nondeterminism" ,strip-nondeterminism)
        ("zip" ,zip)))
     (inputs `(("curl" ,curl)
               ("file" ,file)
@@ -237,7 +239,10 @@  algorithms AES or Twofish.")
               ("qrencode" ,qrencode)
               ("wxwidgets" ,wxwidgets)
               ("xerces-c" ,xerces-c)))
-    (arguments '(#:configure-flags (list "-DNO_GTEST=YES")
+    (arguments `(#:configure-flags (list "-DNO_GTEST=YES")
+                 #:modules ((guix build cmake-build-system)
+                            (guix build utils)
+                            (ice-9 ftw))
                  #:phases (modify-phases %standard-phases
                             (add-after 'unpack 'add-gtest
                               (lambda* (#:key inputs #:allow-other-keys)
@@ -247,7 +252,18 @@  algorithms AES or Twofish.")
                                   (display "find_package(GTest)
 add_subdirectory(src/test)\n" cmake-port)
                                   (close cmake-port)
-                                  #t))))))
+                                  #t)))
+                            (add-after 'build 'patch-zips
+                              (lambda* (#:key inputs #:allow-other-keys)
+                                (ftw (getcwd)
+                                     (lambda (filename statinfo flag)
+                                       (when (and (eq? flag 'regular)
+                                                  (string-suffix? ".zip" filename))
+                                         (chmod filename #o644)
+                                         (invoke "strip-nondeterminism"
+                                                 "-v" filename))
+                                       #t))
+                                #t)))))
     (synopsis "Password safe with automatic input and key generation")
     (description "pwsafe is a password manager originally designed by Bruce
 Schneier.  It offers a simple UI to manage passwords for different services.
-- 
2.29.1