summaryrefslogtreecommitdiff
path: root/guix/upstream.scm
diff options
context:
space:
mode:
authorMarius Bakke <mbakke@fastmail.com>2017-09-27 21:14:27 +0200
committerMarius Bakke <mbakke@fastmail.com>2017-09-27 21:14:27 +0200
commit9f1d112d1282216f16b2f673c8213d2839e39b7a (patch)
tree890d036d75ae0d38ebff39a4be000959e71409ec /guix/upstream.scm
parent859620e51db0b7ffb666cd47146eca4fd4d6ba63 (diff)
parentcb1e0cfc2f32e6811da588231497d896491ceabb (diff)
downloadguix-patches-9f1d112d1282216f16b2f673c8213d2839e39b7a.tar
guix-patches-9f1d112d1282216f16b2f673c8213d2839e39b7a.tar.gz
Merge branch 'master' into staging
Diffstat (limited to 'guix/upstream.scm')
-rw-r--r--guix/upstream.scm19
1 files changed, 19 insertions, 0 deletions
diff --git a/guix/upstream.scm b/guix/upstream.scm
index 5083e6b805..6ad52ac960 100644
--- a/guix/upstream.scm
+++ b/guix/upstream.scm
@@ -45,6 +45,7 @@
upstream-source-signature-urls
upstream-source-archive-types
+ url-prefix-predicate
coalesce-sources
upstream-updater
@@ -81,6 +82,24 @@
(signature-urls upstream-source-signature-urls ;#f | list of strings
(default #f)))
+(define (url-prefix-predicate prefix)
+ "Return a predicate that returns true when passed a package where one of its
+source URLs starts with PREFIX."
+ (lambda (package)
+ (define matching-uri?
+ (match-lambda
+ ((? string? uri)
+ (string-prefix? prefix uri))
+ (_
+ #f)))
+
+ (match (package-source package)
+ ((? origin? origin)
+ (match (origin-uri origin)
+ ((? matching-uri?) #t)
+ (_ #f)))
+ (_ #f))))
+
(define (upstream-source-archive-types release)
"Return the available types of archives for RELEASE---a list of strings such
as \"gz\" or \"xz\"."