From bd552a577fb7dbe1233b366c95d1741754fbea33 Mon Sep 17 00:00:00 2001 From: Tim Gesthuizen Date: Thu, 17 Jan 2019 20:38:10 +0100 Subject: [PATCH 03/11] gnu: pwsafe: Remove timestamps from zip files * gnu/packages/password-utils.scm (pwsafe): [native-inputs]: Add repack. [arguments]: Add modules and a phase to strip timestamps from the zip files. --- gnu/packages/password-utils.scm | 38 +++++++++++++++++++++++++++++---- 1 file changed, 34 insertions(+), 4 deletions(-) diff --git a/gnu/packages/password-utils.scm b/gnu/packages/password-utils.scm index 5b60ad9cc..47fb9dccb 100644 --- a/gnu/packages/password-utils.scm +++ b/gnu/packages/password-utils.scm @@ -21,7 +21,7 @@ ;;; Copyright © 2018 Arun Isaac ;;; Copyright © 2018 Pierre Neidhardt ;;; Copyright © 2018 Amirouche Boubekki -;;; Copyright © 2018 Tim Gesthuizen +;;; Copyright © 2018, 2019 Tim Gesthuizen ;;; ;;; This file is part of GNU Guix. ;;; @@ -190,7 +190,8 @@ algorithms AES or Twofish.") (build-system cmake-build-system) (native-inputs `(("gettext" ,gettext-minimal) ("perl" ,perl) - ("zip" ,zip))) + ("zip" ,zip) + ("repack" ,repack))) (inputs `(("curl" ,curl) ("file" ,file) ("gtest" ,googletest) @@ -201,7 +202,11 @@ 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 regex) + (ice-9 ftw)) #:phases (modify-phases %standard-phases (add-after 'unpack 'add-gtest (lambda* (#:key inputs #:allow-other-keys) @@ -219,7 +224,32 @@ add_subdirectory(src/test)\n" cmake-port) (("/usr/bin/file") (string-append (assoc-ref inputs "file") "/bin/file"))) - #t))))) + #t)) + (add-after 'install 'fix-zip-timestamps + (lambda* (#:key outputs inputs + #:allow-other-keys) + (let ((out (assoc-ref outputs "out")) + (repack (string-append + (assoc-ref inputs "repack") + "/bin/repack"))) + (with-directory-excursion out + (file-system-fold + (const #t) + (lambda (path stat result) + (when (string-match "^.*\\.zip$" + (basename path)) + (let ((tmp (tmpnam))) + (format #t "Repacking ~s\n" path) + (copy-file path tmp) + (invoke repack + "-o" path + tmp)))) + (const #t) + (const #t) + (const #t) + (lambda _ (throw 'file-system-error)) + #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.20.1