From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?UTF-8?Q?G=C3=A1bor?= Boskovits Subject: bug#30104: [PATCH] gnu: ant-bootstrap: Make build reproducible. Date: Mon, 11 Jun 2018 13:52:45 +0200 Message-ID: <20180611115245.11851-1-boskovits@gmail.com> References: <87shb9axcp.fsf@gmail.com> Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:40298) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fSLOf-0000Uu-7O for bug-guix@gnu.org; Mon, 11 Jun 2018 07:54:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fSLOc-0002Yd-3Q for bug-guix@gnu.org; Mon, 11 Jun 2018 07:54:05 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:34937) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fSLOb-0002YJ-Vd for bug-guix@gnu.org; Mon, 11 Jun 2018 07:54:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fSLOb-0005aM-Ja for bug-guix@gnu.org; Mon, 11 Jun 2018 07:54:01 -0400 In-Reply-To: <87shb9axcp.fsf@gmail.com> Sender: "Debbugs-submit" Resent-Message-ID: List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: "bug-Guix" To: 30104@debbugs.gnu.org * gnu/packages/java.scm (ant-bootstrap)[arguments]<#:phases>[strip-jar-timestamps]: New phase to reset jar file timestamps. <#:imported-modules>: Import guix build syscalls, gnu-build-system-modules. <#:modules>: Import guix build: gnu-build-system, utils, syscalls. [native-inputs]: Add unzip, zip. --- gnu/packages/java.scm | 43 +++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 41 insertions(+), 2 deletions(-) diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm index 678cbee18..4fdce65af 100644 --- a/gnu/packages/java.scm +++ b/gnu/packages/java.scm @@ -212,7 +212,13 @@ JNI.") "1cg0lga887qz5iizh6mlkxp01lciymrhmp7wzxpl6zpnldxmzrjx")))) (build-system gnu-build-system) (arguments - `(#:tests? #f ; no "check" target + `(#:imported-modules ((guix build syscalls) + ,@%gnu-build-system-modules) + #:modules ((srfi srfi-1) + (guix build gnu-build-system) + (guix build utils) + (guix build syscalls)) + #:tests? #f ; no "check" target #:phases (modify-phases %standard-phases (delete 'bootstrap) @@ -254,10 +260,43 @@ JNI.") (zero? (system* "bash" "bootstrap.sh" (string-append "-Ddist.dir=" (assoc-ref %outputs "out")))))) + (add-after 'build 'strip-jar-timestamps ;based on ant-build-system + (lambda* (#:key outputs #:allow-other-keys) + (define (repack-archive jar) + (let* ((dir (mkdtemp! "jar-contents.XXXXXX")) + (manifest (string-append dir "/META-INF/MANIFESTS.MF"))) + (and (with-directory-excursion dir + (invoke "unzip" jar)) + (delete-file jar) + ;; XXX: copied from (gnu build install) + (for-each (lambda (file) + (let ((s (lstat file))) + (unless (eq? (stat:type s) 'symlink) + (utime file 0 0 0 0)))) + (find-files dir #:directories? #t)) + ;; It is important that the manifes appears first. + (with-directory-excursion dir + (let* ((files (find-files "." ".*" #:directories? #t)) + ;; To ensure that the reference scanner can + ;; detect all store references in the jars + ;; we disable compression with the "-0" option. + (command (if (file-exists? manifest) + `("zip" "-0" "-X" ,jar ,manifest + ,@files) + `("zip" "-0" "-X" ,jar ,@files)))) + (apply invoke command))) + (utime jar 0 0) + #t))) + (every repack-archive + (find-files + (string-append (assoc-ref %outputs "out") "/lib") + "\\.jar$")))) (delete 'install)))) (native-inputs `(("jikes" ,jikes) - ("jamvm" ,jamvm-1-bootstrap))) + ("jamvm" ,jamvm-1-bootstrap) + ("unzip" ,unzip) + ("zip", zip))) (home-page "http://ant.apache.org") (synopsis "Build tool for Java") (description -- 2.17.1