[bug#36477,25/31] gnu: libarchive: Fix cross-compilation.
diff mbox series

Message ID 20190708095913.3460-26-m.othacehe@gmail.com
State New
Headers show
Series
  • Fix cross-compilation issues
Related show

Commit Message

Mathieu Othacehe July 8, 2019, 9:59 a.m. UTC
* gnu/packages/backup.scm (libarchive)[arguments]: Do not build and run tests
when cross-compiling.
---
 gnu/packages/backup.scm | 31 ++++++++++++++++++++-----------
 1 file changed, 20 insertions(+), 11 deletions(-)

Comments

Marius Bakke July 8, 2019, 6:25 p.m. UTC | #1
Mathieu Othacehe <m.othacehe@gmail.com> writes:

> * gnu/packages/backup.scm (libarchive)[arguments]: Do not build and run tests
> when cross-compiling.

[...]

> @@ -226,17 +227,25 @@ backups (called chunks) to allow easy burning to CD/DVD.")
>                 (("/bin/pwd") (which "pwd")))
>               #t))
>           (replace 'check
> -           (lambda _
> -             ;; XXX: The test_owner_parse, test_read_disk, and
> -             ;; test_write_disk_lookup tests expect user 'root' to exist, but
> -             ;; the chroot's /etc/passwd doesn't have it.  Turn off those tests.
> -             ;;
> -             ;; The tests allow one to disable tests matching a globbing pattern.
> -             (invoke "make" "libarchive_test" "bsdcpio_test" "bsdtar_test")
> -             ;; XXX: This glob disables too much.
> -             (invoke "./libarchive_test" "^test_*_disk*")
> -             (invoke "./bsdcpio_test" "^test_owner_parse")
> -             (invoke "./bsdtar_test")))
> +           ,@(if (%current-target-system)
> +                 '((lambda _
> +                     #t))

When I think about it, gnu-build-system already sets #:tests? #f when
cross-compiling.  So this and similar changes can be rewritten to simply
check the tests? variable:

(replace 'check
  (lambda* (#:key (tests? #t) #:allow-other-keys)
    (if tests?
       ...
       (format #t "test suite not run~%"))))

(obviously, you should check that this works instead of taking my word
for it.  But it looks cleaner this way.  LGTM anyway.)

Patch
diff mbox series

diff --git a/gnu/packages/backup.scm b/gnu/packages/backup.scm
index 0bd894f958..783ca7a674 100644
--- a/gnu/packages/backup.scm
+++ b/gnu/packages/backup.scm
@@ -13,6 +13,7 @@ 
 ;;; Copyright © 2018 Oleg Pykhalov <go.wigust@gmail.com>
 ;;; Copyright © 2018, 2019 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2019 Alex Vong <alexvong1995@gmail.com>
+;;; Copyright © 2019 Mathieu Othacehe <m.othacehe@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -226,17 +227,25 @@  backups (called chunks) to allow easy burning to CD/DVD.")
                (("/bin/pwd") (which "pwd")))
              #t))
          (replace 'check
-           (lambda _
-             ;; XXX: The test_owner_parse, test_read_disk, and
-             ;; test_write_disk_lookup tests expect user 'root' to exist, but
-             ;; the chroot's /etc/passwd doesn't have it.  Turn off those tests.
-             ;;
-             ;; The tests allow one to disable tests matching a globbing pattern.
-             (invoke "make" "libarchive_test" "bsdcpio_test" "bsdtar_test")
-             ;; XXX: This glob disables too much.
-             (invoke "./libarchive_test" "^test_*_disk*")
-             (invoke "./bsdcpio_test" "^test_owner_parse")
-             (invoke "./bsdtar_test")))
+           ,@(if (%current-target-system)
+                 '((lambda _
+                     #t))
+                 '((lambda _
+                     ;; XXX: The test_owner_parse, test_read_disk, and
+                      ;; test_write_disk_lookup tests expect user 'root' to
+                      ;; exist, but the chroot's /etc/passwd doesn't have it.
+                      ;; Turn off those tests.
+                      ;;
+                      ;; The tests allow one to disable tests matching a
+                      ;; globbing pattern.
+                      (invoke "make"
+                              "libarchive_test"
+                              "bsdcpio_test"
+                              "bsdtar_test")
+                      ;; XXX: This glob disables too much.
+                      (invoke "./libarchive_test" "^test_*_disk*")
+                      (invoke "./bsdcpio_test" "^test_owner_parse")
+                      (invoke "./bsdtar_test")))))
          (add-after 'install 'add--L-in-libarchive-pc
            (lambda* (#:key inputs outputs #:allow-other-keys)
              (let* ((out     (assoc-ref outputs "out"))