From patchwork Tue Sep 24 15:52:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 15456 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id A08881742D; Tue, 24 Sep 2019 17:55:06 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id 5802F1741F for ; Tue, 24 Sep 2019 17:55:06 +0100 (BST) Received: from localhost ([::1]:48470 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iCo5h-0007h2-4d for patchwork@mira.cbaines.net; Tue, 24 Sep 2019 12:55:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53769) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iCn7f-0006ku-IB for guix-patches@gnu.org; Tue, 24 Sep 2019 11:53:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iCn7e-0006WW-6I for guix-patches@gnu.org; Tue, 24 Sep 2019 11:53:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:59309) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iCn7e-0006WG-2z for guix-patches@gnu.org; Tue, 24 Sep 2019 11:53:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iCn7d-0007qz-Vt for guix-patches@gnu.org; Tue, 24 Sep 2019 11:53:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#37502] [PATCH] guix package: Add '--list-profiles'. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 24 Sep 2019 15:53:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 37502 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 37502@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.156934036130152 (code B ref -1); Tue, 24 Sep 2019 15:53:01 +0000 Received: (at submit) by debbugs.gnu.org; 24 Sep 2019 15:52:41 +0000 Received: from localhost ([127.0.0.1]:39897 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iCn7J-0007qG-6X for submit@debbugs.gnu.org; Tue, 24 Sep 2019 11:52:41 -0400 Received: from lists.gnu.org ([209.51.188.17]:42303) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iCn7F-0007q7-J9 for submit@debbugs.gnu.org; Tue, 24 Sep 2019 11:52:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53631) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iCn7D-00061L-60 for guix-patches@gnu.org; Tue, 24 Sep 2019 11:52:36 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:43512) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1iCn7C-0006HG-TJ; Tue, 24 Sep 2019 11:52:34 -0400 Received: from [2001:660:6102:320:e120:2c8f:8909:cdfe] (port=48726 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1iCn7C-0004Zv-D2; Tue, 24 Sep 2019 11:52:34 -0400 From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Tue, 24 Sep 2019 17:52:24 +0200 Message-Id: <20190924155224.20752-1-ludo@gnu.org> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * guix/scripts/package.scm (show-help, %options): Add '--list-profiles'. (process-query): Honor it. * tests/guix-package.sh: Add test. --- doc/guix.texi | 13 +++++++++++++ guix/scripts/package.scm | 21 +++++++++++++++++++++ tests/guix-package.sh | 6 +++++- 3 files changed, 39 insertions(+), 1 deletion(-) diff --git a/doc/guix.texi b/doc/guix.texi index 093199c63b..60187fcb1e 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -2937,6 +2937,19 @@ siblings that point to specific generations: $ rm ~/code/my-profile ~/code/my-profile-*-link @end example +@item --list-profiles +List all the user's profiles: + +@example +$ guix package --list-profiles +/home/charlie/.guix-profile +/home/charlie/code/my-profile +/home/charlie/code/devel-profile +/home/charlie/tmp/test +@end example + +When running as root, list all the profiles of all the users. + @cindex collisions, in a profile @cindex colliding packages in profiles @cindex profile collisions diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm index f03741aa9e..1a58d43e5c 100644 --- a/guix/scripts/package.scm +++ b/guix/scripts/package.scm @@ -39,6 +39,7 @@ #:use-module (guix scripts) #:use-module (guix scripts build) #:autoload (guix describe) (package-provenance) + #:autoload (guix store roots) (gc-roots) #:use-module ((guix build utils) #:select (directory-exists? mkdir-p)) #:use-module (ice-9 format) @@ -359,6 +360,8 @@ Install, remove, or upgrade packages in a single transaction.\n")) switch to a generation matching PATTERN")) (display (G_ " -p, --profile=PROFILE use PROFILE instead of the user's default profile")) + (display (G_ " + --list-profiles list the user's profiles")) (newline) (display (G_ " --allow-collisions do not treat collisions in the profile as an error")) @@ -458,6 +461,11 @@ command-line option~%") (values (cons `(query list-generations ,arg) result) #f))) + (option '("list-profiles") #f #f + (lambda (opt name arg result arg-handler) + (values (cons `(query list-profiles #t) + result) + #f))) (option '(#\d "delete-generations") #f #t (lambda (opt name arg result arg-handler) (values (alist-cons 'delete-generations arg @@ -750,6 +758,19 @@ processed, #f otherwise." (string "$module_dir/foo.scm"< /tmp/out test "`guix package -L "$module_dir" -s dummy-output | grep ^name:`" = "name: dummy-package" rm -rf "$module_dir" + +# Make sure we can see user profiles. +guix package --list-profiles | grep "$profile" +guix package --list-profiles | grep '\.guix-profile'