aboutsummaryrefslogtreecommitdiff
path: root/tests/builders.scm
blob: bb9e0fa85b4af4fbf838c96e6da8f5f01b2b9742 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2012, 2013, 2014, 2015 Ludovic Courtès <ludo@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.


(define-module (test-builders)
  #:use-module (guix download)
  #:use-module (guix build-system)
  #:use-module (guix build-system gnu)
  #:use-module (guix store)
  #:use-module (guix utils)
  #:use-module (guix base32)
  #:use-module (guix derivations)
  #:use-module (guix hash)
  #:use-module (guix tests)
  #:use-module ((guix packages)
                #:select (package-derivation package-native-search-paths))
  #:use-module (gnu packages bootstrap)
  #:use-module (ice-9 match)
  #:use-module (srfi srfi-1)
  #:use-module (srfi srfi-64))

;; Test the higher-level builders.

(define %store
  (open-connection-for-tests))

(define %bootstrap-inputs
  ;; Use the bootstrap inputs so it doesn't take ages to run these tests.
  ;; This still involves building Make, Diffutils, and Findutils.
  ;; XXX: We're relying on the higher-level `package-derivations' here.
  (and %store
       (map (match-lambda
             ((name package)
              (list name (package-derivation %store package))))
            (@@ (gnu packages commencement) %boot0-inputs))))

(define %bootstrap-search-paths
  ;; Search path specifications that go with %BOOTSTRAP-INPUTS.
  (append-map (match-lambda
               ((name package _ ...)
                (package-native-search-paths package)))
              (@@ (gnu packages commencement) %boot0-inputs)))

(define url-fetch*
  (store-lower url-fetch))


(test-begin "builders")

(unless (network-reachable?) (test-skip 1))
(test-assert "url-fetch"
  (let* ((url      '("http://ftp.gnu.org/gnu/hello/hello-2.8.tar.gz"
                     "ftp://ftp.gnu.org/gnu/hello/hello-2.8.tar.gz"))
         (hash     (nix-base32-string->bytevector
                    "0wqd8sjmxfskrflaxywc7gqw7sfawrfvdxd9skxawzfgyy0pzdz6"))
         (drv      (url-fetch* %store url 'sha256 hash
                               #:guile %bootstrap-guile))
         (out-path (derivation->output-path drv)))
    (and (build-derivations %store (list drv))
         (file-exists? out-path)
         (valid-path? %store out-path))))

(test-assert "url-fetch, file"
  (let* ((file (search-path %load-path "guix.scm"))
         (hash (call-with-input-file file port-sha256))
         (out  (url-fetch* %store file 'sha256 hash)))
    (and (file-exists? out)
         (valid-path? %store out))))

(test-assert "url-fetch, file URI"
  (let* ((file (search-path %load-path "guix.scm"))
         (hash (call-with-input-file file port-sha256))
         (out  (url-fetch* %store
                           (string-append "file://" (canonicalize-path file))
                           'sha256 hash)))
    (and (file-exists? out)
         (valid-path? %store out))))

(test-assert "gnu-build-system"
  (build-system? gnu-build-system))

(when (or (not (network-reachable?)) (shebang-too-long?))
  (test-skip 1))
(test-assert "gnu-build"
  (let* ((url      "http://ftp.gnu.org/gnu/hello/hello-2.8.tar.gz")
         (hash     (nix-base32-string->bytevector
                    "0wqd8sjmxfskrflaxywc7gqw7sfawrfvdxd9skxawzfgyy0pzdz6"))
         (tarball  (url-fetch* %store url 'sha256 hash
                               #:guile %bootstrap-guile))
         (build    (gnu-build %store "hello-2.8"
                              `(("source" ,tarball)
                                ,@%bootstrap-inputs)
                              #:guile %bootstrap-guile
                              #:search-paths %bootstrap-search-paths))
         (out      (derivation->output-path build)))
    (and (build-derivations %store (list (pk 'hello-drv build)))
         (valid-path? %store out)
         (file-exists? (string-append out "/bin/hello")))))

(test-end "builders")
ases when it previously returned 'chez-scheme': 1. When 'chez-scheme' is not distributed with bootstrap bootfiles, since we can only cross-compile 'chez-scheme' for those systems; and 2. When neither 'chez-scheme' nor 'chez-scheme-for-racket' supports native code generation, since we will be able to use the ``portable bytecode'' backends of 'chez-scheme-for-racket' as soon as the issues in <https://racket.discourse.group/t/950> are resolved. * gnu/packages/chez.scm (chez-scheme-for-racket): Change condition. Signed-off-by: Ludovic Courtès <ludo@gnu.org> Philip McGrath 2022-05-12gnu: chez-scheme-for-racket: Fix supported systems....This commit fixes the treatment of systems like "powerpc-w64-mingw32", where the combination of architecture and kernel is not supported, even though both are supported in other combinations. The build failure fixed in b8fc9169515ef1a6d6037c84e30ad308e5418b6f highlighted this problem: see also <https://issues.guix.gnu.org/54292#6>. The correct support status is specified by '%chez-features-table', which was added to improve 'chez-upstream-features-for-system': this commit uses it to fix the repair. Once the issues in <https://racket.discourse.group/t/950> are resolved, 'chez-scheme-for-racket' and 'racket-vm-cs' will be able to run even on systems for which native code generation is not supported. It's not clear what behavior would be useful from 'nix-system->chez-machine': since the current implementation is flawed and easy to misuse, we remove it for now, replacing the remaining uses with 'racket-cs-native-supported-system?'. * gnu/packages/chez.scm (nix-system->chez-machine): Remove it. (racket-cs-native-supported-system?): New variable. (chez-scheme-for-racket)[supported-systems]: Use it. * gnu/packages/racket.scm (racket-vm-for-system): Likewise. Signed-off-by: Ludovic Courtès <ludo@gnu.org> Philip McGrath 2022-05-12gnu: chez-upstream-features-for-system: Improve implementation....This commit is a follow-up to b8fc9169515ef1a6d6037c84e30ad308e5418b6f. While that commit fixed a breaking build, this one begins to address the faulty assumptions that lead to the failure: see also <https://issues.guix.gnu.org/54292#6>. In this commit, we reimplement 'chez-upstream-features-for-system' using the new '%chez-features-table', which explicitly specifies platform support for both 'chez-scheme' and 'chez-scheme-for-racket', rather than assuming a non-false result from 'nix-system->chez-machine' means that the system is supported. The remaining uses of 'nix-system->chez-machine' still make that incorrect assumption and must be repaired in a future commit. * gnu/packages/chez.scm (%nix-arch-to-chez-alist, %nix-os-to-chez-alist): Replace with ... (target-chez-arch, target-chez-os): ... these new variables. (nix-system->chez-machine): Rewrite using them. (%chez-features-table): New variable. (chez-upstream-features-for-system): Rewrite using it. (chez-scheme)[supported-systems]: Update armhf-linux comment. (chez-scheme-bootstrap-bootfiles)[supported-systems]: Use 'chez-upstream-features-for-system'. (chez-machine->nonthreaded, chez-machine->threaded, chez-machine->nix-system): Remove unused functions. Signed-off-by: Ludovic Courtès <ludo@gnu.org> Philip McGrath 2022-05-12gnu: stex: Get machine type dynamically....* gnu/packages/chez.scm (stex)[arguments]: Run 'scheme' to determine the machine type. Signed-off-by: Ludovic Courtès <ludo@gnu.org> Philip McGrath 2022-05-12gnu: chez-scheme: Refactor configure phase and fix '--threads'....Move Chez-specific logic into '#:configure-flags' and a new 'configure-environment-variables' phase, leaving the 'configure' phase as just a variant of the one from 'gnu-build-system' (including support for '#:out-of-source?') that doesn't add implicit Autoconf-style flags. In the process, do the right thing for "--threads", rather than assuming the only nonthreaded platform is broken. * gnu/packages/chez.scm (chez-scheme)[arguments]: Set configure flags in '#:configure-flags' and separate 'configure-environment-variables' from the residual 'configure' phase. More closely follow 'gnu-build-system'. Use 'chez-upstream-features-for-system' for "--threads". (chez-scheme-for-racket)[arguments]<#:configure-flags>: Add "--threads" unconditionally. Signed-off-by: Ludovic Courtès <ludo@gnu.org> Philip McGrath 2022-05-12gnu: chez-scheme: Refactor documentation phases....Patches merged in both upstream Chez Scheme and Racket's variant will soon let us replace the 'install-docs' phase with just 'make install-docs'. Separating the 'link-doc-pdfs' phase (which won't change) leaves us well-prepared for the transition, regardless of whether Chez Scheme 9.5.10 or Racket 8.6 is released first. * gnu/packages/chez.scm (chez-scheme)[arguments]: Split 'install-doc' phase into 'install-docs' (matching the future 'make' target) and 'link-doc-pdfs'. Signed-off-by: Ludovic Courtès <ludo@gnu.org> Philip McGrath 2022-05-12gnu: chez-scheme: Update to 9.5.8....* gnu/packages/chez.scm (chez-scheme): Update to 9.5.8. Signed-off-by: Ludovic Courtès <ludo@gnu.org> Philip McGrath 2022-05-12gnu: racket: Update to 8.5....* gnu/packages/patches/racket-gui-tethered-launcher-backport.patch, gnu/packages/patches/racket-enable-scheme-backport.patch: Delete files. * gnu/local.mk (dist_patch_DATA): Remove them. * gnu/packages/chez.scm (chez-scheme-for-racket): Update to 9.5.7.6. * gnu/packages/racket.scm (%racket-version): Update to 8.5. (%racket-origin)[patches]: Remove obsolete patches. (racket-vm-common-configure-flags): Correct comment. (racket)[inputs]<2d, datalog, deinprogramm, draw, drracket, expeditor, htdp, pict, plot, quickscript, racklog, rackunit, redex, scribble, typed-racket, string-constants, syntax-color, web-server, xrepl>: Update checksums. <gui, srfi>: Likewise, and remove obsolete backports. Signed-off-by: Ludovic Courtès <ludo@gnu.org> Philip McGrath 2022-03-08gnu: stex-bootstrap: Guard against unsupported systems....The current implementation of nix-system->chez-machine et al. is rather brittle and fails in unexpected ways. In the meantime while a better replacement is being built, prevent falsy return values from causing errors, such as a failing “guix pull”. See <https://issues.guix.gnu.org/54292>. * gnu/packages/chez.scm (stex-bootstrap)[maybe-compile]: Use and=> to only call chez-machine->threaded if nix-system->chez-machine returns a truthy value. Liliana Marie Prikler 2022-03-04gnu: chez: Add 'chez-scheme-for-system'....* gnu/packages/chez.scm (chez-scheme-for-system): New procedure. (chez-srfi, chez-web, chez-sockets, chez-matchable, chez-irregex) (chez-fmt, chez-mit, chez-scmutils): Use 'chez-scheme-for-system'. * gnu/packages/loko.scm (loko-scheme): Likewise. * gnu/packages/emacs-xyz.scm (emacs-geiser-chez): Likewise Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com> Philip McGrath 2022-03-04gnu: Add chez-scheme-for-racket....The Racket variant of Chez Scheme can be used to support platforms that are not yet supported by upstream Chez Scheme. * gnu/packages/chez.scm (chez-scheme-for-racket): New variable. (chez-scheme-for-racket-bootstrap-bootfiles)[version] [supported-systems]: Derive from 'chez-scheme-for-racket'. * gnu/packages/racket.scm (%racket-version): Update comment. Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com> Philip McGrath 2022-03-04gnu: chez-mit: Support chez-scheme-for-racket....Racket's variant of Chez Scheme defines 'string->uninterned-symbol', which conflicts with the definition from '(chez mit)'. See discussion at <https://github.com/racket/racket/issues/4151>. * gnu/packages/chez.scm (chez-mit)[origin]<snippet>: Add workaround for chez-scheme-for-racket. Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com> Philip McGrath 2022-03-04gnu: chez-scheme: Explicitly package bootstrap bootfiles....This makes the structure of the upstream Chez Scheme package the same as for the Racket variant, it sets things up for (one day, hopefully) actually being able to bootstrap the upstream Chez Scheme bootfiles, and it may be useful for cross-compilation and adding support for architectures without pre-built bootfiles from upstream. * gnu/packages/chez.scm (chez-scheme-bootstrap-bootfiles): New variable. (chez-scheme)[native-inputs]: Add it. [arguments]<#:phases>: Add 'unpack-bootfiles'. (chez-scheme-for-racket-bootstrap-bootfiles): Inherit from 'chez-scheme-bootstrap-bootfiles'. [arguments]: Adapt accordingly. Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com> Philip McGrath 2022-03-04gnu: Add chez-nanopass....* gnu/packages/chez.scm (nanopass): Rename to ... (chez-nanopass-bootstrap): ... this new variable, and promote it from an origin to a package. (chez-nanopass): New variable. (unpack-nanopass+stex): New variable using 'chez-nanopass-bootstrap'. (chez-scheme-for-racket-bootstrap-bootfiles) (chez-scheme)[native-inputs]: Add 'chez-nanopass-bootstrap'. [arguments]<#:phases>: Adapt 'unpack-nanopass+stex' phase to use the new variable. * gnu/packages/racket.scm (racket-vm-cs): Likewise. (make-unpack-nanopass+stex): Remove it. Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com> Philip McGrath 2022-03-04gnu: Add stex....* gnu/packages/chez.scm (stex-bootstrap): New hidden package. (stex): Change from origin to package inheriting from 'stex-bootstrap' (chez-scheme)[native-inputs]: Add 'stex-bootstrap'. Remove dependencies of stex-bootstrap. [arguments]<#:phases>: Remove 'prepare-stex'. Adjust 'unpack-nanopass+stex' and 'install-doc'. Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com> Philip McGrath 2022-03-04gnu: chez-scheme: Use new package style....* gnu/packages/chez.scm (chez-scheme)[inputs]: Remove labels. [native-inputs]: Likewise. [arguments]: Use G-expressions. <#:phases>: Use 'search-input-file' instead of 'assoc-ref'. (nanopass): Make public as a temporary workaround for Racket. * gnu/packages/racket.scm (make-unpack-nanopass+stex): Update accordingly. Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com> Philip McGrath 2022-03-04gnu: chez-scheme: Use shared zlib and lz4....This change also involves building 'libkernel.a' instead of 'kernel.o'. Support for these build options was merged upstream in 2019: see discussion at <https://github.com/cisco/ChezScheme/pull/443>. * gnu/packages/chez.scm (chez-scheme)[inputs]: Remove 'zlib:static' and 'lz4:static'. [arguments]: Adjust configure phase accordingly. Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com> Philip McGrath 2022-03-04gnu: chez-scheme: Use "lib/chez-scheme" for search path....There does not seem to be any widely accepted standard path to use for "CHEZSCHEMELIBDIRS". Using a path without a version number in it avoids having to compute the actual path everywhere, which would be especially unpleasant when support is added for the Racket variant of Chez Scheme, which always has a different version number than upstream. * gnu/packages/chez.scm (chez-scheme)[native-search-paths]: Change to use "lib/chez-scheme" instead of "lib/csvX.Y.Z-site" for "CHEZSCHEMELIBDIRS". (chez-make-flags): Update accordingly. (chez-sockets)[arguments]<#:phases>: Likewise. Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com> Philip McGrath 2022-03-04gnu: chez-scheme: Use new style for Chez packages....* gnu/packages/chez.scm (chez-configure, chez-make-flags): Use G-expressions. (chez-srfi)[arguments]: Use G-expressions, 'chez-configure', and 'chez-make-flags'. (chez-web, chez-sockets)[native-inputs]: Remove labels. [arguments]: Use G-expressions. (chez-matchable, chez-irregex, chez-fmt, chez-mit) (chez-scmutils)[arguments]: Use G-expressions. Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com> Philip McGrath 2022-03-04gnu: chez: Add utilities for Chez machine types....* gnu/packages/chez.scm (chez-machine->nonthreaded) (chez-machine->threaded, chez-machine->nix-system) (nix-system->chez-machine, chez-upstream-features-for-system) (%nix-arch-to-chez-alist, %nix-os-to-chez-alist): New variables. (chez-scheme)[supported-systems]: Compute based on 'nix-system->chez-machine' and 'chez-upstream-features-for-system'. (chez-scheme-for-racket-bootstrap-bootfiles)[supported-systems]: Compute based on 'nix-system->chez-machine'. Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com> Philip McGrath 2022-03-04gnu: racket: Move Chez bootfiles to (gnu packages chez)....* gnu/packages/racket.scm (chez-scheme-for-racket-bootstrap-bootfiles): Move to ... * gnu/packages/chez.scm (chez-scheme-for-racket-bootstrap-bootfiles): ... this new variable. [source]: Avoid problematic cycle with "racket.scm". [arguments]<#:phases>: Likewise. Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com> Philip McGrath 2022-01-09gnu: chez-scheme: Update to 9.5.6....* gnu/packages/chez.scm (chez-scheme): Update to 9.5.6. [source]: Remove patch. [arguments]: Don't explicitly return #t from phases. * gnu/packages/patches/chez-scheme-build-util-paths-backport.patch: Delete file. * gnu/local.mk (dist_patch_DATA): Remove it. Tobias Geerinckx-Rice 2021-12-13gnu: Simplify package inputs....This commit was obtained by running: ./pre-inst-env guix style without any additional argument. Ludovic Courtès 2021-11-22gnu: chez-scheme: Add missing inputs....* gnu/packages/chez.scm (chez-scheme)[native-inputs]: Add texlive-dvips-l3backend and texlive-fonts-ec. [arguments]: Set HOME in 'configure' phase. Guillaume Le Vaillant 2021-09-06gnu: Use the non-deprecated TeX packages....This commit leaves 'dblatex' and 'texlive-hyperref' as users of deprecated packages, but these have many dependents. * gnu/packages/bioinformatics.scm (discrover)[native-inputs]: Use non-deprecated TeX Live packages. (velvet)[native-inputs]: Likewise. * gnu/packages/chez.scm (chez-scheme)[native-inputs]: Likewise. (chez-web)[native-inputs]: Likewise. * gnu/packages/engineering.scm (fastcap)[native-inputs]: Likewise. * gnu/packages/guile-xyz.scm (emacsy)[native-inputs]: Likewise. * gnu/packages/maths.scm (hypre)[native-inputs]: Likewise. * gnu/packages/music.scm (lilypond)[native-inputs]: Likewise. * gnu/packages/ocaml.scm (ocaml-bibtex2html)[native-inputs]: Likewise. * gnu/packages/plotutils.scm (asymptote)[native-inputs]: Likewise. * gnu/packages/python-xyz.scm (python-numpy-documentation)[native-inputs]: Likewise. (python-matplotlib-documentation)[native-inputs]: Likewise. (python-ipython-documentation)[native-inputs]: Likewise. (python-nbconvert)[native-inputs]: Likewise. (python-pypandoc)[native-inputs]: Likewise. * gnu/packages/statistics.scm (r-with-tests)[native-inputs]: Likewise. * gnu/packages/tex.scm (texlive-pstool)[propagated-inputs]: Likewise. (teximpatient)[native-inputs]: Likewise. (texlive-latex-pgf)[propagated-inputs]: Likewise. (texlive-beamer)[propagated-inputs]: Likewise. Ludovic Courtès 2021-04-18gnu: Fix merge mistakes....* gnu/packages/chez.scm (chez-scheme)[native-inputs]: Use correct texlive implementation. * gnu/packages/music.scm (python-abjad)[native-inputs], * gnu/packages/python-check.scm (python-pytest-helpers-namespace) [native-inputs]: Use correct variable for python-pytest. Efraim Flashner 2021-04-16Merge remote-tracking branch 'origin/master' into core-updates... Conflicts: gnu/local.mk gnu/packages/boost.scm gnu/packages/chez.scm gnu/packages/compression.scm gnu/packages/crates-io.scm gnu/packages/docbook.scm gnu/packages/engineering.scm gnu/packages/gcc.scm gnu/packages/gl.scm gnu/packages/gtk.scm gnu/packages/nettle.scm gnu/packages/python-check.scm gnu/packages/python-xyz.scm gnu/packages/radio.scm gnu/packages/rust.scm gnu/packages/sqlite.scm guix/build-system/node.scm Efraim Flashner 2021-04-05gnu: chez-scheme: simplify packaging...Take advantage of patches that have been accepted upstream. These changes lay a foundation for reusing more of Chez's build process for Racket. * gnu/packages/patches/chez-scheme-build-util-paths-backport.patch: New file. * gnu/local.mk (dist_patch_DATA): Add it. * gnu/packages/chez.scm (chez-scheme)[source](patches): Use it. [source](snippet): Remove bundled libraries here, not in configure phase. [inputs]: Organize. Move "nanopass", "stex", and "xorg-rgb" to ... [native-inputs]: ... this field. [arguments]: Add (ice-9 ftw) to #:modules. Remove unneeded 'patch-processor-detection' phase. Add 'unpack-nanopass+stex' phase (refactored from 'configure'). Simplify 'configure' phase by removing patches that have been upstreamed. Add "--nogzip-man-pages" flag so we can remove 'make-manpages-writable' phase. Stop ignoring #:configure-flags, move "--threads" there, and remove unneeded workaround. Add 'prepare-stex' phase (refactored from 'install-doc'). Use it to streamline 'install-doc' phase, installing all of the right files into the right places. Signed-off-by: Leo Prikler <leo.prikler@student.tugraz.at> Philip McGrath 2021-04-05gnu: chez-scheme: Update stex....Get a patch from upstream that will help us simplify the build process for the Chez Scheme documentation. * gnu/packages/chez.scm (chez-stex): Update to commit 5405149. Signed-off-by: Leo Prikler <leo.prikler@student.tugraz.at> Philip McGrath 2021-04-05gnu: chez-scheme: Update nanopass to 1.9.2....* gnu/packages/chez.scm (nanopass): Update nanopass to 1.9.2. Signed-off-by: Leo Prikler <leo.prikler@student.tugraz.at> Philip McGrath