diff options
| author | Ludovic Courtès <ludo@gnu.org> | 2014-10-05 16:32:25 +0200 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2014-10-05 21:58:42 +0200 |
| commit | d3d337d2d8f7152cb9ff3724f1cf240ce5ea5be2 (patch) | |
| tree | 4b1c5c20515e88fdecf1626673d1f9864942ab1f | |
| parent | b4469d8c12905f07a6825654bc3313beb0563cad (diff) | |
build-system: Bags record their system and target.
* guix/build-system.scm (<bag>)[system, target]: New fields.
(make-bag): Add #:system parameter and pass it to LOWER.
* gnu/packages/bootstrap.scm (make-raw-bag): Initialize 'system' field.
* guix/build-system/cmake.scm (lower): Likewise.
* guix/build-system/perl.scm (lower): Likewise.
* guix/build-system/python.scm (lower): Likewise.
* guix/build-system/ruby.scm (lower): Likewise.
* guix/build-system/trivial.scm (lower): Likewise.
* guix/build-system/gnu.scm (lower): Initialize 'system' and 'target'
fields.
* guix/packages.scm (bag->derivation, bag->cross-derivation): New
procedures.
(package-derivation, package-cross-derivation): Use 'bag->derivation'.
* tests/packages.scm ("search paths"): Initialize 'system' and 'target'
fields.
("package->bag", "package->bag, cross-compilation", "bag->derivation",
"bag->derivation, cross-compilation"): New tests.
| -rw-r--r-- | gnu/packages/bootstrap.scm | 4 | ||||
| -rw-r--r-- | guix/build-system.scm | 18 | ||||
| -rw-r--r-- | guix/build-system/cmake.scm | 3 | ||||
| -rw-r--r-- | guix/build-system/gnu.scm | 3 | ||||
| -rw-r--r-- | guix/build-system/perl.scm | 4 | ||||
| -rw-r--r-- | guix/build-system/python.scm | 3 | ||||
| -rw-r--r-- | guix/build-system/ruby.scm | 3 | ||||
| -rw-r--r-- | guix/build-system/trivial.scm | 3 | ||||
| -rw-r--r-- | guix/packages.scm | 129 | ||||
| -rw-r--r-- | tests/packages.scm | 36 |
10 files changed, 137 insertions, 69 deletions
diff --git a/gnu/packages/bootstrap.scm b/gnu/packages/bootstrap.scm index efa8cd89eb1..315e8cf21eb 100644 --- a/gnu/packages/bootstrap.scm +++ b/gnu/packages/bootstrap.scm | |||
| @@ -198,9 +198,11 @@ $out/bin/guile --version~%" | |||
| 198 | #:inputs `((,bash) (,builder))))) | 198 | #:inputs `((,bash) (,builder))))) |
| 199 | 199 | ||
| 200 | (define* (make-raw-bag name | 200 | (define* (make-raw-bag name |
| 201 | #:key source inputs native-inputs outputs target) | 201 | #:key source inputs native-inputs outputs |
| 202 | system target) | ||
| 202 | (bag | 203 | (bag |
| 203 | (name name) | 204 | (name name) |
| 205 | (system system) | ||
| 204 | (build-inputs inputs) | 206 | (build-inputs inputs) |
| 205 | (build raw-build))) | 207 | (build raw-build))) |
| 206 | 208 | ||
diff --git a/guix/build-system.scm b/guix/build-system.scm index f185d5704f4..4174972b984 100644 --- a/guix/build-system.scm +++ b/guix/build-system.scm | |||
| @@ -28,6 +28,8 @@ | |||
| 28 | bag | 28 | bag |
| 29 | bag? | 29 | bag? |
| 30 | bag-name | 30 | bag-name |
| 31 | bag-system | ||
| 32 | bag-target | ||
| 31 | bag-build-inputs | 33 | bag-build-inputs |
| 32 | bag-host-inputs | 34 | bag-host-inputs |
| 33 | bag-target-inputs | 35 | bag-target-inputs |
| @@ -43,12 +45,19 @@ | |||
| 43 | (description build-system-description) ; short description | 45 | (description build-system-description) ; short description |
| 44 | (lower build-system-lower)) ; args ... -> bags | 46 | (lower build-system-lower)) ; args ... -> bags |
| 45 | 47 | ||
| 46 | ;; "Bags" are low-level representations of "packages". Here we use | 48 | ;; "Bags" are low-level representations of "packages". The system and target |
| 47 | ;; build/host/target in the sense of the GNU tool chain (info "(autoconf) | 49 | ;; of a bag is fixed when it's created. This is because build systems may |
| 48 | ;; Specifying Target Triplets"). | 50 | ;; choose inputs as a function of the system and target. |
| 49 | (define-record-type* <bag> bag %make-bag | 51 | (define-record-type* <bag> bag %make-bag |
| 50 | bag? | 52 | bag? |
| 51 | (name bag-name) ;string | 53 | (name bag-name) ;string |
| 54 | |||
| 55 | (system bag-system) ;string | ||
| 56 | (target bag-target ;string | #f | ||
| 57 | (default #f)) | ||
| 58 | |||
| 59 | ;; Here we use build/host/target in the sense of the GNU tool chain (info | ||
| 60 | ;; "(autoconf) Specifying Target Triplets"). | ||
| 52 | (build-inputs bag-build-inputs ;list of packages | 61 | (build-inputs bag-build-inputs ;list of packages |
| 53 | (default '())) | 62 | (default '())) |
| 54 | (host-inputs bag-host-inputs ;list of packages | 63 | (host-inputs bag-host-inputs ;list of packages |
| @@ -72,7 +81,7 @@ | |||
| 72 | (define* (make-bag build-system name | 81 | (define* (make-bag build-system name |
| 73 | #:key source (inputs '()) (native-inputs '()) | 82 | #:key source (inputs '()) (native-inputs '()) |
| 74 | (outputs '()) (arguments '()) | 83 | (outputs '()) (arguments '()) |
| 75 | target) | 84 | system target) |
| 76 | "Ask BUILD-SYSTEM to return a 'bag' for NAME, with the given SOURCE, | 85 | "Ask BUILD-SYSTEM to return a 'bag' for NAME, with the given SOURCE, |
| 77 | INPUTS, NATIVE-INPUTS, OUTPUTS, and additional ARGUMENTS. If TARGET is not | 86 | INPUTS, NATIVE-INPUTS, OUTPUTS, and additional ARGUMENTS. If TARGET is not |
| 78 | #f, it must be a string with the GNU triplet of a cross-compilation target. | 87 | #f, it must be a string with the GNU triplet of a cross-compilation target. |
| @@ -82,6 +91,7 @@ intermediate representation just above derivations." | |||
| 82 | (match build-system | 91 | (match build-system |
| 83 | (($ <build-system> _ description lower) | 92 | (($ <build-system> _ description lower) |
| 84 | (apply lower name | 93 | (apply lower name |
| 94 | #:system system | ||
| 85 | #:source source | 95 | #:source source |
| 86 | #:inputs inputs | 96 | #:inputs inputs |
| 87 | #:native-inputs native-inputs | 97 | #:native-inputs native-inputs |
diff --git a/guix/build-system/cmake.scm b/guix/build-system/cmake.scm index 0e750c0e118..85acc2d0b3c 100644 --- a/guix/build-system/cmake.scm +++ b/guix/build-system/cmake.scm | |||
| @@ -43,7 +43,7 @@ | |||
| 43 | (module-ref module 'cmake))) | 43 | (module-ref module 'cmake))) |
| 44 | 44 | ||
| 45 | (define* (lower name | 45 | (define* (lower name |
| 46 | #:key source inputs native-inputs outputs target | 46 | #:key source inputs native-inputs outputs system target |
| 47 | (cmake (default-cmake)) | 47 | (cmake (default-cmake)) |
| 48 | #:allow-other-keys | 48 | #:allow-other-keys |
| 49 | #:rest arguments) | 49 | #:rest arguments) |
| @@ -54,6 +54,7 @@ | |||
| 54 | (and (not target) ;XXX: no cross-compilation | 54 | (and (not target) ;XXX: no cross-compilation |
| 55 | (bag | 55 | (bag |
| 56 | (name name) | 56 | (name name) |
| 57 | (system system) | ||
| 57 | (host-inputs `(,@(if source | 58 | (host-inputs `(,@(if source |
| 58 | `(("source" ,source)) | 59 | `(("source" ,source)) |
| 59 | '()) | 60 | '()) |
diff --git a/guix/build-system/gnu.scm b/guix/build-system/gnu.scm index c58dac10bbe..d2c29d44b57 100644 --- a/guix/build-system/gnu.scm +++ b/guix/build-system/gnu.scm | |||
| @@ -210,7 +210,7 @@ standard packages used as implicit inputs of the GNU build system." | |||
| 210 | (define* (lower name | 210 | (define* (lower name |
| 211 | #:key source inputs native-inputs outputs target | 211 | #:key source inputs native-inputs outputs target |
| 212 | (implicit-inputs? #t) (implicit-cross-inputs? #t) | 212 | (implicit-inputs? #t) (implicit-cross-inputs? #t) |
| 213 | (strip-binaries? #t) | 213 | (strip-binaries? #t) system |
| 214 | #:allow-other-keys | 214 | #:allow-other-keys |
| 215 | #:rest arguments) | 215 | #:rest arguments) |
| 216 | "Return a bag for NAME from the given arguments." | 216 | "Return a bag for NAME from the given arguments." |
| @@ -221,6 +221,7 @@ standard packages used as implicit inputs of the GNU build system." | |||
| 221 | 221 | ||
| 222 | (bag | 222 | (bag |
| 223 | (name name) | 223 | (name name) |
| 224 | (system system) (target target) | ||
| 224 | (build-inputs `(,@(if source | 225 | (build-inputs `(,@(if source |
| 225 | `(("source" ,source)) | 226 | `(("source" ,source)) |
| 226 | '()) | 227 | '()) |
diff --git a/guix/build-system/perl.scm b/guix/build-system/perl.scm index 6cf8cbe13ac..1a968f4150b 100644 --- a/guix/build-system/perl.scm +++ b/guix/build-system/perl.scm | |||
| @@ -43,7 +43,8 @@ | |||
| 43 | (module-ref module 'perl))) | 43 | (module-ref module 'perl))) |
| 44 | 44 | ||
| 45 | (define* (lower name | 45 | (define* (lower name |
| 46 | #:key source inputs native-inputs outputs target | 46 | #:key source inputs native-inputs outputs |
| 47 | system target | ||
| 47 | (perl (default-perl)) | 48 | (perl (default-perl)) |
| 48 | #:allow-other-keys | 49 | #:allow-other-keys |
| 49 | #:rest arguments) | 50 | #:rest arguments) |
| @@ -54,6 +55,7 @@ | |||
| 54 | (and (not target) ;XXX: no cross-compilation | 55 | (and (not target) ;XXX: no cross-compilation |
| 55 | (bag | 56 | (bag |
| 56 | (name name) | 57 | (name name) |
| 58 | (system system) | ||
| 57 | (host-inputs `(,@(if source | 59 | (host-inputs `(,@(if source |
| 58 | `(("source" ,source)) | 60 | `(("source" ,source)) |
| 59 | '()) | 61 | '()) |
diff --git a/guix/build-system/python.scm b/guix/build-system/python.scm index e28573bb05c..3cd537c752d 100644 --- a/guix/build-system/python.scm +++ b/guix/build-system/python.scm | |||
| @@ -93,7 +93,7 @@ prepended to the name." | |||
| 93 | (cut package-with-explicit-python <> (default-python2) "python-" "python2-")) | 93 | (cut package-with-explicit-python <> (default-python2) "python-" "python2-")) |
| 94 | 94 | ||
| 95 | (define* (lower name | 95 | (define* (lower name |
| 96 | #:key source inputs native-inputs outputs target | 96 | #:key source inputs native-inputs outputs system target |
| 97 | (python (default-python)) | 97 | (python (default-python)) |
| 98 | #:allow-other-keys | 98 | #:allow-other-keys |
| 99 | #:rest arguments) | 99 | #:rest arguments) |
| @@ -104,6 +104,7 @@ prepended to the name." | |||
| 104 | (and (not target) ;XXX: no cross-compilation | 104 | (and (not target) ;XXX: no cross-compilation |
| 105 | (bag | 105 | (bag |
| 106 | (name name) | 106 | (name name) |
| 107 | (system system) | ||
| 107 | (host-inputs `(,@(if source | 108 | (host-inputs `(,@(if source |
| 108 | `(("source" ,source)) | 109 | `(("source" ,source)) |
| 109 | '()) | 110 | '()) |
diff --git a/guix/build-system/ruby.scm b/guix/build-system/ruby.scm index 8312629fd8d..e4e115f657e 100644 --- a/guix/build-system/ruby.scm +++ b/guix/build-system/ruby.scm | |||
| @@ -35,7 +35,7 @@ | |||
| 35 | (module-ref ruby 'ruby))) | 35 | (module-ref ruby 'ruby))) |
| 36 | 36 | ||
| 37 | (define* (lower name | 37 | (define* (lower name |
| 38 | #:key source inputs native-inputs outputs target | 38 | #:key source inputs native-inputs outputs system target |
| 39 | (ruby (default-ruby)) | 39 | (ruby (default-ruby)) |
| 40 | #:allow-other-keys | 40 | #:allow-other-keys |
| 41 | #:rest arguments) | 41 | #:rest arguments) |
| @@ -46,6 +46,7 @@ | |||
| 46 | (and (not target) ;XXX: no cross-compilation | 46 | (and (not target) ;XXX: no cross-compilation |
| 47 | (bag | 47 | (bag |
| 48 | (name name) | 48 | (name name) |
| 49 | (system system) | ||
| 49 | (host-inputs `(,@(if source | 50 | (host-inputs `(,@(if source |
| 50 | `(("source" ,source)) | 51 | `(("source" ,source)) |
| 51 | '()) | 52 | '()) |
diff --git a/guix/build-system/trivial.scm b/guix/build-system/trivial.scm index 1b07f14e63c..839042aa2a5 100644 --- a/guix/build-system/trivial.scm +++ b/guix/build-system/trivial.scm | |||
| @@ -35,11 +35,12 @@ | |||
| 35 | (package-derivation store guile system))))) | 35 | (package-derivation store guile system))))) |
| 36 | 36 | ||
| 37 | (define* (lower name | 37 | (define* (lower name |
| 38 | #:key source inputs native-inputs outputs target | 38 | #:key source inputs native-inputs outputs system target |
| 39 | guile builder modules) | 39 | guile builder modules) |
| 40 | "Return a bag for NAME." | 40 | "Return a bag for NAME." |
| 41 | (bag | 41 | (bag |
| 42 | (name name) | 42 | (name name) |
| 43 | (system system) | ||
| 43 | (host-inputs `(,@(if source | 44 | (host-inputs `(,@(if source |
| 44 | `(("source" ,source)) | 45 | `(("source" ,source)) |
| 45 | '()) | 46 | '()) |
diff --git a/guix/packages.scm b/guix/packages.scm index 47cd6b95bbd..a5b886a403a 100644 --- a/guix/packages.scm +++ b/guix/packages.scm | |||
| @@ -95,6 +95,7 @@ | |||
| 95 | package-cross-build-system-error? | 95 | package-cross-build-system-error? |
| 96 | 96 | ||
| 97 | package->bag | 97 | package->bag |
| 98 | bag->derivation | ||
| 98 | bag-transitive-inputs | 99 | bag-transitive-inputs |
| 99 | bag-transitive-host-inputs | 100 | bag-transitive-host-inputs |
| 100 | bag-transitive-build-inputs | 101 | bag-transitive-build-inputs |
| @@ -629,6 +630,7 @@ and return it." | |||
| 629 | args inputs propagated-inputs native-inputs self-native-input? | 630 | args inputs propagated-inputs native-inputs self-native-input? |
| 630 | outputs) | 631 | outputs) |
| 631 | (or (make-bag build-system (package-full-name package) | 632 | (or (make-bag build-system (package-full-name package) |
| 633 | #:system system | ||
| 632 | #:target target | 634 | #:target target |
| 633 | #:source source | 635 | #:source source |
| 634 | #:inputs (append (inputs) | 636 | #:inputs (append (inputs) |
| @@ -647,6 +649,72 @@ and return it." | |||
| 647 | (&package-error | 649 | (&package-error |
| 648 | (package package)))))))))) | 650 | (package package)))))))))) |
| 649 | 651 | ||
| 652 | (define* (bag->derivation store bag | ||
| 653 | #:optional context) | ||
| 654 | "Return the derivation to build BAG for SYSTEM. Optionally, CONTEXT can be | ||
| 655 | a package object describing the context in which the call occurs, for improved | ||
| 656 | error reporting." | ||
| 657 | (if (bag-target bag) | ||
| 658 | (bag->cross-derivation store bag) | ||
| 659 | (let* ((system (bag-system bag)) | ||
| 660 | (inputs (bag-transitive-inputs bag)) | ||
| 661 | (input-drvs (map (cut expand-input store context <> system) | ||
| 662 | inputs)) | ||
| 663 | (paths (delete-duplicates | ||
| 664 | (append-map (match-lambda | ||
| 665 | ((_ (? package? p) _ ...) | ||
| 666 | (package-native-search-paths | ||
| 667 | p)) | ||
| 668 | (_ '())) | ||
| 669 | inputs)))) | ||
| 670 | |||
| 671 | (apply (bag-build bag) | ||
| 672 | store (bag-name bag) input-drvs | ||
| 673 | #:search-paths paths | ||
| 674 | #:outputs (bag-outputs bag) #:system system | ||
| 675 | (bag-arguments bag))))) | ||
| 676 | |||
| 677 | (define* (bag->cross-derivation store bag | ||
| 678 | #:optional context) | ||
| 679 | "Return the derivation to build BAG, which is actually a cross build. | ||
| 680 | Optionally, CONTEXT can be a package object denoting the context of the call. | ||
| 681 | This is an internal procedure." | ||
| 682 | (let* ((system (bag-system bag)) | ||
| 683 | (target (bag-target bag)) | ||
| 684 | (host (bag-transitive-host-inputs bag)) | ||
| 685 | (host-drvs (map (cut expand-input store context <> system target) | ||
| 686 | host)) | ||
| 687 | (target* (bag-transitive-target-inputs bag)) | ||
| 688 | (target-drvs (map (cut expand-input store context <> system) | ||
| 689 | target*)) | ||
| 690 | (build (bag-transitive-build-inputs bag)) | ||
| 691 | (build-drvs (map (cut expand-input store context <> system) | ||
| 692 | build)) | ||
| 693 | (all (append build target* host)) | ||
| 694 | (paths (delete-duplicates | ||
| 695 | (append-map (match-lambda | ||
| 696 | ((_ (? package? p) _ ...) | ||
| 697 | (package-search-paths p)) | ||
| 698 | (_ '())) | ||
| 699 | all))) | ||
| 700 | (npaths (delete-duplicates | ||
| 701 | (append-map (match-lambda | ||
| 702 | ((_ (? package? p) _ ...) | ||
| 703 | (package-native-search-paths | ||
| 704 | p)) | ||
| 705 | (_ '())) | ||
| 706 | all)))) | ||
| 707 | |||
| 708 | (apply (bag-build bag) | ||
| 709 | store (bag-name bag) | ||
| 710 | #:native-drvs build-drvs | ||
| 711 | #:target-drvs (append host-drvs target-drvs) | ||
| 712 | #:search-paths paths | ||
| 713 | #:native-search-paths npaths | ||
| 714 | #:outputs (bag-outputs bag) | ||
| 715 | #:system system #:target target | ||
| 716 | (bag-arguments bag)))) | ||
| 717 | |||
| 650 | (define* (package-derivation store package | 718 | (define* (package-derivation store package |
| 651 | #:optional (system (%current-system))) | 719 | #:optional (system (%current-system))) |
| 652 | "Return the <derivation> object of PACKAGE for SYSTEM." | 720 | "Return the <derivation> object of PACKAGE for SYSTEM." |
| @@ -655,69 +723,16 @@ and return it." | |||
| 655 | ;; because some derivations, such as the implicit inputs of the GNU build | 723 | ;; because some derivations, such as the implicit inputs of the GNU build |
| 656 | ;; system, will be queried many, many times in a row. | 724 | ;; system, will be queried many, many times in a row. |
| 657 | (cached package system | 725 | (cached package system |
| 658 | (let* ((bag (package->bag package system #f)) | 726 | (bag->derivation store (package->bag package system #f) |
| 659 | (inputs (bag-transitive-inputs bag)) | 727 | package))) |
| 660 | (input-drvs (map (cut expand-input | ||
| 661 | store package <> system) | ||
| 662 | inputs)) | ||
| 663 | (paths (delete-duplicates | ||
| 664 | (append-map (match-lambda | ||
| 665 | ((_ (? package? p) _ ...) | ||
| 666 | (package-native-search-paths | ||
| 667 | p)) | ||
| 668 | (_ '())) | ||
| 669 | inputs)))) | ||
| 670 | |||
| 671 | (apply (bag-build bag) | ||
| 672 | store (bag-name bag) | ||
| 673 | input-drvs | ||
| 674 | #:search-paths paths | ||
| 675 | #:outputs (bag-outputs bag) #:system system | ||
| 676 | (bag-arguments bag))))) | ||
| 677 | 728 | ||
| 678 | (define* (package-cross-derivation store package target | 729 | (define* (package-cross-derivation store package target |
| 679 | #:optional (system (%current-system))) | 730 | #:optional (system (%current-system))) |
| 680 | "Cross-build PACKAGE for TARGET (a GNU triplet) from host SYSTEM (a Guix | 731 | "Cross-build PACKAGE for TARGET (a GNU triplet) from host SYSTEM (a Guix |
| 681 | system identifying string)." | 732 | system identifying string)." |
| 682 | (cached package (cons system target) | 733 | (cached package (cons system target) |
| 683 | (let* ((bag (package->bag package system target)) | 734 | (bag->derivation store (package->bag package system target) |
| 684 | (host (bag-transitive-host-inputs bag)) | 735 | package))) |
| 685 | (host-drvs (map (cut expand-input | ||
| 686 | store package <> | ||
| 687 | system target) | ||
| 688 | host)) | ||
| 689 | (target* (bag-transitive-target-inputs bag)) | ||
| 690 | (target-drvs (map (cut expand-input | ||
| 691 | store package <> system) | ||
| 692 | target*)) | ||
| 693 | (build (bag-transitive-build-inputs bag)) | ||
| 694 | (build-drvs (map (cut expand-input | ||
| 695 | store package <> system) | ||
| 696 | build)) | ||
| 697 | (all (append build target* host)) | ||
| 698 | (paths (delete-duplicates | ||
| 699 | (append-map (match-lambda | ||
| 700 | ((_ (? package? p) _ ...) | ||
| 701 | (package-search-paths p)) | ||
| 702 | (_ '())) | ||
| 703 | all))) | ||
| 704 | (npaths (delete-duplicates | ||
| 705 | (append-map (match-lambda | ||
| 706 | ((_ (? package? p) _ ...) | ||
| 707 | (package-native-search-paths | ||
| 708 | p)) | ||
| 709 | (_ '())) | ||
| 710 | all)))) | ||
| 711 | |||
| 712 | (apply (bag-build bag) | ||
| 713 | store (bag-name bag) | ||
| 714 | #:native-drvs build-drvs | ||
| 715 | #:target-drvs (append host-drvs target-drvs) | ||
| 716 | #:search-paths paths | ||
| 717 | #:native-search-paths npaths | ||
| 718 | #:outputs (bag-outputs bag) | ||
| 719 | #:system system #:target target | ||
| 720 | (bag-arguments bag))))) | ||
| 721 | 736 | ||
| 722 | (define* (package-output store package | 737 | (define* (package-output store package |
| 723 | #:optional (output "out") (system (%current-system))) | 738 | #:optional (output "out") (system (%current-system))) |
diff --git a/tests/packages.scm b/tests/packages.scm index 6deb21c3312..2a87f3f15d1 100644 --- a/tests/packages.scm +++ b/tests/packages.scm | |||
| @@ -281,9 +281,11 @@ | |||
| 281 | (s (build-system | 281 | (s (build-system |
| 282 | (name 'raw) | 282 | (name 'raw) |
| 283 | (description "Raw build system with direct store access") | 283 | (description "Raw build system with direct store access") |
| 284 | (lower (lambda* (name #:key source inputs #:allow-other-keys) | 284 | (lower (lambda* (name #:key source inputs system target |
| 285 | #:allow-other-keys) | ||
| 285 | (bag | 286 | (bag |
| 286 | (name name) | 287 | (name name) |
| 288 | (system system) (target target) | ||
| 287 | (build-inputs inputs) | 289 | (build-inputs inputs) |
| 288 | (build | 290 | (build |
| 289 | (lambda* (store name inputs | 291 | (lambda* (store name inputs |
| @@ -339,6 +341,38 @@ | |||
| 339 | (package-cross-derivation %store p "mips64el-linux-gnu") | 341 | (package-cross-derivation %store p "mips64el-linux-gnu") |
| 340 | #f))) | 342 | #f))) |
| 341 | 343 | ||
| 344 | (test-equal "package->bag" | ||
| 345 | `("foo86-hurd" #f (,(package-source gnu-make)) | ||
| 346 | (,(canonical-package glibc)) (,(canonical-package coreutils))) | ||
| 347 | (let ((bag (package->bag gnu-make "foo86-hurd"))) | ||
| 348 | (list (bag-system bag) (bag-target bag) | ||
| 349 | (assoc-ref (bag-build-inputs bag) "source") | ||
| 350 | (assoc-ref (bag-build-inputs bag) "libc") | ||
| 351 | (assoc-ref (bag-build-inputs bag) "coreutils")))) | ||
| 352 | |||
| 353 | (test-equal "package->bag, cross-compilation" | ||
| 354 | `(,(%current-system) "foo86-hurd" | ||
| 355 | (,(package-source gnu-make)) | ||
| 356 | (,(canonical-package glibc)) (,(canonical-package coreutils))) | ||
| 357 | (let ((bag (package->bag gnu-make (%current-system) "foo86-hurd"))) | ||
| 358 | (list (bag-system bag) (bag-target bag) | ||
| 359 | (assoc-ref (bag-build-inputs bag) "source") | ||
| 360 | (assoc-ref (bag-build-inputs bag) "libc") | ||
| 361 | (assoc-ref (bag-build-inputs bag) "coreutils")))) | ||
| 362 | |||
| 363 | (test-assert "bag->derivation" | ||
| 364 | (let ((bag (package->bag gnu-make)) | ||
| 365 | (drv (package-derivation %store gnu-make))) | ||
| 366 | (parameterize ((%current-system "foox86-hurd")) ;should have no effect | ||
| 367 | (equal? drv (bag->derivation %store bag))))) | ||
| 368 | |||
| 369 | (test-assert "bag->derivation, cross-compilation" | ||
| 370 | (let ((bag (package->bag gnu-make (%current-system) "mips64el-linux-gnu")) | ||
| 371 | (drv (package-cross-derivation %store gnu-make "mips64el-linux-gnu"))) | ||
| 372 | (parameterize ((%current-system "foox86-hurd") ;should have no effect | ||
| 373 | (%current-target-system "foo64-linux-gnu")) | ||
| 374 | (equal? drv (bag->derivation %store bag))))) | ||
| 375 | |||
| 342 | (unless (false-if-exception (getaddrinfo "www.gnu.org" "80" AI_NUMERICSERV)) | 376 | (unless (false-if-exception (getaddrinfo "www.gnu.org" "80" AI_NUMERICSERV)) |
| 343 | (test-skip 1)) | 377 | (test-skip 1)) |
| 344 | (test-assert "GNU Make, bootstrap" | 378 | (test-assert "GNU Make, bootstrap" |
