From bdb59b331bac0dea4a75b055334313ddc7bfecc8 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Tue, 28 Mar 2017 09:50:28 +0200 Subject: derivations: Do not fetch narinfos for non-substitutable items. This avoids connections to substitute servers for derivations that are not substitutable anyway, such as profiles. Reported by Andy Wingo. * guix/derivations.scm (substitution-oracle): Skip derivations that do not pass 'substitutable-derivation?'. * tests/derivations.scm ("substitution-oracle and #:substitute? #f"): New test. --- guix/derivations.scm | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'guix') 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 @@ (define (dependencies drv) ;; 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 @@ (define (dependencies drv) paths)))) (cond ((eqv? mode (build-mode check)) (cons (dependencies drv) result)) + ((not (substitutable-derivation? drv)) + (cons (dependencies drv) result)) ((every valid? self) result) (else -- cgit v1.2.3 From 6dfd683dc742ebb80983137f80a457af38ca7d8d Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Tue, 28 Mar 2017 13:27:56 +0200 Subject: download: Properly parse ftp:// URLs that lack user info. Fixes a regression introduced in a4f542341511f33ece18d16b68118214da8143ec. Reported by Hartmut Goebel. * guix/build/download.scm (ftp-fetch): Account for the case where 'uri-userinfo' returns #f. Remove the case where it returns "" since that cannot happen. --- guix/build/download.scm | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'guix') 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 @@ (define (nar-uri-abbreviation uri) (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)) -- cgit v1.2.3 From 2dca8b2d513db69aed3790096bc75c7c096b920c Mon Sep 17 00:00:00 2001 From: Ricardo Wurmus Date: Mon, 27 Mar 2017 12:53:13 +0200 Subject: import cran: Automatically add gfortran and zlib when needed. * guix/import/cran.scm (needs-fortran?, needs-zlib?): New procedures. (description->package): Use them. --- guix/import/cran.scm | 48 +++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 45 insertions(+), 3 deletions(-) (limited to 'guix') diff --git a/guix/import/cran.scm b/guix/import/cran.scm index 7521a39bc9..0d3ce5aa2d 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 +;;; Copyright © 2015, 2016, 2017 Ricardo Wurmus ;;; Copyright © 2015, 2016, 2017 Ludovic Courtès ;;; ;;; 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 @@ (define-module (guix import cran) #: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 @@ (define (guix-name name) (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 @@ (define (description->package repository meta) ((? 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 @@ (define (description->package repository meta) (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)) -- cgit v1.2.3 From 1a75083b0d532d9874ea073aa16a8c63d0fec685 Mon Sep 17 00:00:00 2001 From: Ricardo Wurmus Date: Tue, 28 Mar 2017 15:54:10 +0200 Subject: import cran: Print package stream in the expected order. * guix/scripts/import/cran.scm (guix-import-cran): Reverse list of packages. --- guix/scripts/import/cran.scm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'guix') 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 -;;; Copyright © 2015 Ricardo Wurmus +;;; Copyright © 2015, 2017 Ricardo Wurmus ;;; ;;; This file is part of GNU Guix. ;;; @@ -99,8 +99,8 @@ (define (parse-options) `(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)))) -- cgit v1.2.3 From e1f02f92e90dac57431c3a0c557162fe1d5e9192 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Tue, 28 Mar 2017 17:12:20 +0200 Subject: Replace (compose not PROC) with simpler idioms. * gnu/packages/bioinformatics.scm (python-pysam)[arguments] : Use (negate proc) instead of (compose not proc). * guix/import/cran.scm (recursive-import): Likewise. * guix/import/elpa.scm (filter-dependencies): Use 'remove' instead of '(filter (compose not proc) ...)'. --- gnu/packages/bioinformatics.scm | 2 +- guix/import/cran.scm | 2 +- guix/import/elpa.scm | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'guix') diff --git a/gnu/packages/bioinformatics.scm b/gnu/packages/bioinformatics.scm index 232c7db838..477ad60f71 100644 --- a/gnu/packages/bioinformatics.scm +++ b/gnu/packages/bioinformatics.scm @@ -1454,7 +1454,7 @@ (define-public python-pysam (getenv "PYTHONPATH") ":" (getcwd) "/build/" (car (scandir "build" - (compose not (cut string-prefix? "." <>)))))) + (negate (cut string-prefix? "." <>)))))) ;; Step out of source dir so python does not import from CWD. (with-directory-excursion "tests" (setenv "HOME" "/tmp") diff --git a/guix/import/cran.scm b/guix/import/cran.scm index 0d3ce5aa2d..a5f91fe8d2 100644 --- a/guix/import/cran.scm +++ b/guix/import/cran.scm @@ -336,7 +336,7 @@ (define* (recursive-import package-name #:optional (repo 'cran)) (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 @@ (define emacs-standard-library? (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." -- cgit v1.2.3