From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39397) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1csqFG-0004DG-7q for guix-patches@gnu.org; Tue, 28 Mar 2017 08:29:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1csqFC-0001kK-TB for guix-patches@gnu.org; Tue, 28 Mar 2017 08:29:06 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:50428) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1csqFC-0001kA-Pt for guix-patches@gnu.org; Tue, 28 Mar 2017 08:29:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1csqFC-0005JO-GW for guix-patches@gnu.org; Tue, 28 Mar 2017 08:29:02 -0400 Subject: bug#26273: [PATCH] import cran: Automatically add gfortran and zlib when needed. Resent-Message-ID: References: <20170327105313.10136-1-ricardo.wurmus@mdc-berlin.de> <87o9wl64ao.fsf@gnu.org> From: Ricardo Wurmus In-Reply-To: <87o9wl64ao.fsf@gnu.org> Date: Tue, 28 Mar 2017 14:28:33 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 26273@debbugs.gnu.org Ludovic Courtès writes: > Ricardo Wurmus 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