2013-01-06 00:47:50 +01:00
|
|
|
|
;;; GNU Guix --- Functional package management for GNU
|
2021-07-05 15:41:45 +02:00
|
|
|
|
;;; Copyright © 2012, 2013, 2014, 2015, 2018, 2019, 2021 Ludovic Courtès <ludo@gnu.org>
|
2021-01-03 10:30:29 +01:00
|
|
|
|
;;; Copyright © 2021 Lars-Dominik Braun <lars@6xq.net>
|
2012-06-12 00:18:14 +02:00
|
|
|
|
;;;
|
2013-01-06 00:47:50 +01:00
|
|
|
|
;;; This file is part of GNU Guix.
|
2012-06-12 00:18:14 +02:00
|
|
|
|
;;;
|
2013-01-06 00:47:50 +01:00
|
|
|
|
;;; GNU Guix is free software; you can redistribute it and/or modify it
|
2012-06-12 00:18:14 +02:00
|
|
|
|
;;; 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.
|
|
|
|
|
;;;
|
2013-01-06 00:47:50 +01:00
|
|
|
|
;;; GNU Guix is distributed in the hope that it will be useful, but
|
2012-06-12 00:18:14 +02:00
|
|
|
|
;;; 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
|
2013-01-06 00:47:50 +01:00
|
|
|
|
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
|
2012-06-12 00:18:14 +02:00
|
|
|
|
|
|
|
|
|
|
build-systems/gnu: Allow unpacking/repacking more kind of files.
Before this change, only plain directories, tar or zip archives were supported
as the source of a package for the GNU build system; anything else would cause
the unpack phase to fail. Origins relying on snippets would suffer from the
same problem.
This change adds the support to use files of the following extensions: .gz,
.Z, .bz2, .lz, and .xz, even when they are not tarballs. Files of unknown
extensions are treated as uncompressed files and supported as well.
* guix/packages.scm (patch-and-repack): Only add the compressor utility to the
PATH when the file is compressed. Bind more inputs in the mlet, and use them
for decompressing single files. Adjust the decompression and compression
routines.
[decompression-type]: Remove nested variable.
* guix/build/utils.scm (compressor, tarball?): New procedures. Move
%xz-parallel-args to the new 'compression helpers' section.
* tests/packages.scm: Add tests. Add missing copyright year for Jan.
* guix/build/gnu-build-system.scm (first-subdirectory): Return #f when no
sub-directory was found.
(unpack): Support more file types, including uncompressed plain files.
2021-01-18 17:51:21 +01:00
|
|
|
|
(define-module (tests builders)
|
2012-11-12 23:10:26 +01:00
|
|
|
|
#:use-module (guix download)
|
2012-06-27 23:58:07 +02:00
|
|
|
|
#:use-module (guix build-system)
|
|
|
|
|
#:use-module (guix build-system gnu)
|
build-systems/gnu: Allow unpacking/repacking more kind of files.
Before this change, only plain directories, tar or zip archives were supported
as the source of a package for the GNU build system; anything else would cause
the unpack phase to fail. Origins relying on snippets would suffer from the
same problem.
This change adds the support to use files of the following extensions: .gz,
.Z, .bz2, .lz, and .xz, even when they are not tarballs. Files of unknown
extensions are treated as uncompressed files and supported as well.
* guix/packages.scm (patch-and-repack): Only add the compressor utility to the
PATH when the file is compressed. Bind more inputs in the mlet, and use them
for decompressing single files. Adjust the decompression and compression
routines.
[decompression-type]: Remove nested variable.
* guix/build/utils.scm (compressor, tarball?): New procedures. Move
%xz-parallel-args to the new 'compression helpers' section.
* tests/packages.scm: Add tests. Add missing copyright year for Jan.
* guix/build/gnu-build-system.scm (first-subdirectory): Return #f when no
sub-directory was found.
(unpack): Support more file types, including uncompressed plain files.
2021-01-18 17:51:21 +01:00
|
|
|
|
#:use-module (guix build gnu-build-system)
|
|
|
|
|
#:use-module (guix build utils)
|
2021-01-03 10:30:29 +01:00
|
|
|
|
#:use-module (guix build-system python)
|
2021-09-17 01:27:40 +02:00
|
|
|
|
#:use-module (guix grafts)
|
2012-06-12 00:18:14 +02:00
|
|
|
|
#:use-module (guix store)
|
2021-01-03 10:30:29 +01:00
|
|
|
|
#:use-module (guix monads)
|
2012-06-12 00:18:14 +02:00
|
|
|
|
#:use-module (guix utils)
|
Move base32 code to (guix base32).
* guix/utils.scm (bytevector-quintet-ref, bytevector-quintet-ref-right,
bytevector-quintet-length, bytevector-quintet-fold,
bytevector-quintet-fold-right, make-bytevector->base32-string,
%nix-base32-chars, %rfc4648-base32-chars, bytevector->base32-string,
bytevector->nix-base32-string, bytevector-quintet-set!,
bytevector-quintet-set-right!, base32-string-unfold,
base32-string-unfold-right, make-base32-string->bytevector,
base32-string->bytevector, nix-base32-string->bytevector): Move to...
* guix/base32.scm: ... here. New file.
* tests/utils.scm (%nix-hash, "bytevector->base32-string",
"base32-string->bytevector", "nix-base32-string->bytevector", "sha256
& bytevector->base32-string"): Move to...
* tests/base32.scm: ... here. New file
* guix-download.in, guix/derivations.scm, guix/packages.scm,
guix/snix.scm, tests/builders.scm, tests/derivations.scm: Adjust
accordingly.
* guix.scm (%public-modules): Add `base32'.
2012-11-11 22:33:28 +01:00
|
|
|
|
#:use-module (guix base32)
|
2012-06-12 00:18:14 +02:00
|
|
|
|
#:use-module (guix derivations)
|
Switch to Guile-Gcrypt.
This removes (guix hash) and (guix pk-crypto), which now live as part of
Guile-Gcrypt (version 0.1.0.)
* guix/gcrypt.scm, guix/hash.scm, guix/pk-crypto.scm,
tests/hash.scm, tests/pk-crypto.scm: Remove.
* configure.ac: Test for Guile-Gcrypt. Remove LIBGCRYPT and
LIBGCRYPT_LIBDIR assignments.
* m4/guix.m4 (GUIX_ASSERT_LIBGCRYPT_USABLE): Remove.
* README: Add Guile-Gcrypt to the dependencies; move libgcrypt as
"required unless --disable-daemon".
* doc/guix.texi (Requirements): Likewise.
* gnu/packages/bash.scm, guix/derivations.scm, guix/docker.scm,
guix/git.scm, guix/http-client.scm, guix/import/cpan.scm,
guix/import/cran.scm, guix/import/crate.scm, guix/import/elpa.scm,
guix/import/gnu.scm, guix/import/hackage.scm,
guix/import/texlive.scm, guix/import/utils.scm, guix/nar.scm,
guix/pki.scm, guix/scripts/archive.scm,
guix/scripts/authenticate.scm, guix/scripts/download.scm,
guix/scripts/hash.scm, guix/scripts/pack.scm,
guix/scripts/publish.scm, guix/scripts/refresh.scm,
guix/scripts/substitute.scm, guix/store.scm,
guix/store/deduplication.scm, guix/tests.scm, tests/base32.scm,
tests/builders.scm, tests/challenge.scm, tests/cpan.scm,
tests/crate.scm, tests/derivations.scm, tests/gem.scm,
tests/nar.scm, tests/opam.scm, tests/pki.scm,
tests/publish.scm, tests/pypi.scm, tests/store-deduplication.scm,
tests/store.scm, tests/substitute.scm: Adjust imports.
* gnu/system/vm.scm: Likewise.
(guile-sqlite3&co): Rename to...
(gcrypt-sqlite3&co): ... this. Add GUILE-GCRYPT.
(expression->derivation-in-linux-vm)[config]: Remove.
(iso9660-image)[config]: Remove.
(qemu-image)[config]: Remove.
(system-docker-image)[config]: Remove.
* guix/scripts/pack.scm: Adjust imports.
(guile-sqlite3&co): Rename to...
(gcrypt-sqlite3&co): ... this. Add GUILE-GCRYPT.
(self-contained-tarball)[build]: Call 'make-config.scm' without
#:libgcrypt argument.
(squashfs-image)[libgcrypt]: Remove.
[build]: Call 'make-config.scm' without #:libgcrypt.
(docker-image)[config, json]: Remove.
[build]: Add GUILE-GCRYPT to the extensions Remove (guix config) from
the imported modules.
* guix/self.scm (specification->package): Remove "libgcrypt", add
"guile-gcrypt".
(compiled-guix): Remove #:libgcrypt.
[guile-gcrypt]: New variable.
[dependencies]: Add it.
[*core-modules*]: Remove #:libgcrypt from 'make-config.scm' call.
Add #:extensions.
[*config*]: Remove #:libgcrypt from 'make-config.scm' call.
(%dependency-variables): Remove %libgcrypt.
(make-config.scm): Remove #:libgcrypt.
* build-aux/build-self.scm (guile-gcrypt): New variable.
(make-config.scm): Remove #:libgcrypt.
(build-program)[fake-gcrypt-hash]: New variable.
Add (gcrypt hash) to the imported modules. Adjust load path
assignments.
* gnu/packages/package-management.scm (guix)[propagated-inputs]: Add
GUILE-GCRYPT.
[arguments]: In 'wrap-program' phase, add GUILE-GCRYPT to the search
path.
2018-08-31 17:07:07 +02:00
|
|
|
|
#:use-module (gcrypt hash)
|
2014-08-23 19:18:01 +02:00
|
|
|
|
#:use-module (guix tests)
|
2021-01-03 10:30:29 +01:00
|
|
|
|
#:use-module (guix packages)
|
2013-01-18 01:06:24 +01:00
|
|
|
|
#:use-module (gnu packages bootstrap)
|
2012-10-28 01:58:39 +02:00
|
|
|
|
#:use-module (ice-9 match)
|
build-systems/gnu: Allow unpacking/repacking more kind of files.
Before this change, only plain directories, tar or zip archives were supported
as the source of a package for the GNU build system; anything else would cause
the unpack phase to fail. Origins relying on snippets would suffer from the
same problem.
This change adds the support to use files of the following extensions: .gz,
.Z, .bz2, .lz, and .xz, even when they are not tarballs. Files of unknown
extensions are treated as uncompressed files and supported as well.
* guix/packages.scm (patch-and-repack): Only add the compressor utility to the
PATH when the file is compressed. Bind more inputs in the mlet, and use them
for decompressing single files. Adjust the decompression and compression
routines.
[decompression-type]: Remove nested variable.
* guix/build/utils.scm (compressor, tarball?): New procedures. Move
%xz-parallel-args to the new 'compression helpers' section.
* tests/packages.scm: Add tests. Add missing copyright year for Jan.
* guix/build/gnu-build-system.scm (first-subdirectory): Return #f when no
sub-directory was found.
(unpack): Support more file types, including uncompressed plain files.
2021-01-18 17:51:21 +01:00
|
|
|
|
#:use-module (ice-9 textual-ports)
|
2012-06-12 00:18:14 +02:00
|
|
|
|
#:use-module (srfi srfi-1)
|
build-systems/gnu: Allow unpacking/repacking more kind of files.
Before this change, only plain directories, tar or zip archives were supported
as the source of a package for the GNU build system; anything else would cause
the unpack phase to fail. Origins relying on snippets would suffer from the
same problem.
This change adds the support to use files of the following extensions: .gz,
.Z, .bz2, .lz, and .xz, even when they are not tarballs. Files of unknown
extensions are treated as uncompressed files and supported as well.
* guix/packages.scm (patch-and-repack): Only add the compressor utility to the
PATH when the file is compressed. Bind more inputs in the mlet, and use them
for decompressing single files. Adjust the decompression and compression
routines.
[decompression-type]: Remove nested variable.
* guix/build/utils.scm (compressor, tarball?): New procedures. Move
%xz-parallel-args to the new 'compression helpers' section.
* tests/packages.scm: Add tests. Add missing copyright year for Jan.
* guix/build/gnu-build-system.scm (first-subdirectory): Return #f when no
sub-directory was found.
(unpack): Support more file types, including uncompressed plain files.
2021-01-18 17:51:21 +01:00
|
|
|
|
#:use-module (srfi srfi-11)
|
2021-07-05 15:41:45 +02:00
|
|
|
|
#:use-module (srfi srfi-34)
|
2012-06-12 00:18:14 +02:00
|
|
|
|
#:use-module (srfi srfi-64))
|
|
|
|
|
|
|
|
|
|
;; Test the higher-level builders.
|
|
|
|
|
|
|
|
|
|
(define %store
|
2014-08-23 19:18:01 +02:00
|
|
|
|
(open-connection-for-tests))
|
2012-11-02 22:38:52 +01:00
|
|
|
|
|
2015-01-14 14:42:10 +01:00
|
|
|
|
(define url-fetch*
|
|
|
|
|
(store-lower url-fetch))
|
|
|
|
|
|
2021-09-07 14:44:39 +02:00
|
|
|
|
;; Globally disable grafts because they can trigger early builds.
|
|
|
|
|
(%graft? #f)
|
|
|
|
|
|
2012-10-06 01:24:46 +02:00
|
|
|
|
|
2012-06-12 00:18:14 +02:00
|
|
|
|
(test-begin "builders")
|
|
|
|
|
|
2015-02-23 23:41:26 +01:00
|
|
|
|
(unless (network-reachable?) (test-skip 1))
|
2012-11-12 23:10:26 +01:00
|
|
|
|
(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"))
|
2015-01-14 14:42:10 +01:00
|
|
|
|
(drv (url-fetch* %store url 'sha256 hash
|
|
|
|
|
#:guile %bootstrap-guile))
|
derivations: 'derivation' and related procedures return a single value.
* guix/derivations.scm (derivation->output-path,
derivation->output-paths): New procedures.
(derivation-path->output-path): Use 'derivation->output-path'.
(derivation-path->output-paths): Use 'derivation->output-paths'.
(derivation): Accept 'derivation?' objects as inputs. Return a single
value.
(build-derivations): New procedure.
(compiled-modules): Use 'derivation->output-paths'.
(build-expression->derivation)[source-path]: Add case for when the
input matches 'derivation?'.
[prologue]: Accept 'derivation?' objects in INPUTS.
[mod-dir, go-dir]: Use 'derivation->output-path'.
* guix/download.scm (url-fetch): Adjust to the single-value return.
* guix/packages.scm (package-output): Use 'derivation->output-path'.
* guix/scripts/build.scm (guix-build): When the argument is
'derivation-path?', pass it through 'read-derivation'.
Use 'derivation-file-name' to print out the .drv file names, and to
register them. Use 'derivation->output-path' instead of
'derivation-path->output-path'.
* guix/scripts/package.scm (roll-back): Adjust to the single-value
return.
(guix-package): Use 'derivation->output-path'.
* guix/ui.scm (show-what-to-build): Adjust to deal with 'derivation?'
objects instead of .drv file names.
* gnu/system/grub.scm (grub-configuration-file): Use
'derivation->output-path' instead of 'derivation-path->output-path'.
* gnu/system/vm.scm (qemu-image, system-qemu-image): Likewise.
* tests/builders.scm, tests/derivations.scm, tests/packages.scm,
tests/store.scm, tests/union.scm: Adjust to the new calling
convention.
* doc/guix.texi (Defining Packages, The Store, Derivations): Adjust
accordingly.
2013-09-18 17:01:40 +02:00
|
|
|
|
(out-path (derivation->output-path drv)))
|
|
|
|
|
(and (build-derivations %store (list drv))
|
2012-11-12 23:10:26 +01:00
|
|
|
|
(file-exists? out-path)
|
|
|
|
|
(valid-path? %store out-path))))
|
2012-06-12 00:18:14 +02:00
|
|
|
|
|
2014-10-03 11:02:11 +02:00
|
|
|
|
(test-assert "url-fetch, file"
|
|
|
|
|
(let* ((file (search-path %load-path "guix.scm"))
|
|
|
|
|
(hash (call-with-input-file file port-sha256))
|
2015-01-14 14:42:10 +01:00
|
|
|
|
(out (url-fetch* %store file 'sha256 hash)))
|
2014-10-03 11:02:11 +02:00
|
|
|
|
(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))
|
2015-01-14 14:42:10 +01:00
|
|
|
|
(out (url-fetch* %store
|
|
|
|
|
(string-append "file://" (canonicalize-path file))
|
|
|
|
|
'sha256 hash)))
|
2014-10-03 11:02:11 +02:00
|
|
|
|
(and (file-exists? out)
|
|
|
|
|
(valid-path? %store out))))
|
|
|
|
|
|
2012-06-27 23:58:07 +02:00
|
|
|
|
(test-assert "gnu-build-system"
|
build-system: Introduce "bags" as an intermediate representation.
* guix/build-system.scm (<build-system>)[build, cross-build]: Remove.
[lower]: New field.
(<bag>): New record type.
(make-bag): New procedure.
* guix/packages.scm (bag-transitive-inputs, bag-transitive-build-inputs,
bag-transitive-host-inputs, bag-transitive-target-inputs,
package->bag): New procedures.
(package-derivation): Use it; use the bag, apply its build procedure,
etc.
(package-cross-derivation): Likewise.
* gnu/packages/bootstrap.scm (raw-build, make-raw-bag): New procedure.
(%bootstrap-guile): Use them.
* guix/build-system/trivial.scm (lower): New procedure.
(trivial-build, trivial-cross-build): Remove 'source' parameter. Pass
INPUTS as is.
(trivial-build-system): Adjust accordingly.
* guix/build-system/gnu.scm (%store, inputs-search-paths,
standard-search-paths, expand-inputs, standard-inputs): Remove.
(gnu-lower): New procedure.
(gnu-build): Remove 'source' and #:implicit-inputs? parameters.
Remove 'implicit-inputs' and 'implicit-search-paths' variables. Get
the source from INPUT-DRVS.
(gnu-cross-build): Likewise.
(standard-cross-packages): Remove call to 'standard-packages'.
(standard-cross-inputs, standard-cross-search-paths): Remove.
(gnu-build-system): Remove 'build' and 'cross-build'; add 'lower'.
* guix/build-system/cmake.scm (lower): New procedure.
(cmake-build): Remove 'source' and #:cmake parameters. Use INPUTS and
SEARCH-PATHS as is. Get the source from INPUTS.
* guix/build-system/perl.scm: Likewise.
* guix/build-system/python.scm: Likewise.
* guix/build-system/ruby.scm: Likewise.
* gnu/packages/cross-base.scm (cross-gcc): Change "cross-linux-headers"
to "linux-headers".
(cross-libc)[xlinux-headers]: Pass #:implicit-cross-inputs? #f.
Likewise. In 'propagated-inputs', change "cross-linux-headers" to
"linux-headers".
* guix/git-download.scm (git-fetch): Use 'standard-packages' instead of
'standard-inputs'.
* tests/builders.scm ("gnu-build-system"): Remove use of
'build-system-builder'.
("gnu-build"): Remove 'source' and #:implicit-inputs? arguments to
'gnu-build'.
* tests/packages.scm ("search paths"): Adjust to new build system API.
("package-cross-derivation, no cross builder"): Likewise.
* doc/guix.texi (Build Systems): Add paragraph on bags.
2014-10-03 18:06:16 +02:00
|
|
|
|
(build-system? gnu-build-system))
|
2012-06-27 23:58:07 +02:00
|
|
|
|
|
build-systems/gnu: Allow unpacking/repacking more kind of files.
Before this change, only plain directories, tar or zip archives were supported
as the source of a package for the GNU build system; anything else would cause
the unpack phase to fail. Origins relying on snippets would suffer from the
same problem.
This change adds the support to use files of the following extensions: .gz,
.Z, .bz2, .lz, and .xz, even when they are not tarballs. Files of unknown
extensions are treated as uncompressed files and supported as well.
* guix/packages.scm (patch-and-repack): Only add the compressor utility to the
PATH when the file is compressed. Bind more inputs in the mlet, and use them
for decompressing single files. Adjust the decompression and compression
routines.
[decompression-type]: Remove nested variable.
* guix/build/utils.scm (compressor, tarball?): New procedures. Move
%xz-parallel-args to the new 'compression helpers' section.
* tests/packages.scm: Add tests. Add missing copyright year for Jan.
* guix/build/gnu-build-system.scm (first-subdirectory): Return #f when no
sub-directory was found.
(unpack): Support more file types, including uncompressed plain files.
2021-01-18 17:51:21 +01:00
|
|
|
|
(define unpack (assoc-ref %standard-phases 'unpack))
|
|
|
|
|
|
|
|
|
|
(define compressors '(("gzip" . "gz")
|
|
|
|
|
("xz" . "xz")
|
|
|
|
|
("bzip2" . "bz2")
|
|
|
|
|
(#f . #f)))
|
|
|
|
|
|
|
|
|
|
(for-each
|
|
|
|
|
(match-lambda
|
|
|
|
|
((comp . ext)
|
|
|
|
|
|
|
|
|
|
(unless (network-reachable?) (test-skip 1)) ;for bootstrap binaries
|
|
|
|
|
(test-equal (string-append "gnu-build-system unpack phase, "
|
|
|
|
|
"single file (compression: "
|
|
|
|
|
(if comp comp "None") ")")
|
|
|
|
|
"expected text"
|
|
|
|
|
(let*-values
|
|
|
|
|
(((name) "test")
|
|
|
|
|
((compressed-name) (if ext
|
|
|
|
|
(string-append name "." ext)
|
|
|
|
|
name))
|
|
|
|
|
((file hash) (test-file %store compressed-name "expected text")))
|
|
|
|
|
(call-with-temporary-directory
|
|
|
|
|
(lambda (dir)
|
|
|
|
|
(with-directory-excursion dir
|
|
|
|
|
(unpack #:source file)
|
|
|
|
|
(call-with-input-file name get-string-all))))))))
|
|
|
|
|
compressors)
|
|
|
|
|
|
2021-01-03 10:30:29 +01:00
|
|
|
|
|
|
|
|
|
;;;
|
|
|
|
|
;;; Test the sanity-check phase of the Python build system.
|
|
|
|
|
;;;
|
|
|
|
|
|
|
|
|
|
(define* (make-python-dummy name #:key (setup-py-extra "")
|
|
|
|
|
(init-py "") (use-setuptools? #t))
|
|
|
|
|
(dummy-package (string-append "python-dummy-" name)
|
|
|
|
|
(version "0.1")
|
|
|
|
|
(build-system python-build-system)
|
|
|
|
|
(arguments
|
|
|
|
|
`(#:tests? #f
|
|
|
|
|
#:use-setuptools? ,use-setuptools?
|
|
|
|
|
#:phases
|
|
|
|
|
(modify-phases %standard-phases
|
|
|
|
|
(replace 'unpack
|
|
|
|
|
(lambda _
|
|
|
|
|
(mkdir-p "dummy")
|
|
|
|
|
(with-output-to-file "dummy/__init__.py"
|
|
|
|
|
(lambda _
|
|
|
|
|
(display ,init-py)))
|
|
|
|
|
(with-output-to-file "setup.py"
|
|
|
|
|
(lambda _
|
|
|
|
|
(format #t "\
|
|
|
|
|
~a
|
|
|
|
|
setup(
|
|
|
|
|
name='dummy-~a',
|
|
|
|
|
version='0.1',
|
|
|
|
|
packages=['dummy'],
|
|
|
|
|
~a
|
|
|
|
|
)"
|
|
|
|
|
(if ,use-setuptools?
|
|
|
|
|
"from setuptools import setup"
|
|
|
|
|
"from distutils.core import setup")
|
|
|
|
|
,name ,setup-py-extra))))))))))
|
|
|
|
|
|
|
|
|
|
(define python-dummy-ok
|
|
|
|
|
(make-python-dummy "ok"))
|
|
|
|
|
|
|
|
|
|
;; distutil won't install any metadata, so make sure our script does not fail
|
|
|
|
|
;; on a otherwise fine package.
|
|
|
|
|
(define python-dummy-no-setuptools
|
|
|
|
|
(make-python-dummy
|
|
|
|
|
"no-setuptools" #:use-setuptools? #f))
|
|
|
|
|
|
|
|
|
|
(define python-dummy-fail-requirements
|
|
|
|
|
(make-python-dummy "fail-requirements"
|
|
|
|
|
#:setup-py-extra "install_requires=['nonexistent'],"))
|
|
|
|
|
|
|
|
|
|
(define python-dummy-fail-import
|
|
|
|
|
(make-python-dummy "fail-import" #:init-py "import nonexistent"))
|
|
|
|
|
|
|
|
|
|
(define python-dummy-fail-console-script
|
|
|
|
|
(make-python-dummy "fail-console-script"
|
|
|
|
|
#:setup-py-extra (string-append "entry_points={'console_scripts': "
|
|
|
|
|
"['broken = dummy:nonexistent']},")))
|
|
|
|
|
|
|
|
|
|
(define (check-build-success store p)
|
|
|
|
|
(unless store (test-skip 1))
|
|
|
|
|
(test-assert (string-append "python-build-system: " (package-name p))
|
|
|
|
|
(let* ((drv (package-derivation store p)))
|
|
|
|
|
(build-derivations store (list drv)))))
|
|
|
|
|
|
|
|
|
|
(define (check-build-failure store p)
|
|
|
|
|
(unless store (test-skip 1))
|
|
|
|
|
(test-assert (string-append "python-build-system: " (package-name p))
|
2021-07-05 15:41:45 +02:00
|
|
|
|
(let ((drv (package-derivation store p)))
|
|
|
|
|
(guard (c ((store-protocol-error? c)
|
|
|
|
|
(pk 'failure c #t))) ;good!
|
|
|
|
|
(build-derivations store (list drv))
|
|
|
|
|
#f)))) ;bad: it should have failed
|
2021-01-03 10:30:29 +01:00
|
|
|
|
|
|
|
|
|
(with-external-store store
|
|
|
|
|
(for-each (lambda (p) (check-build-success store p))
|
|
|
|
|
(list
|
|
|
|
|
python-dummy-ok
|
|
|
|
|
python-dummy-no-setuptools))
|
|
|
|
|
(for-each (lambda (p) (check-build-failure store p))
|
|
|
|
|
(list
|
|
|
|
|
python-dummy-fail-requirements
|
|
|
|
|
python-dummy-fail-import
|
|
|
|
|
python-dummy-fail-console-script)))
|
|
|
|
|
|
2012-06-12 00:18:14 +02:00
|
|
|
|
(test-end "builders")
|