summaryrefslogtreecommitdiff
path: root/guix/packages.scm
diff options
context:
space:
mode:
authorMark H Weaver <mhw@netris.org>2015-06-10 17:50:27 -0400
committerMark H Weaver <mhw@netris.org>2015-06-10 17:50:27 -0400
commit14928016556300a6763334d4279c3d117902caaf (patch)
treed0dc262b14164b82f97dd6e896ca9e93a1fabeea /guix/packages.scm
parent1511e0235525358abb52cf62abeb9457605b5093 (diff)
parent57cd353d87d6e9e6e882327be70b4d7b5ce863ba (diff)
Merge branch 'master' into core-updates
Diffstat (limited to 'guix/packages.scm')
-rw-r--r--guix/packages.scm53
1 files changed, 27 insertions, 26 deletions
diff --git a/guix/packages.scm b/guix/packages.scm
index d5bf6dbf65..cbe6127f28 100644
--- a/guix/packages.scm
+++ b/guix/packages.scm
@@ -26,6 +26,7 @@
#:use-module (guix base32)
#:use-module (guix derivations)
#:use-module (guix build-system)
+ #:use-module (guix search-paths)
#:use-module (guix gexp)
#:use-module (ice-9 match)
#:use-module (ice-9 vlist)
@@ -36,7 +37,8 @@
#:use-module (srfi srfi-34)
#:use-module (srfi srfi-35)
#:re-export (%current-system
- %current-target-system)
+ %current-target-system
+ search-path-specification) ;for convenience
#:export (origin
origin?
origin-uri
@@ -52,11 +54,6 @@
origin-imported-modules
base32
- <search-path-specification>
- search-path-specification
- search-path-specification?
- search-path-specification->sexp
-
package
package?
package-name
@@ -82,6 +79,8 @@
package-location
package-field-location
+ package-direct-sources
+ package-transitive-sources
package-direct-inputs
package-transitive-inputs
package-transitive-target-inputs
@@ -186,26 +185,6 @@ representation."
((_ str)
#'(nix-base32-string->bytevector str)))))
-;; The specification of a search path.
-(define-record-type* <search-path-specification>
- search-path-specification make-search-path-specification
- search-path-specification?
- (variable search-path-specification-variable) ;string
- (files search-path-specification-files) ;list of strings
- (separator search-path-specification-separator ;string
- (default ":"))
- (file-type search-path-specification-file-type ;symbol
- (default 'directory))
- (file-pattern search-path-specification-file-pattern ;#f | string
- (default #f)))
-
-(define (search-path-specification->sexp spec)
- "Return an sexp representing SPEC, a <search-path-specification>. The sexp
-corresponds to the arguments expected by `set-path-environment-variable'."
- (match spec
- (($ <search-path-specification> variable files separator type pattern)
- `(,variable ,files ,separator ,type ,pattern))))
-
(define %supported-systems
;; This is the list of system types that are supported. By default, we
;; expect all packages to build successfully here.
@@ -527,6 +506,28 @@ IMPORTED-MODULES specify modules to use/import for use by SNIPPET."
((input rest ...)
(loop rest (cons input result))))))
+(define (package-direct-sources package)
+ "Return all source origins associated with PACKAGE; including origins in
+PACKAGE's inputs."
+ `(,@(or (and=> (package-source package) list) '())
+ ,@(filter-map (match-lambda
+ ((_ (? origin? orig) _ ...)
+ orig)
+ (_ #f))
+ (package-direct-inputs package))))
+
+(define (package-transitive-sources package)
+ "Return PACKAGE's direct sources, and their direct sources, recursively."
+ (delete-duplicates
+ (concatenate (filter-map (match-lambda
+ ((_ (? origin? orig) _ ...)
+ (list orig))
+ ((_ (? package? p) _ ...)
+ (package-direct-sources p))
+ (_ #f))
+ (bag-transitive-inputs
+ (package->bag package))))))
+
(define (package-direct-inputs package)
"Return all the direct inputs of PACKAGE---i.e, its direct inputs along
with their propagated inputs."