From 4a979afe1b320efcdb3236eb3c8e6c889eb73f38 Mon Sep 17 00:00:00 2001 From: Konrad Hinsen Date: Fri, 9 Feb 2018 20:33:12 +0100 Subject: pack: Add '--manifest'. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * guix/scripts/pack.scm (%options, show-help): Add --manifest. (guix-pack)[manifest-from-args]: New procedure. Use it. * doc/guix.texi (Invoking guix pack): Document --manifest. Signed-off-by: Ludovic Courtès --- guix/scripts/pack.scm | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'guix') diff --git a/guix/scripts/pack.scm b/guix/scripts/pack.scm index a22258d5a6..a1b839e9ae 100644 --- a/guix/scripts/pack.scm +++ b/guix/scripts/pack.scm @@ -2,6 +2,7 @@ ;;; Copyright © 2015, 2017 Ludovic Courtès ;;; Copyright © 2017 Efraim Flashner ;;; Copyright © 2017 Ricardo Wurmus +;;; Copyright © 2018 Konrad Hinsen ;;; ;;; This file is part of GNU Guix. ;;; @@ -292,6 +293,9 @@ (define %options (option '(#\e "expression") #t #f (lambda (opt name arg result) (alist-cons 'expression arg result))) + (option '(#\m "manifest") #t #f + (lambda (opt name arg result) + (alist-cons 'manifest arg result))) (option '(#\s "system") #t #f (lambda (opt name arg result) (alist-cons 'system arg @@ -344,6 +348,9 @@ (define (show-help) -C, --compression=TOOL compress using TOOL--e.g., \"lzip\"")) (display (G_ " -S, --symlink=SPEC create symlinks to the profile according to SPEC")) + (display (G_ " + -m, --manifest=FILE create a new profile generation with the manifest + from FILE")) (display (G_ " --localstatedir include /var/guix in the resulting pack")) (newline) @@ -375,10 +382,21 @@ (define maybe-package-argument (read/eval-package-expression exp)) (x #f))) + (define (manifest-from-args opts) + (let ((packages (filter-map maybe-package-argument opts)) + (manifest-file (assoc-ref opts 'manifest))) + (cond + ((and manifest-file (not (null? packages))) + (leave (G_ "both a manifest and a package list were given~%"))) + (manifest-file + (let ((user-module (make-user-module '((guix profiles) (gnu))))) + (load* manifest-file user-module))) + (else (packages->manifest packages))))) + (with-error-handling (parameterize ((%graft? (assoc-ref opts 'graft?))) (let* ((dry-run? (assoc-ref opts 'dry-run?)) - (packages (filter-map maybe-package-argument opts)) + (manifest (manifest-from-args opts)) (pack-format (assoc-ref opts 'format)) (name (string-append (symbol->string pack-format) "-pack")) @@ -397,7 +415,7 @@ (define maybe-package-argument (run-with-store store (mlet* %store-monad ((profile (profile-derivation - (packages->manifest packages) + manifest #:target target)) (drv (build-image name profile #:target -- cgit v1.2.3 From 06a9dc2fd021258da282e14d165d53090d85ffe1 Mon Sep 17 00:00:00 2001 From: Oleg Pykhalov Date: Sun, 11 Feb 2018 11:16:56 +0300 Subject: union: Wrap collisions with newlines. * guix/build/union.scm (union-build): Wrap collisions with newlines. --- guix/build/union.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'guix') diff --git a/guix/build/union.scm b/guix/build/union.scm index 256123c566..d46b750035 100644 --- a/guix/build/union.scm +++ b/guix/build/union.scm @@ -93,7 +93,7 @@ (define (resolve-collisions output dirs files) (cond ((null? dirs) ;; The inputs are all files. (format (current-error-port) - "warning: collision encountered: ~{~a ~}~%" + "~%warning: collision encountered:~%~{~a~%~}" files) (let ((file (first files))) -- cgit v1.2.3 From 485d355cad9dd598eb92ad4b1ca42dd0d68cc484 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Thu, 15 Feb 2018 22:23:20 +0100 Subject: pack: Adjust '--manifest' documentation. Reported by Konrad Hinsen . * guix/scripts/pack.scm (show-help): Adjust --manifest documentation. --- guix/scripts/pack.scm | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'guix') diff --git a/guix/scripts/pack.scm b/guix/scripts/pack.scm index a1b839e9ae..59dd117edb 100644 --- a/guix/scripts/pack.scm +++ b/guix/scripts/pack.scm @@ -349,8 +349,7 @@ (define (show-help) (display (G_ " -S, --symlink=SPEC create symlinks to the profile according to SPEC")) (display (G_ " - -m, --manifest=FILE create a new profile generation with the manifest - from FILE")) + -m, --manifest=FILE create a pack with the manifest from FILE")) (display (G_ " --localstatedir include /var/guix in the resulting pack")) (newline) -- cgit v1.2.3 From 5e2495d09e5ad78f8ebb6bfa6fb4ff09fb305ec4 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Fri, 16 Feb 2018 11:06:31 +0100 Subject: import: utils: 'alist->package' allows false license. Reported by . Fixes . * guix/import/utils.scm (alist->package): Check whether 'license' is false and set the 'license' field to #f in this case. * tests/import-utils.scm ("alist->package with false license"): New test. --- guix/import/utils.scm | 12 +++++++----- tests/import-utils.scm | 19 +++++++++++++++++++ 2 files changed, 26 insertions(+), 5 deletions(-) (limited to 'guix') diff --git a/guix/import/utils.scm b/guix/import/utils.scm index d4cef6b503..efc6169077 100644 --- a/guix/import/utils.scm +++ b/guix/import/utils.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2012, 2013 Ludovic Courtès +;;; Copyright © 2012, 2013, 2018 Ludovic Courtès ;;; Copyright © 2016 Jelle Licht ;;; Copyright © 2016 David Craven ;;; Copyright © 2017 Ricardo Wurmus @@ -330,10 +330,12 @@ (define (alist->package meta) (description (assoc-ref meta "description")) (license - (let ((l (assoc-ref meta "license"))) - (or (module-ref (resolve-interface '(guix licenses) #:prefix 'license:) - (spdx-string->license l)) - (license:fsdg-compatible l)))))) + (match (assoc-ref meta "license") + (#f #f) + (l + (or (module-ref (resolve-interface '(guix licenses) #:prefix 'license:) + (spdx-string->license l)) + (license:fsdg-compatible l))))))) (define* (read-lines #:optional (port (current-input-port))) "Read lines from PORT and return them as a list." diff --git a/tests/import-utils.scm b/tests/import-utils.scm index f4bbd335b9..5c0c041360 100644 --- a/tests/import-utils.scm +++ b/tests/import-utils.scm @@ -79,4 +79,23 @@ (define-module (test-import-utils) (equal? (origin-sha256 (package-source pkg)) (base32 "0ssi1wpaf7plaswqqjwigppsg5fyh99vdlb9kzl7c9lng89ndq1i"))))) +(test-equal "alist->package with false license" ; + 'license-is-false + (let* ((meta '(("name" . "hello") + ("version" . "2.10") + ("source" . (("method" . "url-fetch") + ("uri" . "mirror://gnu/hello/hello-2.10.tar.gz") + ("sha256" . + (("base32" . + "0ssi1wpaf7plaswqqjwigppsg5fyh99vdlb9kzl7c9lng89ndq1i"))))) + ("build-system" . "gnu") + ("home-page" . "https://gnu.org") + ("synopsis" . "Say hi") + ("description" . "This package says hi.") + ("license" . #f)))) + ;; Note: Use 'or' because comparing with #f otherwise succeeds when + ;; there's an exception instead of an actual #f. + (or (package-license (alist->package meta)) + 'license-is-false))) + (test-end "import-utils") -- cgit v1.2.3