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: Ricardo Wurmus
Subject: bug#26273: [PATCH] import cran: Automatically add gfortran and zlib when needed.
Date: Tue, 28 Mar 2017 14:28:33 +0200
User-agent: mu4e 0.9.18; emacs 25.1.1

Ludovic Courtès <address@hidden> writes:

> 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.

I tried that, but it doesn’t work.  It returns a non-zero exit code when
only files with one of the endings are present (i.e. the patterns are
ANDed).

>> +(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.

Yes, it seems that you’re right.  I’ll push an updated version to master
in a few minutes.

Thanks for the review!

--
Ricardo





reply via email to

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