diff options
| author | zimoun <zimon.toutoune@gmail.com> | 2020-05-21 23:43:06 +0200 |
|---|---|---|
| committer | Ludovic Courtès <ludo@gnu.org> | 2020-05-23 16:29:29 +0200 |
| commit | 881eaae1abe39ea324ea9c757e84d15eb30f869f (patch) | |
| tree | 3e60f598c60bc11ceb17da53887d10c6229e6a2e | |
| parent | 197c07a84767ac885ae2cf1300e0933efe424431 (diff) | |
guix package: Support multiple profiles with '--list-installed'.
* guix/scripts/package.scm (process-query): List installed multiple profiles.
* tests/guix-package-net.sh: Test it.
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
| -rw-r--r-- | guix/scripts/package.scm | 20 | ||||
| -rw-r--r-- | tests/guix-package-net.sh | 12 |
2 files changed, 23 insertions, 9 deletions
diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm index a69efa365e0..1246147798c 100644 --- a/guix/scripts/package.scm +++ b/guix/scripts/package.scm | |||
| @@ -675,12 +675,13 @@ doesn't need it." | |||
| 675 | (define (process-query opts) | 675 | (define (process-query opts) |
| 676 | "Process any query specified by OPTS. Return #t when a query was actually | 676 | "Process any query specified by OPTS. Return #t when a query was actually |
| 677 | processed, #f otherwise." | 677 | processed, #f otherwise." |
| 678 | (let* ((profiles (match (filter-map (match-lambda | 678 | (let* ((profiles (delete-duplicates |
| 679 | (('profile . p) p) | 679 | (match (filter-map (match-lambda |
| 680 | (_ #f)) | 680 | (('profile . p) p) |
| 681 | opts) | 681 | (_ #f)) |
| 682 | (() (list %current-profile)) | 682 | opts) |
| 683 | (lst (reverse lst)))) | 683 | (() (list %current-profile)) |
| 684 | (lst (reverse lst))))) | ||
| 684 | (profile (match profiles | 685 | (profile (match profiles |
| 685 | ((head tail ...) head)))) | 686 | ((head tail ...) head)))) |
| 686 | (match (assoc-ref opts 'query) | 687 | (match (assoc-ref opts 'query) |
| @@ -718,7 +719,8 @@ processed, #f otherwise." | |||
| 718 | 719 | ||
| 719 | (('list-installed regexp) | 720 | (('list-installed regexp) |
| 720 | (let* ((regexp (and regexp (make-regexp* regexp regexp/icase))) | 721 | (let* ((regexp (and regexp (make-regexp* regexp regexp/icase))) |
| 721 | (manifest (profile-manifest profile)) | 722 | (manifest (concatenate-manifests |
| 723 | (map profile-manifest profiles))) | ||
| 722 | (installed (manifest-entries manifest))) | 724 | (installed (manifest-entries manifest))) |
| 723 | (leave-on-EPIPE | 725 | (leave-on-EPIPE |
| 724 | (for-each (match-lambda | 726 | (for-each (match-lambda |
| @@ -729,8 +731,8 @@ processed, #f otherwise." | |||
| 729 | name (or version "?") output path)))) | 731 | name (or version "?") output path)))) |
| 730 | 732 | ||
| 731 | ;; Show most recently installed packages last. | 733 | ;; Show most recently installed packages last. |
| 732 | (reverse installed))) | 734 | (reverse installed)))) |
| 733 | #t)) | 735 | #t) |
| 734 | 736 | ||
| 735 | (('list-available regexp) | 737 | (('list-available regexp) |
| 736 | (let* ((regexp (and regexp (make-regexp* regexp regexp/icase))) | 738 | (let* ((regexp (and regexp (make-regexp* regexp regexp/icase))) |
diff --git a/tests/guix-package-net.sh b/tests/guix-package-net.sh index 48a94865e11..3876701fa21 100644 --- a/tests/guix-package-net.sh +++ b/tests/guix-package-net.sh | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | # GNU Guix --- Functional package management for GNU | 1 | # GNU Guix --- Functional package management for GNU |
| 2 | # Copyright © 2012, 2013, 2014, 2015, 2017, 2019 Ludovic Courtès <ludo@gnu.org> | 2 | # Copyright © 2012, 2013, 2014, 2015, 2017, 2019 Ludovic Courtès <ludo@gnu.org> |
| 3 | # Copyright © 2013 Nikita Karetnikov <nikita@karetnikov.org> | 3 | # Copyright © 2013 Nikita Karetnikov <nikita@karetnikov.org> |
| 4 | # Copyright © 2020 Simon Tournier <zimon.toutoune@gmail.com> | ||
| 4 | # | 5 | # |
| 5 | # This file is part of GNU Guix. | 6 | # This file is part of GNU Guix. |
| 6 | # | 7 | # |
| @@ -78,6 +79,17 @@ esac | |||
| 78 | 79 | ||
| 79 | test "`guix package -p "$profile" -I 'g.*e' | cut -f1`" = "guile-bootstrap" | 80 | test "`guix package -p "$profile" -I 'g.*e' | cut -f1`" = "guile-bootstrap" |
| 80 | 81 | ||
| 82 | guix package --bootstrap -p "$profile_alt" -i gcc-bootstrap | ||
| 83 | installed="`guix package -p "$profile" -p "$profile_alt" -I | cut -f1 | xargs echo | sort`" | ||
| 84 | case "x$installed" in | ||
| 85 | "gcc-bootstrap guile-bootstrap make-boot0") | ||
| 86 | true;; | ||
| 87 | "*") | ||
| 88 | false;; | ||
| 89 | esac | ||
| 90 | test "`guix package -p "$profile_alt" -p "$profile" -I | wc -l`" = "3" | ||
| 91 | rm "$profile_alt" | ||
| 92 | |||
| 81 | # List generations. | 93 | # List generations. |
| 82 | test "`guix package -p "$profile" -l | cut -f1 | grep guile | head -n1`" \ | 94 | test "`guix package -p "$profile" -l | cut -f1 | grep guile | head -n1`" \ |
| 83 | = " guile-bootstrap" | 95 | = " guile-bootstrap" |
