From patchwork Mon Mar 15 15:45:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xinglu Chen X-Patchwork-Id: 27724 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 4853127BC54; Mon, 15 Mar 2021 15:53:01 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS, T_DKIM_INVALID,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 0097327BC52 for ; Mon, 15 Mar 2021 15:53:01 +0000 (GMT) Received: from localhost ([::1]:48488 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lLpWe-0007tZ-7L for patchwork@mira.cbaines.net; Mon, 15 Mar 2021 11:53:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47720) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lLpQv-0002QQ-9R for guix-patches@gnu.org; Mon, 15 Mar 2021 11:47:05 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:53132) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lLpQr-0000Lq-V5 for guix-patches@gnu.org; Mon, 15 Mar 2021 11:47:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lLpQr-0006ro-Sz for guix-patches@gnu.org; Mon, 15 Mar 2021 11:47:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#47163] [PATCH] refresh: Add '--installed' option. Resent-From: Xinglu Chen Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 15 Mar 2021 15:47:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 47163 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 47163@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.161582317626328 (code B ref -1); Mon, 15 Mar 2021 15:47:01 +0000 Received: (at submit) by debbugs.gnu.org; 15 Mar 2021 15:46:16 +0000 Received: from localhost ([127.0.0.1]:36445 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lLpQ8-0006qX-6z for submit@debbugs.gnu.org; Mon, 15 Mar 2021 11:46:16 -0400 Received: from lists.gnu.org ([209.51.188.17]:36566) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lLpQ3-0006qJ-6W for submit@debbugs.gnu.org; Mon, 15 Mar 2021 11:46:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47440) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lLpQ2-0001OI-Qk for guix-patches@gnu.org; Mon, 15 Mar 2021 11:46:10 -0400 Received: from h87-96-130-155.cust.a3fiber.se ([87.96.130.155]:52908 helo=mail.yoctocell.xyz) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lLpPv-0008TR-8M for guix-patches@gnu.org; Mon, 15 Mar 2021 11:46:06 -0400 From: Xinglu Chen DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yoctocell.xyz; s=mail; t=1615823154; bh=7by7PDfYwU6k12FXWpqwuxbYnE8fOY1+fJ5xN7m1fwo=; h=From:To:Subject:Date; b=JO4ft8O51LZcwGn4YcIu+6gSJh1PFsdHjxx8/tEhOM9DLV/4Kz0RJzHh5idhECL7D iLk5kgs5kixPJjeuUy08RnORTvIHF67lGIV6IQuFE73Nnm/gkzibI7gmfk9wK5/wMy DzX4z/YLqwO45OcUW3kuxNx2jdMIGCJde/eiqUa8= Message-Id: Date: Mon, 15 Mar 2021 16:45:54 +0100 MIME-Version: 1.0 Received-SPF: pass client-ip=87.96.130.155; envelope-from=public@yoctocell.xyz; helo=mail.yoctocell.xyz X-Spam_score_int: 14 X-Spam_score: 1.4 X-Spam_bar: + X-Spam_report: (1.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FROM_SUSPICIOUS_NTLD=0.499, FROM_SUSPICIOUS_NTLD_FP=0.001, PDS_OTHER_BAD_TLD=1.999, RDNS_DYNAMIC=0.982, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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 This lets the user to only check for updates for packages installed in the current profile. If the user is using the imperative way to install packages, or uses multiple manifests, this is a quick way to check for updates for the installed packages. * guix/scripts/refresh.scm (%options): Add '--installed' option. * guix.texi (Invoking guix refresh): Document it. --- doc/guix.texi | 5 +++++ guix/scripts/refresh.scm | 14 +++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) base-commit: 266d55dc3080475544bf45e72359c9b9bbcecd53 diff --git a/doc/guix.texi b/doc/guix.texi index 3e7ffc81bc..c778a877d8 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -11657,6 +11657,11 @@ Select all the packages from the manifest in @var{file}. This is useful to check if any packages of the user manifest can be updated. +@item --installed +@itemx -i +Select all the packages installed in the current profile. This is +useful to check if any of the packages the user is using can be updated. + @item --type=@var{updater} @itemx -t @var{updater} Select only packages handled by @var{updater} (may be a comma-separated diff --git a/guix/scripts/refresh.scm b/guix/scripts/refresh.scm index fb6c52a567..c1c672dc0b 100644 --- a/guix/scripts/refresh.scm +++ b/guix/scripts/refresh.scm @@ -86,6 +86,9 @@ (option '(#\m "manifest") #t #f (lambda (opt name arg result) (alist-cons 'manifest arg result))) + (option '(#\i "installed") #f #f + (lambda (opt name arg result) + (alist-cons 'installed #t result))) (option '(#\e "expression") #t #f (lambda (opt name arg result) (alist-cons 'expression arg result))) @@ -156,6 +159,9 @@ specified with `--select'.\n")) (display (G_ " -m, --manifest=FILE select all the packages from the manifest in FILE")) (display (G_ " + -i --installed select all the packages installed in the current + profile")) + (display (G_ " -t, --type=UPDATER,... restrict to updates from the specified updaters (e.g., 'gnu')")) (display (G_ " @@ -253,7 +259,13 @@ update would trigger a complete rebuild." (define packages (match (assoc-ref opts 'manifest) - (#f args-packages) + (#f (if (assoc-ref opts 'installed) + ;; All packages installed in current profile + (manifest->packages + (match (manifest->code (profile-manifest %current-profile)) + (('begin expr) (eval expr + (make-user-module '((gnu packages))))))) + args-packages)) ((? string? file) (packages-from-manifest file)))) (if (assoc-ref opts 'recursive?)