[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
02/07: import/utils: alist->package: Include properties.
From: |
guix-commits |
Subject: |
02/07: import/utils: alist->package: Include properties. |
Date: |
Thu, 29 Sep 2022 17:11:00 -0400 (EDT) |
civodul pushed a commit to branch master
in repository guix.
commit 61bd7bf4690329a10e0a1d3fd1425a73d1823576
Author: itd <itd@net.in.tum.de>
AuthorDate: Fri Sep 23 09:42:53 2022 +0200
import/utils: alist->package: Include properties.
* guix/import/utils.scm (alist->package): Process properties field in input
data and include it in the generated package.
* tests/import-utils.scm ("alist->package with properties"): New test.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
---
guix/import/utils.scm | 10 ++++++++++
tests/import-utils.scm | 19 +++++++++++++++++++
2 files changed, 29 insertions(+)
diff --git a/guix/import/utils.scm b/guix/import/utils.scm
index dd8c61b79a..977e1d5f95 100644
--- a/guix/import/utils.scm
+++ b/guix/import/utils.scm
@@ -444,10 +444,20 @@ specifications to look up and replace them with plain
symbols instead."
((key . value)
(list (symbol->keyword (string->symbol key)) value)))
arguments))
+ (define (process-properties properties)
+ (map (match-lambda
+ ((key . value)
+ (cons (string->symbol key) value)))
+ properties))
+
(package
(name (assoc-ref meta "name"))
(version (assoc-ref meta "version"))
(source (source-spec->object (assoc-ref meta "source")))
+ (properties
+ (or (and=> (assoc-ref meta "properties")
+ process-properties)
+ '()))
(build-system
(lookup-build-system-by-name
(string->symbol (assoc-ref meta "build-system"))))
diff --git a/tests/import-utils.scm b/tests/import-utils.scm
index 7c6c782917..c47348fc60 100644
--- a/tests/import-utils.scm
+++ b/tests/import-utils.scm
@@ -203,4 +203,23 @@
("license" . #f))))
(package-native-inputs (alist->package meta))))
+(test-assert "alist->package with properties"
+ (let* ((meta '(("name" . "hello")
+ ("version" . "2.10")
+ ("source" .
+ ;; Use a 'file://' URI so that we don't cause a download.
+ ,(string-append "file://"
+ (search-path %load-path "guix.scm")))
+ ("build-system" . "gnu")
+ ("properties" . (("hidden?" . #t)
+ ("upstream-name" . "hello-upstream")))
+ ("home-page" . "https://gnu.org")
+ ("synopsis" . "Say hi")
+ ("description" . "This package says hi.")
+ ("license" . "GPL-3.0+")))
+ (pkg (alist->package meta)))
+ (and (package? pkg)
+ (equal? (package-upstream-name pkg) "hello-upstream")
+ (hidden-package? pkg))))
+
(test-end "import-utils")
- branch master updated (e6777cfa5e -> 4244f5e9a7), guix-commits, 2022/09/29
- 04/07: gnu: Add lite-xl., guix-commits, 2022/09/29
- 01/07: services: shepherd: Leave the finalization thread in peace., guix-commits, 2022/09/29
- 03/07: import: print: Quasiquote properties, guix-commits, 2022/09/29
- 05/07: services: certbot: Create "live" directory during activation., guix-commits, 2022/09/29
- 07/07: news: Add entry for '--with-source'., guix-commits, 2022/09/29
- 06/07: transformations: '--with-source' now operates in depth., guix-commits, 2022/09/29
- 02/07: import/utils: alist->package: Include properties.,
guix-commits <=