From: Ricardo Wurmus <rekado@elephly.net>
To: 26373@debbugs.gnu.org
Cc: Ricardo Wurmus <rekado@elephly.net>
Subject: bug#26373: [PATCH 3/6] import cran: Refactor "needs-zlib?".
Date: Wed, 5 Apr 2017 18:42:07 +0200 [thread overview]
Message-ID: <20170405164210.29428-3-rekado@elephly.net> (raw)
In-Reply-To: <20170405164210.29428-1-rekado@elephly.net>
* guix/import/cran.scm (tarball-files-match-pattern?): New procedure.
(needs-zlib?): Implement in terms of "tarball-files-match-pattern?".
---
guix/import/cran.scm | 25 +++++++++++++++----------
1 file changed, 15 insertions(+), 10 deletions(-)
diff --git a/guix/import/cran.scm b/guix/import/cran.scm
index 48ab7355d..be3b678cd 100644
--- a/guix/import/cran.scm
+++ b/guix/import/cran.scm
@@ -201,17 +201,16 @@ empty list when the FIELD cannot be found."
(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."
+(define (tarball-files-match-pattern? tarball regexp . file-patterns)
+ "Return #T if any of the files represented by FILE-PATTERNS in the TARBALL
+match the given REGEXP."
(call-with-temporary-directory
(lambda (dir)
- (let ((pattern (make-regexp "-lz")))
+ (let ((pattern (make-regexp regexp)))
(parameterize ((current-error-port (%make-void-port "rw+")))
- (system* "tar"
- "xf" tarball "-C" dir
- "--wildcards"
- "*/src/Makevars*" "*/src/configure*" "*/configure*"))
+ (apply system* "tar"
+ "xf" tarball "-C" dir
+ `("--wildcards" ,@file-patterns)))
(any (lambda (file)
(call-with-input-file file
(lambda (port)
@@ -220,10 +219,16 @@ contain a zlib linker flag."
(cond
((eof-object? line) #f)
((regexp-exec pattern line) #t)
- (else (loop)))))))
- #t)
+ (else (loop))))))))
(find-files dir))))))
+(define (needs-zlib? tarball)
+ "Return #T if any of the Makevars files in the src directory of the TARBALL
+contain a zlib linker flag."
+ (tarball-files-match-pattern?
+ tarball "-lz"
+ "*/src/Makevars*" "*/src/configure*" "*/configure*"))
+
(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."
--
2.12.2
next prev parent reply other threads:[~2017-04-05 16:43 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-05 16:40 bug#26373: Various improvements to the CRAN importer Ricardo Wurmus
2017-04-05 16:42 ` bug#26373: [PATCH 1/6] import cran: Exclude experiment packages in predicate "bioconductor-package?" Ricardo Wurmus
2017-04-05 16:42 ` bug#26373: [PATCH 2/6] import cran: Add predicate for Bioconductor experiment packages Ricardo Wurmus
2017-04-10 9:51 ` Ludovic Courtès
2017-04-10 13:50 ` Ricardo Wurmus
2017-04-10 21:34 ` Ludovic Courtès
2017-04-05 16:42 ` Ricardo Wurmus [this message]
2017-04-10 9:52 ` bug#26373: [PATCH 3/6] import cran: Refactor "needs-zlib?" Ludovic Courtès
2017-04-05 16:42 ` bug#26373: [PATCH 4/6] import cran: Check if pkg-config is needed Ricardo Wurmus
2017-04-10 9:52 ` Ludovic Courtès
2017-04-05 16:42 ` bug#26373: [PATCH 5/6] import cran: Ensure substring indices are valid Ricardo Wurmus
2017-04-10 9:52 ` Ludovic Courtès
2017-04-05 16:42 ` bug#26373: [PATCH 6/6] import cran: Skip updating when meta data cannot be downloaded Ricardo Wurmus
2017-04-10 9:55 ` Ludovic Courtès
2017-04-10 13:55 ` Ricardo Wurmus
2017-04-10 21:37 ` Ludovic Courtès
2017-05-16 19:48 ` Ricardo Wurmus
2017-04-10 9:50 ` bug#26373: [PATCH 1/6] import cran: Exclude experiment packages in predicate "bioconductor-package?" Ludovic Courtès
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170405164210.29428-3-rekado@elephly.net \
--to=rekado@elephly.net \
--cc=26373@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).