From: "Gábor Boskovits" <boskovits@gmail.com>
To: 30104@debbugs.gnu.org
Subject: bug#30104: [PATCH] gnu: ant-bootstrap: Make build reproducible.
Date: Mon, 11 Jun 2018 13:52:45 +0200 [thread overview]
Message-ID: <20180611115245.11851-1-boskovits@gmail.com> (raw)
In-Reply-To: <87shb9axcp.fsf@gmail.com>
* 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
next prev parent reply other threads:[~2018-06-11 11:54 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-14 4:16 bug#30104: ant-bootstrap@1.7.1 does not build reproducibly on core-updates Chris Marusich
2018-01-14 9:35 ` Gábor Boskovits
2018-01-14 16:40 ` Ricardo Wurmus
2018-01-18 8:58 ` bug#30104: Difference seems to be caused by timestamp Gábor Boskovits
2018-01-18 9:58 ` Gábor Boskovits
2018-06-11 11:52 ` Gábor Boskovits [this message]
2018-06-12 13:15 ` bug#30104: [PATCH] gnu: ant-bootstrap: Make build reproducible Ludovic Courtès
2018-06-12 13:21 ` Ricardo Wurmus
2018-06-18 8:38 ` bug#30104: ant-bootstrap does not build reproducibly Gábor Boskovits
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180611115245.11851-1-boskovits@gmail.com \
--to=boskovits@gmail.com \
--cc=30104@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
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).