summaryrefslogtreecommitdiff
path: root/guix/build
diff options
context:
space:
mode:
authorLeo Famulari <leo@famulari.name>2017-01-06 17:14:41 -0500
committerLeo Famulari <leo@famulari.name>2017-01-06 17:14:41 -0500
commit74288230ea8b2310495dc2739f39ceadcc143fd0 (patch)
tree73ba6c7c13d59c5f92b409c94dccfff159e08f4d /guix/build
parent92e779592d269ca1924f184496eb4ca832997b12 (diff)
parentaa21c764d65068783ae31febee2a92eb3d138a24 (diff)
Merge branch 'master' into core-updates
Diffstat (limited to 'guix/build')
-rw-r--r--guix/build/cargo-build-system.scm110
-rw-r--r--guix/build/cmake-build-system.scm1
-rw-r--r--guix/build/download.scm9
-rw-r--r--guix/build/make-bootstrap.scm85
-rw-r--r--guix/build/ocaml-build-system.scm119
-rw-r--r--guix/build/pull.scm2
-rw-r--r--guix/build/python-build-system.scm150
-rw-r--r--guix/build/syscalls.scm6
8 files changed, 452 insertions, 30 deletions
diff --git a/guix/build/cargo-build-system.scm b/guix/build/cargo-build-system.scm
new file mode 100644
index 0000000000..7d656a8d58
--- /dev/null
+++ b/guix/build/cargo-build-system.scm
@@ -0,0 +1,110 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2016 David Craven <david@craven.ch>
+;;;
+;;; 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 (guix build cargo-build-system)
+ #:use-module ((guix build gnu-build-system) #:prefix gnu:)
+ #:use-module (guix build utils)
+ #:use-module (ice-9 ftw)
+ #:use-module (ice-9 format)
+ #:use-module (ice-9 match)
+ #:use-module (srfi srfi-1)
+ #:use-module (srfi srfi-26)
+ #:export (%standard-phases
+ cargo-build))
+
+;; Commentary:
+;;
+;; Builder-side code of the standard Rust package build procedure.
+;;
+;; Code:
+
+;; FIXME: Needs to be parsed from url not package name.
+(define (package-name->crate-name name)
+ "Return the crate name of NAME."
+ (match (string-split name #\-)
+ (("rust" rest ...)
+ (string-join rest "-"))
+ (_ #f)))
+
+(define* (configure #:key inputs #:allow-other-keys)
+ "Replace Cargo.toml [dependencies] section with guix inputs."
+ ;; Make sure Cargo.toml is writeable when the crate uses git-fetch.
+ (chmod "Cargo.toml" #o644)
+ (let ((port (open-file "Cargo.toml" "a" #:encoding "utf-8")))
+ (format port "~%[replace]~%")
+ (for-each
+ (match-lambda
+ ((name . path)
+ (let ((crate (package-name->crate-name name)))
+ (when (and crate path)
+ (match (string-split (basename path) #\-)
+ ((_ ... version)
+ (format port "\"~a:~a\" = { path = \"~a/share/rust-source\" }~%"
+ crate version path)))))))
+ inputs)
+ (close-port port))
+ #t)
+
+(define* (build #:key (cargo-build-flags '("--release" "--frozen"))
+ #:allow-other-keys)
+ "Build a given Cargo package."
+ (if (file-exists? "Cargo.lock")
+ (zero? (apply system* `("cargo" "build" ,@cargo-build-flags)))
+ #t))
+
+(define* (check #:key tests? #:allow-other-keys)
+ "Run tests for a given Cargo package."
+ (if (and tests? (file-exists? "Cargo.lock"))
+ (zero? (system* "cargo" "test"))
+ #t))
+
+(define* (install #:key inputs outputs #:allow-other-keys)
+ "Install a given Cargo package."
+ (let* ((out (assoc-ref outputs "out"))
+ (src (assoc-ref inputs "source"))
+ (rsrc (string-append (assoc-ref outputs "src")
+ "/share/rust-source")))
+ (mkdir-p rsrc)
+ ;; Rust doesn't have a stable ABI yet. Because of this
+ ;; Cargo doesn't have a search path for binaries yet.
+ ;; Until this changes we are working around this by
+ ;; distributing crates as source and replacing
+ ;; references in Cargo.toml with store paths.
+ (copy-recursively "src" (string-append rsrc "/src"))
+ (install-file "Cargo.toml" rsrc)
+ ;; When the package includes executables we install
+ ;; it using cargo install. This fails when the crate
+ ;; doesn't contain an executable.
+ (if (file-exists? "Cargo.lock")
+ (system* "cargo" "install" "--root" out)
+ (mkdir out))))
+
+(define %standard-phases
+ ;; 'configure' phase is not needed.
+ (modify-phases gnu:%standard-phases
+ (replace 'configure configure)
+ (replace 'build build)
+ (replace 'check check)
+ (replace 'install install)))
+
+(define* (cargo-build #:key inputs (phases %standard-phases)
+ #:allow-other-keys #:rest args)
+ "Build the given Cargo package, applying all of PHASES in order."
+ (apply gnu:gnu-build #:inputs inputs #:phases phases args))
+
+;;; cargo-build-system.scm ends here
diff --git a/guix/build/cmake-build-system.scm b/guix/build/cmake-build-system.scm
index f57622e0f4..27f2b5c872 100644
--- a/guix/build/cmake-build-system.scm
+++ b/guix/build/cmake-build-system.scm
@@ -66,6 +66,7 @@
(define* (check #:key (tests? #t) (parallel-tests? #t) (test-target "test")
#:allow-other-keys)
(let ((gnu-check (assoc-ref gnu:%standard-phases 'check)))
+ (setenv "CTEST_OUTPUT_ON_FAILURE" "1")
(gnu-check #:tests? tests? #:test-target test-target
#:parallel-tests? parallel-tests?)))
diff --git a/guix/build/download.scm b/guix/build/download.scm
index 8e32b3d7ff..203338b527 100644
--- a/guix/build/download.scm
+++ b/guix/build/download.scm
@@ -289,9 +289,12 @@ DIRECTORY. Those authority certificates are checked when
(string-suffix? ".pem" file)))
'())))
(for-each (lambda (file)
- (set-certificate-credentials-x509-trust-file!
- cred (string-append directory "/" file)
- x509-certificate-format/pem))
+ (let ((file (string-append directory "/" file)))
+ ;; Protect against dangling symlinks.
+ (when (file-exists? file)
+ (set-certificate-credentials-x509-trust-file!
+ cred file
+ x509-certificate-format/pem))))
(or files '()))
cred))
diff --git a/guix/build/make-bootstrap.scm b/guix/build/make-bootstrap.scm
new file mode 100644
index 0000000000..21c78cc8f5
--- /dev/null
+++ b/guix/build/make-bootstrap.scm
@@ -0,0 +1,85 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2015, 2017 Manolis Fragkiskos Ragkousis <manolis837@gmail.com>
+;;; Copyright © 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 (guix build make-bootstrap)
+ #:use-module (srfi srfi-1)
+ #:use-module (srfi srfi-11)
+ #:use-module (srfi srfi-19)
+ #:use-module (srfi srfi-26)
+ #:use-module (guix build utils)
+ #:export (make-stripped-libc))
+
+;; Commentary:
+;;
+;; This module provides facilities to build the bootstrap binaries.
+;;
+;; Code:
+
+(define (make-stripped-libc output libc kernel-headers)
+ "Copy to OUTPUT the subset of LIBC and KERNEL-HEADERS that is needed
+when producing a bootstrap libc."
+
+ (define (copy-mach-headers output kernel-headers)
+ (let* ((incdir (string-append output "/include")))
+ (copy-recursively (string-append libc "/include") incdir)
+
+ (copy-recursively (string-append kernel-headers "/include/mach")
+ (string-append incdir "/mach"))
+ #t))
+
+ (define (copy-linux-headers output kernel-headers)
+ (let* ((incdir (string-append output "/include")))
+ (copy-recursively (string-append libc "/include") incdir)
+
+ ;; Copy some of the Linux-Libre headers that glibc headers
+ ;; refer to.
+ (mkdir (string-append incdir "/linux"))
+ (for-each (lambda (file)
+ (install-file (string-append kernel-headers "/include/linux/" file)
+ (string-append incdir "/linux")))
+ '("limits.h" "errno.h" "socket.h" "kernel.h"
+ "sysctl.h" "param.h" "ioctl.h" "types.h"
+ "posix_types.h" "stddef.h"))
+
+ (copy-recursively (string-append kernel-headers "/include/asm")
+ (string-append incdir "/asm"))
+ (copy-recursively (string-append kernel-headers "/include/asm-generic")
+ (string-append incdir "/asm-generic"))
+ #t))
+
+ (define %libc-object-files-rx "^(crt.*|ld.*|lib(c|m|dl|rt|pthread|nsl|\
+util).*\\.so(\\..*)?|lib(machuser|hurduser).so.*|(libc(rt|)|libpthread)\
+_nonshared\\.a)$")
+
+ (setvbuf (current-output-port) _IOLBF)
+ (let* ((libdir (string-append output "/lib")))
+ (mkdir-p libdir)
+ (for-each (lambda (file)
+ (let ((target (string-append libdir "/"
+ (basename file))))
+ (copy-file file target)
+ (remove-store-references target)))
+ (find-files (string-append libc "/lib") %libc-object-files-rx))
+ #t)
+
+ (if (directory-exists? (string-append kernel-headers "/include/mach"))
+ (copy-mach-headers output kernel-headers)
+ (copy-linux-headers output kernel-headers)))
+
+
diff --git a/guix/build/ocaml-build-system.scm b/guix/build/ocaml-build-system.scm
new file mode 100644
index 0000000000..f77251ca09
--- /dev/null
+++ b/guix/build/ocaml-build-system.scm
@@ -0,0 +1,119 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2016, 2017 Julien Lepiller <julien@lepiller.eu>
+;;;
+;;; 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 (guix build ocaml-build-system)
+ #:use-module ((guix build gnu-build-system) #:prefix gnu:)
+ #:use-module (guix build utils)
+ #:use-module (ice-9 match)
+ #:export (%standard-phases
+ ocaml-build))
+
+;; Commentary:
+;;
+;; Builder-side code of the standard ocaml build procedure.
+;;
+;; Code:
+
+(define* (ocaml-findlib-environment #:key outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out")))
+ (setenv "OCAMLFIND_DESTDIR" (string-append out "/lib/ocaml/site-lib"))
+ (setenv "OCAMLFIND_LDCONF" "ignore"))
+ #t)
+
+(define* (configure #:key outputs (configure-flags '())
+ (test-flags '("--enable-tests")) tests?
+ #:allow-other-keys)
+ "Configure the given package."
+ (let* ((out (assoc-ref outputs "out")))
+ (format #t "build directory: ~s~%" (getcwd))
+ (if (file-exists? "setup.ml")
+ (let ((args `("-configure"
+ "--prefix" ,out
+ ,@(if tests?
+ test-flags
+ '())
+ ,@configure-flags)))
+ (format #t "running 'setup.ml' with arguments ~s~%" args)
+ (zero? (apply system* "ocaml" "setup.ml" args)))
+ (let ((args `("-prefix" ,out ,@configure-flags)))
+ (format #t "running 'configure' with arguments ~s~%" args)
+ (zero? (apply system* "./configure" args))))))
+
+(define* (build #:key inputs outputs (build-flags '()) (make-flags '())
+ (use-make? #f) #:allow-other-keys)
+ "Build the given package."
+ (if (and (file-exists? "setup.ml") (not use-make?))
+ (zero? (apply system* "ocaml" "setup.ml" "-build" build-flags))
+ (if (file-exists? "Makefile")
+ (zero? (apply system* "make" make-flags))
+ (let ((file (if (file-exists? "pkg/pkg.ml") "pkg/pkg.ml" "pkg/build.ml")))
+ (zero? (apply system* "ocaml" "-I"
+ (string-append (assoc-ref inputs "findlib")
+ "/lib/ocaml/site-lib")
+ file build-flags))))))
+
+(define* (check #:key inputs outputs (make-flags '()) (test-target "test") tests?
+ (use-make? #f) #:allow-other-keys)
+ "Install the given package."
+ (when tests?
+ (if (and (file-exists? "setup.ml") (not use-make?))
+ (zero? (system* "ocaml" "setup.ml" (string-append "-" test-target)))
+ (if (file-exists? "Makefile")
+ (zero? (apply system* "make" test-target make-flags))
+ (let ((file (if (file-exists? "pkg/pkg.ml") "pkg/pkg.ml" "pkg/build.ml")))
+ (zero? (system* "ocaml" "-I"
+ (string-append (assoc-ref inputs "findlib")
+ "/lib/ocaml/site-lib")
+ file test-target)))))))
+
+(define* (install #:key outputs (build-flags '()) (make-flags '()) (use-make? #f)
+ (install-target "install")
+ #:allow-other-keys)
+ "Install the given package."
+ (let ((out (assoc-ref outputs "out")))
+ (if (and (file-exists? "setup.ml") (not use-make?))
+ (zero? (apply system* "ocaml" "setup.ml"
+ (string-append "-" install-target) build-flags))
+ (if (file-exists? "Makefile")
+ (zero? (apply system* "make" install-target make-flags))
+ (zero? (system* "opam-installer" "-i" (string-append "--prefix=" out)
+ (string-append "--libdir=" out "/lib/ocaml/site-lib")))))))
+
+(define* (prepare-install #:key outputs #:allow-other-keys)
+ "Prepare for building the given package."
+ (mkdir-p (string-append (assoc-ref outputs "out") "/lib/ocaml/site-lib"))
+ (mkdir-p (string-append (assoc-ref outputs "out") "/bin")))
+
+(define %standard-phases
+ ;; Everything is as with the GNU Build System except for the `configure'
+ ;; , `build', `check' and `install' phases.
+ (modify-phases gnu:%standard-phases
+ (add-before 'configure 'ocaml-findlib-environment
+ ocaml-findlib-environment)
+ (add-before 'install 'prepare-install prepare-install)
+ (replace 'configure configure)
+ (replace 'build build)
+ (replace 'check check)
+ (replace 'install install)))
+
+(define* (ocaml-build #:key inputs (phases %standard-phases)
+ #:allow-other-keys #:rest args)
+ "Build the given package, applying all of PHASES in order."
+ (apply gnu:gnu-build #:inputs inputs #:phases phases args))
+
+;;; ocaml-build-system.scm ends here
diff --git a/guix/build/pull.scm b/guix/build/pull.scm
index 871bf6f535..6034e93cbf 100644
--- a/guix/build/pull.scm
+++ b/guix/build/pull.scm
@@ -84,7 +84,7 @@ containing the source code. Write any debugging output to DEBUG-PORT."
(("@GZIP@") (string-append gzip "/bin/gzip"))
(("@BZIP2@") (string-append bzip2 "/bin/bzip2"))
(("@XZ@") (string-append xz "/bin/xz"))
- (("@NIX_INSTANTIATE@") "")) ;remnants from the past
+ (("@NIX_INSTANTIATE@") "nix-instantiate")) ;for (guix import nix)
;; Augment the search path so Scheme code can be compiled.
(set! %load-path (cons out %load-path))
diff --git a/guix/build/python-build-system.scm b/guix/build/python-build-system.scm
index 9109fb4ac7..3f280b0ac0 100644
--- a/guix/build/python-build-system.scm
+++ b/guix/build/python-build-system.scm
@@ -3,6 +3,7 @@
;;; Copyright © 2013 Andreas Enge <andreas@enge.fr>
;;; Copyright © 2013 Nikita Karetnikov <nikita@karetnikov.org>
;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
+;;; Copyright © 2016 Hartmut Goebel <h.goebel@crazy-compilers.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -27,31 +28,119 @@
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-26)
#:export (%standard-phases
+ add-installed-pythonpath
+ site-packages
python-build))
;; Commentary:
;;
;; Builder-side code of the standard Python package build procedure.
;;
-;; Code:
+;;
+;; Backgound about the Python installation methods
+;;
+;; In Python there are different ways to install packages: distutils,
+;; setuptools, easy_install and pip. All of these are sharing the file
+;; setup.py, introduced with distutils in Python 2.0. The setup.py file can be
+;; considered as a kind of Makefile accepting targets (or commands) like
+;; "build" and "install". As of autumn 2016 the recommended way to install
+;; Python packages is using pip.
+;;
+;; For both distutils and setuptools, running "python setup.py install" is the
+;; way to install Python packages. With distutils the "install" command
+;; basically copies all packages into <prefix>/lib/pythonX.Y/site-packages.
+;;
+;; Some time later "setuptools" was established to enhance distutils. To use
+;; setuptools, the developer imports setuptools in setup.py. When importing
+;; setuptools, the original "install" command gets overwritten by setuptools'
+;; "install" command.
+;;
+;; The command-line tools easy_install and pip are both capable of finding and
+;; downloading the package source from PyPI (the Python Package Index). Both
+;; of them import setuptools and execute the "setup.py" file under their
+;; control. Thus the "setup.py" behaves as if the developer had imported
+;; setuptools within setup.py - even is still using only distutils.
+;;
+;; Setuptools' "install" command (to be more precise: the "easy_install"
+;; command which is called by "install") will put the path of the currently
+;; installed version of each package and it's dependencies (as declared in
+;; setup.py) into an "easy-install.pth" file. In Guix each packages gets its
+;; own "site-packages" directory and thus an "easy-install.pth" of its own.
+;; To avoid conflicts, the python build system renames the file to
+;; <packagename>.pth in the phase rename-pth-file. To ensure that Python will
+;; process the .pth file, easy_install also creates a basic "site.py" in each
+;; "site-packages" directory. The file is the same for all packages, thus
+;; there is no need to rename it. For more information about .pth files and
+;; the site module, please refere to
+;; https://docs.python.org/3/library/site.html.
+;;
+;; The .pth files contain the file-system paths (pointing to the store) of all
+;; dependencies. So the dependency is hidden in the .pth file but is not
+;; visible in the file-system. Now if packages A and B both required packages
+;; P, but in different versions, Guix will not detect this when installing
+;; both A and B to a profile. (For details and example see
+;; https://lists.gnu.org/archive/html/guix-devel/2016-10/msg01233.html.)
+;;
+;; Pip behaves a bit different then easy_install: it always executes
+;; "setup.py" with the option "--single-version-externally-managed" set. This
+;; makes setuptools' "install" command run the original "install" command
+;; instead of the "easy_install" command, so no .pth file (and no site.py)
+;; will be created. The "site-packages" directory only contains the package
+;; and the related .egg-info directory.
+;;
+;; This is exactly what we need for Guix and this is what we mimic in the
+;; install phase below.
+;;
+;; As a draw back, the magic of the .pth file of linking to the other required
+;; packages is gone and these packages have now to be declared as
+;; "propagated-inputs".
+;;
+;; Note: Importing setuptools also adds two sub-commands: "install_egg_info"
+;; and "install_scripts". These sub-commands are executed even if
+;; "--single-version-externally-managed" is set, thus the .egg-info directory
+;; and the scripts defined in entry-points will always be created.
+
+(define setuptools-shim
+ ;; Run setup.py with "setuptools" being imported, which will patch
+ ;; "distutils". This is needed for packages using "distutils" instead of
+ ;; "setuptools" since the former does not understand the
+ ;; "--single-version-externally-managed" flag.
+ ;; Python code taken from pip 9.0.1 pip/utils/setuptools_build.py
+ (string-append
+ "import setuptools, tokenize;__file__='setup.py';"
+ "f=getattr(tokenize, 'open', open)(__file__);"
+ "code=f.read().replace('\\r\\n', '\\n');"
+ "f.close();"
+ "exec(compile(code, __file__, 'exec'))"))
-(define (call-setuppy command params)
+(define (call-setuppy command params use-setuptools?)
(if (file-exists? "setup.py")
(begin
(format #t "running \"python setup.py\" with command ~s and parameters ~s~%"
command params)
- (zero? (apply system* "python" "setup.py" command params)))
+ (if use-setuptools?
+ (zero? (apply system* "python" "-c" setuptools-shim
+ command params))
+ (zero? (apply system* "python" "./setup.py" command params))))
(error "no setup.py found")))
-(define* (build #:rest empty)
+(define* (build #:key use-setuptools? #:allow-other-keys)
"Build a given Python package."
- (call-setuppy "build" '()))
+ (call-setuppy "build" '() use-setuptools?))
-(define* (check #:key tests? test-target #:allow-other-keys)
+(define* (check #:key tests? test-target use-setuptools? #:allow-other-keys)
"Run the test suite of a given Python package."
(if tests?
- (call-setuppy test-target '())
+ ;; Running `setup.py test` creates an additional .egg-info directory in
+ ;; build/lib in some cases, e.g. if the source is in a sub-directory
+ ;; (given with `package_dir`). This will by copied to the output, too,
+ ;; so we need to remove.
+ (let ((before (find-files "build" "\\.egg-info$" #:directories? #t)))
+ (call-setuppy test-target '() use-setuptools?)
+ (let* ((after (find-files "build" "\\.egg-info$" #:directories? #t))
+ (inter (lset-difference eqv? after before)))
+ (for-each delete-file-recursively inter)))
#t))
(define (get-python-version python)
@@ -60,25 +149,36 @@
(major+minor (take components 2)))
(string-join major+minor ".")))
-(define* (install #:key outputs inputs (configure-flags '())
+(define (site-packages inputs outputs)
+ "Return the path of the current output's Python site-package."
+ (let* ((out (assoc-ref outputs "out"))
+ (python (assoc-ref inputs "python")))
+ (string-append out "/lib/python"
+ (get-python-version python)
+ "/site-packages/")))
+
+(define (add-installed-pythonpath inputs outputs)
+ "Prepend the Python site-package of OUTPUT to PYTHONPATH. This is useful
+when running checks after installing the package."
+ (let ((old-path (getenv "PYTHONPATH"))
+ (add-path (site-packages inputs outputs)))
+ (setenv "PYTHONPATH"
+ (string-append add-path
+ (if old-path (string-append ":" old-path) "")))
+ #t))
+
+(define* (install #:key outputs (configure-flags '()) use-setuptools?
#:allow-other-keys)
"Install a given Python package."
(let* ((out (assoc-ref outputs "out"))
(params (append (list (string-append "--prefix=" out))
- configure-flags))
- (python-version (get-python-version (assoc-ref inputs "python")))
- (old-path (getenv "PYTHONPATH"))
- (add-path (string-append out "/lib/python" python-version
- "/site-packages/")))
- ;; create the module installation directory and add it to PYTHONPATH
- ;; to make setuptools happy
- (mkdir-p add-path)
- (setenv "PYTHONPATH"
- (string-append (if old-path
- (string-append old-path ":")
- "")
- add-path))
- (call-setuppy "install" params)))
+ (if use-setuptools?
+ ;; distutils does not accept these flags
+ (list "--single-version-externally-managed"
+ "--root=/")
+ '())
+ configure-flags)))
+ (call-setuppy "install" params use-setuptools?)))
(define* (wrap #:key inputs outputs #:allow-other-keys)
(define (list-of-files dir)
@@ -112,6 +212,9 @@
(define* (rename-pth-file #:key name inputs outputs #:allow-other-keys)
"Rename easy-install.pth to NAME.pth to avoid conflicts between packages
installed with setuptools."
+ ;; Even if the "easy-install.pth" is not longer created, we kept this phase.
+ ;; There still may be packages creating an "easy-install.pth" manually for
+ ;; some good reason.
(let* ((out (assoc-ref outputs "out"))
(python (assoc-ref inputs "python"))
(site-packages (string-append out "/lib/python"
@@ -137,8 +240,7 @@ installed with setuptools."
#t))
(define %standard-phases
- ;; 'configure' and 'build' phases are not needed. Everything is done during
- ;; 'install'.
+ ;; 'configure' phase is not needed.
(modify-phases gnu:%standard-phases
(add-after 'unpack 'ensure-no-mtimes-pre-1980 ensure-no-mtimes-pre-1980)
(delete 'configure)
diff --git a/guix/build/syscalls.scm b/guix/build/syscalls.scm
index 9386c0f5d0..2e37846ff0 100644
--- a/guix/build/syscalls.scm
+++ b/guix/build/syscalls.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2014, 2015, 2016 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2014, 2015, 2016, 2017 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2015 David Thompson <davet@gnu.org>
;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
;;;
@@ -1474,7 +1474,9 @@ always a positive integer."
;; ENOTTY is what we're after but 2012-and-earlier Linux versions
;; would return EINVAL instead in some cases:
;; <https://bugs.ruby-lang.org/issues/10494>.
- (if (or (= errno ENOTTY) (= errno EINVAL))
+ ;; Furthermore, some FUSE file systems like unionfs return ENOSYS for
+ ;; that ioctl.
+ (if (memv errno (list ENOTTY EINVAL ENOSYS))
(fall-back)
(apply throw args))))))