diff options
Diffstat (limited to 'guix/import/utils.scm')
-rw-r--r-- | guix/import/utils.scm | 48 |
1 files changed, 30 insertions, 18 deletions
diff --git a/guix/import/utils.scm b/guix/import/utils.scm index 64d1385164..d817318a91 100644 --- a/guix/import/utils.scm +++ b/guix/import/utils.scm @@ -7,6 +7,7 @@ ;;; Copyright © 2019 Robert Vollmert <rob@vllmrt.net> ;;; Copyright © 2020 Helio Machado <0x2b3bfa0+guix@googlemail.com> ;;; Copyright © 2020 Martin Becze <mjbecze@riseup.net> +;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com> ;;; ;;; This file is part of GNU Guix. ;;; @@ -57,6 +58,7 @@ package-names->package-inputs maybe-inputs maybe-native-inputs + maybe-propagated-inputs package->definition spdx-string->license @@ -169,6 +171,7 @@ of the string VERSION is replaced by the symbol 'version." ("Imlib2" 'license:imlib2) ("IPA" 'license:ipa) ("IPL-1.0" 'license:ibmpl1.0) + ("LAL-1.3" 'license:lal1.3) ("LGPL-2.0" 'license:lgpl2.0) ("LGPL-2.0+" 'license:lgpl2.0+) ("LGPL-2.1" 'license:lgpl2.1) @@ -246,27 +249,34 @@ use in an 'inputs' field of a package definition." (input (make-input input #f))) names)) -(define* (maybe-inputs package-names #:optional (output #f)) +(define* (maybe-inputs package-names #:optional (output #f) + #:key (type #f)) "Given a list of PACKAGE-NAMES, tries to generate the 'inputs' field of a -package definition." - (match (package-names->package-inputs package-names output) - (() - '()) - ((package-inputs ...) - `((inputs (,'quasiquote ,package-inputs)))))) +package definition. TYPE can be used to specify the type of the inputs; +either the 'native or 'propagated symbols are accepted. Left unspecified, the +snippet generated is for regular inputs." + (let ((field-name (match type + ('native 'native-inputs) + ('propagated 'propagated-inputs) + (_ 'inputs)))) + (match (package-names->package-inputs package-names output) + (() + '()) + ((package-inputs ...) + `((,field-name (,'quasiquote ,package-inputs))))))) (define* (maybe-native-inputs package-names #:optional (output #f)) - "Given a list of PACKAGE-NAMES, tries to generate the 'inputs' field of a -package definition." - (match (package-names->package-inputs package-names output) - (() - '()) - ((package-inputs ...) - `((native-inputs (,'quasiquote ,package-inputs)))))) + "Same as MAYBE-INPUTS, but for native inputs." + (maybe-inputs package-names output #:type 'native)) + +(define* (maybe-propagated-inputs package-names #:optional (output #f)) + "Same as MAYBE-INPUTS, but for propagated inputs." + (maybe-inputs package-names output #:type 'propagated)) (define* (package->definition guix-package #:optional append-version?/string) - "If APPEND-VERSION?/STRING is #t, append the package's major+minor -version. If APPEND-VERSION?/string is a string, append this string." + "If APPEND-VERSION?/STRING is #t, append the package's major+minor version. +If it is the symbol 'full, append the package's complete version. If +APPEND-VERSION?/string is a string, append this string." (match guix-package ((or ('package ('name name) ('version version) . rest) @@ -278,6 +288,8 @@ version. If APPEND-VERSION?/string is a string, append this string." (string-append name "-" append-version?/string)) ((eq? append-version?/string #t) (string-append name "-" (version-major+minor version))) + ((eq? 'full append-version?/string) + (string-append name "-" version)) (else name))) ,guix-package)))) @@ -437,8 +449,8 @@ obtain a node's uniquely identifying \"key\"." "Return a list of package expressions for PACKAGE-NAME and all its dependencies, sorted in topological order. For each package, call (REPO->GUIX-PACKAGE NAME :KEYS version repo), which should return a -package expression and a list of dependencies; call (GUIX-NAME NAME) to -obtain the Guix package name corresponding to the upstream name." +package expression and a list of dependencies; call (GUIX-NAME PACKAGE-NAME) +to obtain the Guix package name corresponding to the upstream name." (define-record-type <node> (make-node name version package dependencies) node? |