guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#26273: [PATCH] import cran: Automatically add gfortran and zlib when


From: Ludovic Courtès
Subject: bug#26273: [PATCH] import cran: Automatically add gfortran and zlib when needed.
Date: Tue, 28 Mar 2017 13:15:11 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)

Ricardo Wurmus <address@hidden> skribis:

> * guix/import/cran.scm (needs-fortran?, needs-zlib?): New procedures.
> (description->package): Use them.

[...]

> +(define (needs-fortran? tarball)
> +  "Check if the TARBALL contains Fortran source files."
> +  (define (check pattern)
> +    (parameterize ((current-error-port (%make-void-port "rw+")))
> +      (zero? (system* "tar" "--wildcards" "--list" pattern "-f" tarball))))
> +  (or (check "*.f90")
> +      (check "*.f95")
> +      (check "*.f")))

I think we can use:

  tar --list -f tarball --wildcards *.f90 *.f95 *.f

If that works, it would allow us to get test everything in one run.

> +(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*"
> +                  "--wildcards" "*/src/configure*"
> +                  "--wildcards" "*/configure*"))

IIUC “--wildcards” needs only appear once.

Otherwise LGTM, nice improvement!

Thanks,
Ludo’.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]