build-system/ant: Unconditionally return #t in build phases.

* guix/build/ant-build-system.scm (unpack, build, strip-jar-timestamps, check,
install): Use invoke.

Signed-off-by: Gábor Boskovits <boskovits@gmail.com>
This commit is contained in:
Ricardo Wurmus 2018-06-16 12:20:32 +02:00 committed by Gábor Boskovits
parent cded3a7593
commit d7ee90fe90
No known key found for this signature in database
GPG Key ID: 2506A96CCF630B21

View File

@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU ;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2016 Ricardo Wurmus <rekado@elephly.net> ;;; Copyright © 2016, 2018 Ricardo Wurmus <rekado@elephly.net>
;;; ;;;
;;; This file is part of GNU Guix. ;;; This file is part of GNU Guix.
;;; ;;;
@ -150,7 +150,8 @@ to the default GNU unpack strategy."
(begin (begin
(mkdir "src") (mkdir "src")
(with-directory-excursion "src" (with-directory-excursion "src"
(zero? (system* "jar" "-xf" source)))) (invoke "jar" "-xf" source))
#t)
;; Use GNU unpack strategy for things that aren't jar archives. ;; Use GNU unpack strategy for things that aren't jar archives.
((assq-ref gnu:%standard-phases 'unpack) #:source source))) ((assq-ref gnu:%standard-phases 'unpack) #:source source)))
@ -171,7 +172,7 @@ to the default GNU unpack strategy."
(define* (build #:key (make-flags '()) (build-target "jar") (define* (build #:key (make-flags '()) (build-target "jar")
#:allow-other-keys) #:allow-other-keys)
(zero? (apply system* `("ant" ,build-target ,@make-flags)))) (apply invoke `("ant" ,build-target ,@make-flags)))
(define* (generate-jar-indices #:key outputs #:allow-other-keys) (define* (generate-jar-indices #:key outputs #:allow-other-keys)
"Generate file \"META-INF/INDEX.LIST\". This file does not use word wraps "Generate file \"META-INF/INDEX.LIST\". This file does not use word wraps
@ -194,50 +195,49 @@ repack them. This is necessary to ensure that archives are reproducible."
(format #t "repacking ~a\n" jar) (format #t "repacking ~a\n" jar)
(let* ((dir (mkdtemp! "jar-contents.XXXXXX")) (let* ((dir (mkdtemp! "jar-contents.XXXXXX"))
(manifest (string-append dir "/META-INF/MANIFEST.MF"))) (manifest (string-append dir "/META-INF/MANIFEST.MF")))
(and (with-directory-excursion dir (with-directory-excursion dir
(zero? (system* "jar" "xf" jar))) (invoke "jar" "xf" jar))
(delete-file jar) (delete-file jar)
;; XXX: copied from (gnu build install) ;; XXX: copied from (gnu build install)
(for-each (lambda (file) (for-each (lambda (file)
(let ((s (lstat file))) (let ((s (lstat file)))
(unless (eq? (stat:type s) 'symlink) (unless (eq? (stat:type s) 'symlink)
(utime file 0 0 0 0)))) (utime file 0 0 0 0))))
(find-files dir #:directories? #t)) (find-files dir #:directories? #t))
;; The jar tool will always set the timestamp on the manifest file ;; The jar tool will always set the timestamp on the manifest file
;; and the containing directory to the current time, even when we ;; and the containing directory to the current time, even when we
;; reuse an existing manifest file. To avoid this we use "zip" ;; reuse an existing manifest file. To avoid this we use "zip"
;; instead of "jar". It is important that the manifest appears ;; instead of "jar". It is important that the manifest appears
;; first. ;; first.
(with-directory-excursion dir (with-directory-excursion dir
(let* ((files (find-files "." ".*" #:directories? #t)) (let* ((files (find-files "." ".*" #:directories? #t))
;; To ensure that the reference scanner can detect all ;; To ensure that the reference scanner can detect all
;; store references in the jars we disable compression ;; store references in the jars we disable compression
;; with the "-0" option. ;; with the "-0" option.
(command (if (file-exists? manifest) (command (if (file-exists? manifest)
`("zip" "-0" "-X" ,jar ,manifest ,@files) `("zip" "-0" "-X" ,jar ,manifest ,@files)
`("zip" "-0" "-X" ,jar ,@files)))) `("zip" "-0" "-X" ,jar ,@files))))
(unless (zero? (apply system* command)) (apply invoke command)))
(error "'zip' failed")))) (utime jar 0 0)
(utime jar 0 0) #t))
#t)))
(every (match-lambda (for-each (match-lambda
((output . directory) ((output . directory)
(every repack-archive (find-files directory "\\.jar$")))) (for-each repack-archive (find-files directory "\\.jar$"))))
outputs)) outputs)
#t)
(define* (check #:key target (make-flags '()) (tests? (not target)) (define* (check #:key target (make-flags '()) (tests? (not target))
(test-target "check") (test-target "check")
#:allow-other-keys) #:allow-other-keys)
(if tests? (if tests?
(zero? (apply system* `("ant" ,test-target ,@make-flags))) (apply invoke `("ant" ,test-target ,@make-flags))
(begin (format #t "test suite not run~%"))
(format #t "test suite not run~%") #t)
#t)))
(define* (install #:key (make-flags '()) #:allow-other-keys) (define* (install #:key (make-flags '()) #:allow-other-keys)
(zero? (apply system* `("ant" "install" ,@make-flags)))) (apply invoke `("ant" "install" ,@make-flags)))
(define %standard-phases (define %standard-phases
(modify-phases gnu:%standard-phases (modify-phases gnu:%standard-phases