diff options
| author | Ludovic Courtès <ludo@gnu.org> | 2014-10-27 18:09:00 +0100 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2014-11-02 21:22:12 +0100 |
| commit | 05962f2958eb98bad384702455236ff9d2acfb39 (patch) | |
| tree | 519d31fb05176a3ec0e9918fc746ede76a071c7f /tests | |
| parent | 50373bab7a084dc28a48df2ca7e16036d8978182 (diff) | |
packages: Implement grafts.
Thanks to Mark H. Weaver <mhw@netris.org> for insightful discussions
and suggestions.
* guix/packages.scm (<package>)[graft]: New field.
(patch-and-repack): Invoke 'package-derivation' with #:graft? #f.
(package-source-derivation): Likewise. Do not use (%guile-for-build)
in call to 'patch-and-repack', and we could end up using a grafted
Guile.
(expand-input): Likewise, also for 'package-cross-derivation' call.
(package->bag): Add #:graft? parameter. Honor it. Use 'strip-append'
instead of 'package-full-name'.
(input-graft, input-cross-graft, bag-grafts, package-grafts): New
procedures.
(package-derivation, package-cross-derivation): Add #:graft? parameter
and honor it.
* gnu/packages/bootstrap.scm (package-with-bootstrap-guile): Add
recursive call on 'graft'.
* guix/build-system/gnu.scm (package-with-explicit-inputs,
package-with-extra-configure-variable, static-package): Likewise.
(gnu-build): Use the ungrafted Guile to avoid full rebuilds.
(gnu-cross-build): Likewise.
* guix/build-system/cmake.scm (cmake-build): Likewise.
* guix/build-system/glib-or-gtk.scm (glib-or-gtk-build): Likewise.
* guix/build-system/perl.scm (perl-build): Likewise.
* guix/build-system/python.scm (python-build): Likewise.
* guix/build-system/ruby.scm (ruby-build): Likewise.
* guix/build-system/trivial.scm (guile-for-build): Likewise.
* tests/packages.scm ("package-derivation, direct graft",
"package-cross-derivation, direct graft", "package-grafts,
indirect grafts", "package-grafts, indirect grafts, cross",
"package-grafts, indirect grafts, propagated inputs",
"package-derivation, indirect grafts"): New tests.
("bag->derivation", "bag->derivation, cross-compilation"): Wrap in
'parameterize'.
* doc/guix.texi (Security Updates): New node.
(Invoking guix build): Document --no-graft.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/packages.scm | 105 |
1 files changed, 91 insertions, 14 deletions
diff --git a/tests/packages.scm b/tests/packages.scm index 44cdb35c4b9..4f700b712ff 100644 --- a/tests/packages.scm +++ b/tests/packages.scm | |||
| @@ -33,8 +33,9 @@ | |||
| 33 | #:use-module (guix build-system gnu) | 33 | #:use-module (guix build-system gnu) |
| 34 | #:use-module (gnu packages) | 34 | #:use-module (gnu packages) |
| 35 | #:use-module (gnu packages base) | 35 | #:use-module (gnu packages base) |
| 36 | #:use-module (gnu packages guile) | ||
| 36 | #:use-module (gnu packages bootstrap) | 37 | #:use-module (gnu packages bootstrap) |
| 37 | #:use-module (srfi srfi-11) | 38 | #:use-module (srfi srfi-1) |
| 38 | #:use-module (srfi srfi-26) | 39 | #:use-module (srfi srfi-26) |
| 39 | #:use-module (srfi srfi-34) | 40 | #:use-module (srfi srfi-34) |
| 40 | #:use-module (srfi srfi-64) | 41 | #:use-module (srfi srfi-64) |
| @@ -47,10 +48,6 @@ | |||
| 47 | (define %store | 48 | (define %store |
| 48 | (open-connection-for-tests)) | 49 | (open-connection-for-tests)) |
| 49 | 50 | ||
| 50 | |||
| 51 | |||
| 52 | (test-begin "packages") | ||
| 53 | |||
| 54 | (define-syntax-rule (dummy-package name* extra-fields ...) | 51 | (define-syntax-rule (dummy-package name* extra-fields ...) |
| 55 | (package (name name*) (version "0") (source #f) | 52 | (package (name name*) (version "0") (source #f) |
| 56 | (build-system gnu-build-system) | 53 | (build-system gnu-build-system) |
| @@ -58,6 +55,9 @@ | |||
| 58 | (home-page #f) (license #f) | 55 | (home-page #f) (license #f) |
| 59 | extra-fields ...)) | 56 | extra-fields ...)) |
| 60 | 57 | ||
| 58 | |||
| 59 | (test-begin "packages") | ||
| 60 | |||
| 61 | (test-assert "printer with location" | 61 | (test-assert "printer with location" |
| 62 | (string-match "^#<package foo-0 foo.scm:42 [[:xdigit:]]+>$" | 62 | (string-match "^#<package foo-0 foo.scm:42 [[:xdigit:]]+>$" |
| 63 | (with-output-to-string | 63 | (with-output-to-string |
| @@ -375,6 +375,80 @@ | |||
| 375 | (package-cross-derivation %store p "mips64el-linux-gnu") | 375 | (package-cross-derivation %store p "mips64el-linux-gnu") |
| 376 | #f))) | 376 | #f))) |
| 377 | 377 | ||
| 378 | (test-equal "package-derivation, direct graft" | ||
| 379 | (package-derivation %store gnu-make) | ||
| 380 | (let ((p (package (inherit coreutils) | ||
| 381 | (replacement gnu-make)))) | ||
| 382 | (package-derivation %store p))) | ||
| 383 | |||
| 384 | (test-equal "package-cross-derivation, direct graft" | ||
| 385 | (package-cross-derivation %store gnu-make "mips64el-linux-gnu") | ||
| 386 | (let ((p (package (inherit coreutils) | ||
| 387 | (replacement gnu-make)))) | ||
| 388 | (package-cross-derivation %store p "mips64el-linux-gnu"))) | ||
| 389 | |||
| 390 | (test-assert "package-grafts, indirect grafts" | ||
| 391 | (let* ((new (dummy-package "dep" | ||
| 392 | (arguments '(#:implicit-inputs? #f)))) | ||
| 393 | (dep (package (inherit new) (version "0.0"))) | ||
| 394 | (dep* (package (inherit dep) (replacement new))) | ||
| 395 | (dummy (dummy-package "dummy" | ||
| 396 | (arguments '(#:implicit-inputs? #f)) | ||
| 397 | (inputs `(("dep" ,dep*)))))) | ||
| 398 | (equal? (package-grafts %store dummy) | ||
| 399 | (list (graft | ||
| 400 | (origin (package-derivation %store dep)) | ||
| 401 | (replacement (package-derivation %store new))))))) | ||
| 402 | |||
| 403 | (test-assert "package-grafts, indirect grafts, cross" | ||
| 404 | (let* ((new (dummy-package "dep" | ||
| 405 | (arguments '(#:implicit-inputs? #f)))) | ||
| 406 | (dep (package (inherit new) (version "0.0"))) | ||
| 407 | (dep* (package (inherit dep) (replacement new))) | ||
| 408 | (dummy (dummy-package "dummy" | ||
| 409 | (arguments '(#:implicit-inputs? #f)) | ||
| 410 | (inputs `(("dep" ,dep*))))) | ||
| 411 | (target "mips64el-linux-gnu")) | ||
| 412 | (equal? (package-grafts %store dummy #:target target) | ||
| 413 | (list (graft | ||
| 414 | (origin (package-cross-derivation %store dep target)) | ||
| 415 | (replacement | ||
| 416 | (package-cross-derivation %store new target))))))) | ||
| 417 | |||
| 418 | (test-assert "package-grafts, indirect grafts, propagated inputs" | ||
| 419 | (let* ((new (dummy-package "dep" | ||
| 420 | (arguments '(#:implicit-inputs? #f)))) | ||
| 421 | (dep (package (inherit new) (version "0.0"))) | ||
| 422 | (dep* (package (inherit dep) (replacement new))) | ||
| 423 | (prop (dummy-package "propagated" | ||
| 424 | (propagated-inputs `(("dep" ,dep*))) | ||
| 425 | (arguments '(#:implicit-inputs? #f)))) | ||
| 426 | (dummy (dummy-package "dummy" | ||
| 427 | (arguments '(#:implicit-inputs? #f)) | ||
| 428 | (inputs `(("prop" ,prop)))))) | ||
| 429 | (equal? (package-grafts %store dummy) | ||
| 430 | (list (graft | ||
| 431 | (origin (package-derivation %store dep)) | ||
| 432 | (replacement (package-derivation %store new))))))) | ||
| 433 | |||
| 434 | (test-assert "package-derivation, indirect grafts" | ||
| 435 | (let* ((new (dummy-package "dep" | ||
| 436 | (arguments '(#:implicit-inputs? #f)))) | ||
| 437 | (dep (package (inherit new) (version "0.0"))) | ||
| 438 | (dep* (package (inherit dep) (replacement new))) | ||
| 439 | (dummy (dummy-package "dummy" | ||
| 440 | (arguments '(#:implicit-inputs? #f)) | ||
| 441 | (inputs `(("dep" ,dep*))))) | ||
| 442 | (guile (package-derivation %store (canonical-package guile-2.0) | ||
| 443 | #:graft? #f))) | ||
| 444 | (equal? (package-derivation %store dummy) | ||
| 445 | (graft-derivation %store "dummy-0" | ||
| 446 | (package-derivation %store dummy #:graft? #f) | ||
| 447 | (package-grafts %store dummy) | ||
| 448 | |||
| 449 | ;; Use the same Guile as 'package-derivation'. | ||
| 450 | #:guile guile)))) | ||
| 451 | |||
| 378 | (test-equal "package->bag" | 452 | (test-equal "package->bag" |
| 379 | `("foo86-hurd" #f (,(package-source gnu-make)) | 453 | `("foo86-hurd" #f (,(package-source gnu-make)) |
| 380 | (,(canonical-package glibc)) (,(canonical-package coreutils))) | 454 | (,(canonical-package glibc)) (,(canonical-package coreutils))) |
| @@ -406,17 +480,20 @@ | |||
| 406 | (eq? package dep))))) | 480 | (eq? package dep))))) |
| 407 | 481 | ||
| 408 | (test-assert "bag->derivation" | 482 | (test-assert "bag->derivation" |
| 409 | (let ((bag (package->bag gnu-make)) | 483 | (parameterize ((%graft? #f)) |
| 410 | (drv (package-derivation %store gnu-make))) | 484 | (let ((bag (package->bag gnu-make)) |
| 411 | (parameterize ((%current-system "foox86-hurd")) ;should have no effect | 485 | (drv (package-derivation %store gnu-make))) |
| 412 | (equal? drv (bag->derivation %store bag))))) | 486 | (parameterize ((%current-system "foox86-hurd")) ;should have no effect |
| 487 | (equal? drv (bag->derivation %store bag)))))) | ||
| 413 | 488 | ||
| 414 | (test-assert "bag->derivation, cross-compilation" | 489 | (test-assert "bag->derivation, cross-compilation" |
| 415 | (let ((bag (package->bag gnu-make (%current-system) "mips64el-linux-gnu")) | 490 | (parameterize ((%graft? #f)) |
| 416 | (drv (package-cross-derivation %store gnu-make "mips64el-linux-gnu"))) | 491 | (let* ((target "mips64el-linux-gnu") |
| 417 | (parameterize ((%current-system "foox86-hurd") ;should have no effect | 492 | (bag (package->bag gnu-make (%current-system) target)) |
| 418 | (%current-target-system "foo64-linux-gnu")) | 493 | (drv (package-cross-derivation %store gnu-make target))) |
| 419 | (equal? drv (bag->derivation %store bag))))) | 494 | (parameterize ((%current-system "foox86-hurd") ;should have no effect |
| 495 | (%current-target-system "foo64-linux-gnu")) | ||
| 496 | (equal? drv (bag->derivation %store bag)))))) | ||
| 420 | 497 | ||
| 421 | (unless (false-if-exception (getaddrinfo "www.gnu.org" "80" AI_NUMERICSERV)) | 498 | (unless (false-if-exception (getaddrinfo "www.gnu.org" "80" AI_NUMERICSERV)) |
| 422 | (test-skip 1)) | 499 | (test-skip 1)) |
