From unknown Thu Aug 14 20:55:36 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#56541 <56541@debbugs.gnu.org> To: bug#56541 <56541@debbugs.gnu.org> Subject: Status: [PATCH] system: Add -I, --list-installed option. Reply-To: bug#56541 <56541@debbugs.gnu.org> Date: Fri, 15 Aug 2025 03:55:36 +0000 retitle 56541 [PATCH] system: Add -I, --list-installed option. reassign 56541 guix-patches submitter 56541 Antero Mejr severity 56541 normal tag 56541 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Wed Jul 13 11:01:54 2022 Received: (at submit) by debbugs.gnu.org; 13 Jul 2022 15:01:54 +0000 Received: from localhost ([127.0.0.1]:47507 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oBds9-0002MW-Gw for submit@debbugs.gnu.org; Wed, 13 Jul 2022 11:01:54 -0400 Received: from lists.gnu.org ([209.51.188.17]:43562) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oBds7-0002MO-94 for submit@debbugs.gnu.org; Wed, 13 Jul 2022 11:01:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49192) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oBds5-00070H-AV for guix-patches@gnu.org; Wed, 13 Jul 2022 11:01:50 -0400 Received: from mout-p-101.mailbox.org ([2001:67c:2050:0:465::101]:41122) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_CHACHA20_POLY1305:256) (Exim 4.90_1) (envelope-from ) id 1oBds1-0005lf-FN for guix-patches@gnu.org; Wed, 13 Jul 2022 11:01:48 -0400 Received: from smtp102.mailbox.org (smtp102.mailbox.org [IPv6:2001:67c:2050:b231:465::102]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-101.mailbox.org (Postfix) with ESMTPS id 4Ljgn55XDzz9sRk for ; Wed, 13 Jul 2022 17:01:29 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mailbox.org; s=mail20150812; t=1657724489; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=TojUPY3RDO+OzLt3rU0BFc3aHXnn92oA4Q7DfPmBifY=; b=lL4ui1faS8IBf25Dv/60v3du7FCI3a0vrUtmOdg1mBqjilwexxuoqT+JIa10kTeUOdpi53 GXpdP8yrpen2jmiEo94V/NKeMHuARvuGRwTltwNaqDCTuIZoUMg7GwZA+GOe3fIBr6GPjd yD5cdXn+m5LgyCdDunAxt5GJy53CLf1bsWuIuEPVyPuWyHtcrj5V+BYtHWP7JzxEc564dq NpmlPxQudaWMRvxTc7PVFPE/ve9uPK6JKvhM23wMONuUU0ZKlYUE11lEekQEgD9rsXKbQ4 x6+8WPP3LUDyGSz3LG+LtF5lBxDE/c7ODP5s+pqRGysb0CP7nVps9q1LP0iQRg== From: Antero Mejr To: guix-patches@gnu.org Subject: [PATCH] system: Add -I, --list-installed option. Date: Wed, 13 Jul 2022 15:01:22 +0000 Message-Id: <20220713150123.5395-1-antero@mailbox.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-MBO-RS-ID: 146af736058ac1e1ce2 X-MBO-RS-META: 7i9f6pt4x4xewp14qbq9gdifodmdo959 X-Rspamd-Queue-Id: 4Ljgn55XDzz9sRk Received-SPF: pass client-ip=2001:67c:2050:0:465::101; envelope-from=antero@mailbox.org; helo=mout-p-101.mailbox.org X-Spam_score_int: -23 X-Spam_score: -2.4 X-Spam_bar: -- X-Spam_report: (-2.4 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) * guix/scripts/system.scm: New flag -I, --list-installed. * doc/guix.texi (Invoking Guix System): Add information for --list-installed flag. --- Depends on patch 56238: https://issues.guix.gnu.org/56428 doc/guix.texi | 12 ++++++++ guix/scripts/system.scm | 61 +++++++++++++++++++++++++++++------------ 2 files changed, 55 insertions(+), 18 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index fc3a2d962d..3f3b480f4e 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -37647,6 +37647,13 @@ bootloader boot menu: Describe the running system generation: its file name, the kernel and bootloader used, etc., as well as provenance information when available. +The @code{--list-installed} flag is available, with the same +syntax that is used in @command{guix package --list-installed} +(@pxref{Invoking guix package}). When the flag is used, +the description will include a list of packages that are currently +installed in the system profile, with optional filtering based on a +regular expression. + @quotation Note The @emph{running} system generation---referred to by @file{/run/current-system}---is not necessarily the @emph{current} @@ -37674,6 +37681,11 @@ generations that are up to 10 days old: $ guix system list-generations 10d @end example +The @code{--list-installed} flag may also be specified, with the same +syntax that is used in @command{guix package --list-installed}. This +may be helpful if trying to determine when a package was added to the +system. + @end table The @command{guix system} command has even more to offer! The following diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm index b9084a401c..91a0a5302b 100644 --- a/guix/scripts/system.scm +++ b/guix/scripts/system.scm @@ -50,7 +50,8 @@ (define-module (guix scripts system) #:use-module (guix channels) #:use-module (guix scripts build) #:autoload (guix scripts package) (delete-generations - delete-matching-generations) + delete-matching-generations + list-installed) #:autoload (guix scripts pull) (channel-commit-hyperlink) #:autoload (guix graph) (export-graph node-type graph-backend-name lookup-backend) @@ -480,7 +481,8 @@ (define (shepherd-service-node-type services) ;;; (define* (display-system-generation number - #:optional (profile %system-profile)) + #:optional (profile %system-profile) + #:key (list-installed-regex #f)) "Display a summary of system generation NUMBER in a human-readable format." (define (display-channel channel) (format #t " ~a:~%" (channel-name channel)) @@ -544,23 +546,34 @@ (define-values (channels config-file) (format #t (G_ " configuration file: ~a~%") (if (supports-hyperlinks?) (file-hyperlink config-file) - config-file)))))) - -(define* (list-generations pattern #:optional (profile %system-profile)) + config-file))) + (when list-installed-regex + (format #t (G_ " packages:\n")) + (pretty-print-table (list-installed + list-installed-regex + (list (string-append generation "/profile"))) + #:left-pad 4))))) + +(define* (list-generations pattern #:optional (profile %system-profile) + #:key (list-installed-regex #f)) "Display in a human-readable format all the system generations matching PATTERN, a string. When PATTERN is #f, display all the system generations." (cond ((not (file-exists? profile)) ; XXX: race condition (raise (condition (&profile-not-found-error (profile profile))))) ((not pattern) - (for-each display-system-generation (profile-generations profile))) + (for-each (cut display-system-generation <> + #:list-installed-regex list-installed-regex) + (profile-generations profile))) ((matching-generations pattern profile) => (lambda (numbers) (if (null-list? numbers) (exit 1) (leave-on-EPIPE - (for-each display-system-generation numbers))))))) + (for-each (cut display-system-generation <> + #:list-installed-regex list-installed-regex) + numbers))))))) ;;; @@ -1032,6 +1045,11 @@ (define (show-help) use BACKEND for 'extension-graphs' and 'shepherd-graph'")) (newline) (display (G_ " + -I, --list-installed[=REGEXP] + for 'describe' and 'list-generations', list installed + packages matching REGEXP")) + (newline) + (display (G_ " -h, --help display this help and exit")) (display (G_ " -V, --version display version information and exit")) @@ -1135,6 +1153,9 @@ (define %options (option '("graph-backend") #t #f (lambda (opt name arg result) (alist-cons 'graph-backend arg result))) + (option '(#\I "list-installed") #f #t + (lambda (opt name arg result) + (alist-cons 'list-installed (or arg "") result))) %standard-build-options)) (define %default-options @@ -1322,25 +1343,29 @@ (define-syntax-rule (with-store* store exp ...) ;; The following commands do not need to use the store, and they do not need ;; an operating system configuration file. ((list-generations) - (let ((pattern (match args + (let ((list-installed-regex (assoc-ref opts 'list-installed)) + (pattern (match args (() #f) ((pattern) pattern) (x (leave (G_ "wrong number of arguments~%")))))) - (list-generations pattern))) + (list-generations pattern #:list-installed-regex list-installed-regex))) ((describe) ;; Describe the running system, which is not necessarily the current ;; generation. /run/current-system might point to ;; /var/guix/profiles/system-N-link, or it might point directly to ;; /gnu/store/…-system. Try both. - (match (generation-number "/run/current-system" %system-profile) - (0 - (match (generation-number %system-profile) - (0 - (leave (G_ "no system generation, nothing to describe~%"))) - (generation - (display-system-generation generation)))) - (generation - (display-system-generation generation)))) + (let ((list-installed-regex (assoc-ref opts 'list-installed))) + (match (generation-number "/run/current-system" %system-profile) + (0 + (match (generation-number %system-profile) + (0 + (leave (G_ "no system generation, nothing to describe~%"))) + (generation + (display-system-generation + generation #:list-installed-regex list-installed-regex)))) + (generation + (display-system-generation + generation #:list-installed-regex list-installed-regex))))) ((search) (apply (resolve-subcommand "search") args)) ((edit) -- 2.36.1 From debbugs-submit-bounces@debbugs.gnu.org Mon Jul 18 09:31:48 2022 Received: (at 56541-done) by debbugs.gnu.org; 18 Jul 2022 13:31:49 +0000 Received: from localhost ([127.0.0.1]:49549 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oDQqi-0005Dl-G4 for submit@debbugs.gnu.org; Mon, 18 Jul 2022 09:31:48 -0400 Received: from eggs.gnu.org ([209.51.188.92]:60376) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oDQqg-0005DU-Im for 56541-done@debbugs.gnu.org; Mon, 18 Jul 2022 09:31:47 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:37618) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oDQqZ-00074r-MU; Mon, 18 Jul 2022 09:31:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=GwLRBPiMgdqwEpwSu/AZoaCfbsqFHhp8TUHdjx6titk=; b=h3QrSaUjM665NnB0SITz zdwn3GlV0KCoRq/PY0NeBpTDcnomO66Q7zLckO9FMHq7L5EvZ5vFsLemBc4v0VU1kuedTPyBhQPPr tzFwlKsesR4JMViNn4uB+R9lzR4DbGR/Xrb4QGF9UtTkVatt8m9dKp5fyCIEKw077JpaXx5BQPyjK J98eACogbJGEYBLcJvfptVD3hnLLjMZHwojPWQMrzXLwomksWrhwUTWLHm61WgEups1oaQWOh1KSy U7aCNEzBs6g28jKNo7A8dGp8Cd1UttAjRkotRkxEaDZQUhGb6EubDz7PVXyzCNZ7IgxFznJ89Vgtu wpZTdyNnWbV80A==; Received: from [2001:660:6102:320:e120:2c8f:8909:cdfe] (port=41258 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oDQqZ-0006ob-9v; Mon, 18 Jul 2022 09:31:39 -0400 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Antero Mejr Subject: Re: bug#56541: [PATCH] system: Add -I, --list-installed option. References: <20220713150123.5395-1-antero@mailbox.org> Date: Mon, 18 Jul 2022 15:31:37 +0200 In-Reply-To: <20220713150123.5395-1-antero@mailbox.org> (Antero Mejr's message of "Wed, 13 Jul 2022 15:01:22 +0000") Message-ID: <87y1wqy2bq.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 56541-done Cc: 56541-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hi, Antero Mejr skribis: > * guix/scripts/system.scm: New flag -I, --list-installed. > * doc/guix.texi (Invoking Guix System): Add information for > --list-installed flag. Applied with the same kind of cosmetic changes as for =E2=80=98guix home=E2= =80=99. Thanks, Ludo=E2=80=99. From unknown Thu Aug 14 20:55:36 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Tue, 16 Aug 2022 11:24:06 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator