From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50205) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1csp6b-0000qc-Ds for guix-patches@gnu.org; Tue, 28 Mar 2017 07:16:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1csp6Y-0005QK-4x for guix-patches@gnu.org; Tue, 28 Mar 2017 07:16:05 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:50364) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1csp6X-0005QG-TH for guix-patches@gnu.org; Tue, 28 Mar 2017 07:16:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1csp6X-0001lE-Pb for guix-patches@gnu.org; Tue, 28 Mar 2017 07:16:01 -0400 Subject: bug#26273: [PATCH] import cran: Automatically add gfortran and zlib when needed. Resent-Message-ID: From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) References: <20170327105313.10136-1-ricardo.wurmus@mdc-berlin.de> Date: Tue, 28 Mar 2017 13:15:11 +0200 In-Reply-To: <20170327105313.10136-1-ricardo.wurmus@mdc-berlin.de> (Ricardo Wurmus's message of "Mon, 27 Mar 2017 12:53:13 +0200") Message-ID: <87o9wl64ao.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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: Ricardo Wurmus Cc: 26273@debbugs.gnu.org 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. > +(define (needs-zlib? tarball) > + "Return #T if any of the Makevars files in the src directory of the TA= RBALL > +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 =E2=80=9C--wildcards=E2=80=9D needs only appear once. Otherwise LGTM, nice improvement! Thanks, Ludo=E2=80=99.