From 394b939ed84154c203c614c23e4f6bc2df17613c Mon Sep 17 00:00:00 2001 From: Tim Gesthuizen Date: Sat, 19 Jan 2019 16:58:34 +0100 Subject: [PATCH 02/11] guix: utils: Add repack-archives Add a function that repacks all archives in a certain directory to be reproduceably buildable. * guix/build/utils.scm (repack-archives): New function. --- guix/build/utils.scm | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/guix/build/utils.scm b/guix/build/utils.scm index 5fe328684..3ca72299a 100644 --- a/guix/build/utils.scm +++ b/guix/build/utils.scm @@ -3,6 +3,7 @@ ;;; Copyright © 2013 Andreas Enge ;;; Copyright © 2013 Nikita Karetnikov ;;; Copyright © 2015, 2018 Mark H Weaver +;;; Copyright © 2019 Tim Gesthuizen ;;; ;;; This file is part of GNU Guix. ;;; @@ -88,6 +89,7 @@ fold-port-matches remove-store-references wrap-program + repack-archives invoke invoke-error? @@ -1100,6 +1102,15 @@ with definitions for VARS." (chmod prog-tmp #o755) (rename-file prog-tmp prog)))) +(define (repack-archives root regex) + "Repack all archives under ROOT that match REGEX using the repack program." + (define (repack-archive jar) + (format #t "repacking ~a\n" jar) + (let* ((tmp (tmpnam))) + (copy-file jar tmp) + (invoke "repack" "-o" jar tmp))) + (for-each repack-archive (find-files root regex))) + ;;; ;;; Locales. -- 2.20.1