diff options
Diffstat (limited to 'guix')
-rw-r--r-- | guix/build/download.scm | 6 | ||||
-rw-r--r-- | guix/derivations.scm | 11 | ||||
-rw-r--r-- | guix/import/cran.scm | 50 | ||||
-rw-r--r-- | guix/import/elpa.scm | 2 | ||||
-rw-r--r-- | guix/scripts/import/cran.scm | 6 |
5 files changed, 62 insertions, 13 deletions
diff --git a/guix/build/download.scm b/guix/build/download.scm index c5dddf83de..e3d5244590 100644 --- a/guix/build/download.scm +++ b/guix/build/download.scm @@ -241,10 +241,8 @@ and 'guix publish', something like (define* (ftp-fetch uri file #:key timeout) "Fetch data from URI and write it to FILE. Return FILE on success. Bail out if the connection could not be established in less than TIMEOUT seconds." - (let* ((userinfo (string-split (uri-userinfo uri) #\:)) - (conn (match userinfo - (("") - (ftp-open (uri-host uri) #:timeout timeout)) + (let* ((conn (match (and=> (uri-userinfo uri) + (cut string-split <> #\:)) (((? string? user)) (ftp-open (uri-host uri) #:timeout timeout #:username user)) diff --git a/guix/derivations.scm b/guix/derivations.scm index e02d1ee036..0846d54fa5 100644 --- a/guix/derivations.scm +++ b/guix/derivations.scm @@ -293,7 +293,14 @@ substituter many times." ;; to ask the substituter for just as much as needed, instead of asking it ;; for the whole world, which can be significantly faster when substitute ;; info is not already in cache. - (append-map derivation-input-output-paths + ;; Also, skip derivations marked as non-substitutable. + (append-map (lambda (input) + (let ((drv (call-with-input-file + (derivation-input-path input) + read-derivation))) + (if (substitutable-derivation? drv) + (derivation-input-output-paths input) + '()))) (derivation-prerequisites drv valid-input?))) (let* ((paths (delete-duplicates @@ -304,6 +311,8 @@ substituter many times." paths)))) (cond ((eqv? mode (build-mode check)) (cons (dependencies drv) result)) + ((not (substitutable-derivation? drv)) + (cons (dependencies drv) result)) ((every valid? self) result) (else diff --git a/guix/import/cran.scm b/guix/import/cran.scm index 7521a39bc9..a5f91fe8d2 100644 --- a/guix/import/cran.scm +++ b/guix/import/cran.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2015, 2016 Ricardo Wurmus <rekado@elephly.net> +;;; Copyright © 2015, 2016, 2017 Ricardo Wurmus <rekado@elephly.net> ;;; Copyright © 2015, 2016, 2017 Ludovic Courtès <ludo@gnu.org> ;;; ;;; This file is part of GNU Guix. @@ -20,7 +20,7 @@ (define-module (guix import cran) #:use-module (ice-9 match) #:use-module (ice-9 regex) - #:use-module ((ice-9 rdelim) #:select (read-string)) + #:use-module ((ice-9 rdelim) #:select (read-string read-line)) #:use-module (srfi srfi-1) #:use-module (srfi srfi-26) #:use-module (srfi srfi-34) @@ -34,6 +34,8 @@ #:use-module (guix base32) #:use-module ((guix download) #:select (download-to-store)) #:use-module (guix import utils) + #:use-module ((guix build utils) #:select (find-files)) + #:use-module (guix utils) #:use-module ((guix build-system r) #:select (cran-uri bioconductor-uri)) #:use-module (guix upstream) #:use-module (guix packages) @@ -187,6 +189,39 @@ empty list when the FIELD cannot be found." (chr (char-downcase chr))) name))) +(define (needs-fortran? tarball) + "Check if the TARBALL contains Fortran source files." + (define (check pattern) + (parameterize ((current-error-port (%make-void-port "rw+")) + (current-output-port (%make-void-port "rw+"))) + (zero? (system* "tar" "--wildcards" "--list" pattern "-f" tarball)))) + (or (check "*.f90") + (check "*.f95") + (check "*.f"))) + +(define (needs-zlib? tarball) + "Return #T if any of the Makevars files in the src directory of the TARBALL +contain a zlib linker flag." + (call-with-temporary-directory + (lambda (dir) + (let ((pattern (make-regexp "-lz"))) + (parameterize ((current-error-port (%make-void-port "rw+"))) + (system* "tar" + "xf" tarball "-C" dir + "--wildcards" + "*/src/Makevars*" "*/src/configure*" "*/configure*")) + (any (lambda (file) + (call-with-input-file file + (lambda (port) + (let loop () + (let ((line (read-line port))) + (cond + ((eof-object? line) #f) + ((regexp-exec pattern line) #t) + (else (loop))))))) + #t) + (find-files dir)))))) + (define (description->package repository meta) "Return the `package' s-expression for an R package published on REPOSITORY from the alist META, which was derived from the R package's DESCRIPTION file." @@ -209,7 +244,9 @@ from the alist META, which was derived from the R package's DESCRIPTION file." ((? string? url) url) (_ #f))) (tarball (with-store store (download-to-store store source-url))) - (sysdepends (map string-downcase (listify meta "SystemRequirements"))) + (sysdepends (append + (if (needs-zlib? tarball) '("zlib") '()) + (map string-downcase (listify meta "SystemRequirements")))) (propagate (filter (lambda (name) (not (member name default-r-packages))) (lset-union equal? @@ -234,6 +271,11 @@ from the alist META, which was derived from the R package's DESCRIPTION file." (build-system r-build-system) ,@(maybe-inputs sysdepends) ,@(maybe-inputs (map guix-name propagate) 'propagated-inputs) + ,@(if (needs-fortran? tarball) + `((native-inputs (,'quasiquote + ,(list "gfortran" + (list 'unquote 'gfortran))))) + '()) (home-page ,(if (string-null? home-page) (string-append base-url name) home-page)) @@ -294,7 +336,7 @@ dependencies." (cran->guix-package (next state) repo)) ;; predicate - (compose not done?) + (negate done?) ;; generator: update the queue (lambda (state) diff --git a/guix/import/elpa.scm b/guix/import/elpa.scm index c0b0c415cf..b1003304d0 100644 --- a/guix/import/elpa.scm +++ b/guix/import/elpa.scm @@ -57,7 +57,7 @@ past were distributed separately from Emacs." (define (filter-dependencies names) "Remove the package names included with Emacs from the list of NAMES (strings)." - (filter (compose not emacs-standard-library?) names)) + (remove emacs-standard-library? names)) (define (elpa-name->package-name name) "Given the NAME of an Emacs package, return the corresponding Guix name." diff --git a/guix/scripts/import/cran.scm b/guix/scripts/import/cran.scm index 66c660ae14..c9a9eab762 100644 --- a/guix/scripts/import/cran.scm +++ b/guix/scripts/import/cran.scm @@ -1,6 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2014 Eric Bavier <bavier@member.fsf.org> -;;; Copyright © 2015 Ricardo Wurmus <rekado@elephly.net> +;;; Copyright © 2015, 2017 Ricardo Wurmus <rekado@elephly.net> ;;; ;;; This file is part of GNU Guix. ;;; @@ -99,8 +99,8 @@ Import and convert the CRAN package for PACKAGE-NAME.\n")) `(define-public ,(string->symbol name) ,pkg)) (_ #f)) - (stream->list (recursive-import package-name - (or (assoc-ref opts 'repo) 'cran)))) + (reverse (stream->list (recursive-import package-name + (or (assoc-ref opts 'repo) 'cran))))) ;; Single import (let ((sexp (cran->guix-package package-name (or (assoc-ref opts 'repo) 'cran)))) |