From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id iNa+D6dCMmSBRwEASxT56A (envelope-from ) for ; Sun, 09 Apr 2023 06:44:23 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id gO7cDqdCMmSvxwAAG6o9tA (envelope-from ) for ; Sun, 09 Apr 2023 06:44:23 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id E0F993C904 for ; Sun, 9 Apr 2023 06:44:22 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1plMuK-0008Q3-7N; Sun, 09 Apr 2023 00:44:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1plMuI-0008Pv-Hb for guix-patches@gnu.org; Sun, 09 Apr 2023 00:44:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1plMuI-0002qV-84 for guix-patches@gnu.org; Sun, 09 Apr 2023 00:44:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1plMuH-0004zQ-ST for guix-patches@gnu.org; Sun, 09 Apr 2023 00:44:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#62577] [PATCH v2] refresh: Support select packages SUBSET by module name. References: <20230401035930.3877-1-iyzsong@envs.net> In-Reply-To: <20230401035930.3877-1-iyzsong@envs.net> Resent-From: iyzsong@envs.net Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 09 Apr 2023 04:44:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62577 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 62577@debbugs.gnu.org Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= , =?UTF-8?Q?=E5=AE=8B=E6=96=87=E6=AD=A6?= Received: via spool by 62577-submit@debbugs.gnu.org id=B62577.168101538219107 (code B ref 62577); Sun, 09 Apr 2023 04:44:01 +0000 Received: (at 62577) by debbugs.gnu.org; 9 Apr 2023 04:43:02 +0000 Received: from localhost ([127.0.0.1]:60058 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1plMtK-0004xv-8O for submit@debbugs.gnu.org; Sun, 09 Apr 2023 00:43:02 -0400 Received: from mail.envs.net ([5.199.136.28]:56234) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1plMtH-0004xg-Uh for 62577@debbugs.gnu.org; Sun, 09 Apr 2023 00:43:01 -0400 Received: from localhost (mail.envs.net [127.0.0.1]) by mail.envs.net (Postfix) with ESMTP id 8B04938A0066; Sun, 9 Apr 2023 04:42:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=envs.net; s=modoboa; t=1681015377; bh=XiG8AofPlelgotAkEy2FGgu3VG02lXseCo7Y3QOGLFw=; h=From:To:Cc:Subject:Date:From; b=LcdWRX9Ebkt1RBCbehR6GtgURb/2nbX7UWjRp6DGAqfKTrPjwa3+5yWdVs3wXvdtS /Fd3tLb8pl66PjNsiq8nQ6+r1aS84dd5WkdU0qjRQgq4w035qrtfudj2p9MO3i2KEX JtmBFLhFdIi6AAaSpAdaXUIWO5X4Hf/akyR2jNgEFxFa0O8HMRrKRRWEyK0yCNSwVM 6DuokW1joHQk45Ky8QCr44KS/e/3bpNqUm+d7S5hi1VuveBHZw2JHqvl7ZJN6xhcId x1foU6ecTACPOAvwIgBMFSJRR7hb81LVBA6Zu6XQvo2XrBldemsRHDNaYdRIm6UyUd 8THUFCsDvhUkY1LHromAh7iWht7EmW2GZ3tq2Cm+rl7WVHQRlUbgsKM/L9nbkircM3 qhMJyjvz1UzmPVbKgOGNC8bwp3VAqVWG6O7eIc+JPt2GzAtDGj18YJ9aMJi6SktYSB AsPzBUs+g6qF93NK42evDrI2lorSxsakcJSCBcEsKoaO6R52nTcV68aTHPR6gT4ukR WAur3ys4voipfuWXLs/XHJeAlwLjl96V2UwlI86qzs0KYed4mLdkNcG4GA732zqYjP xd8Qbu7w/y3RRYpClnO3/qEyOJf9C8UYXW5q/6egoXJ0CLQVQdwcWoQRcjhCjm6JVI lHTRWdmec6yq+bXX4K/zyXOs= X-Virus-Scanned: Debian amavisd-new at mail.envs.net Received: from mail.envs.net ([127.0.0.1]) by localhost (mail.envs.net [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id yfO2pBnhU3l2; Sun, 9 Apr 2023 04:42:50 +0000 (UTC) Received: from localhost (unknown [36.170.56.250]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.envs.net (Postfix) with ESMTPSA; Sun, 9 Apr 2023 04:42:50 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by localhost (OpenSMTPD) with ESMTP id 00d3c0ef; Sun, 9 Apr 2023 04:43:39 +0000 (UTC) Date: Sun, 9 Apr 2023 12:43:30 +0800 Message-Id: <20230409044330.6424-1-iyzsong@envs.net> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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: , Reply-to: iyzsong@envs.net X-ACL-Warn: , iyzsong--- via Guix-patches From: iyzsong--- via Guix-patches via Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Seal: i=1; s=key1; d=yhetil.org; t=1681015463; a=rsa-sha256; cv=none; b=jlsWeFprEKCKEb1PBQGj9NSGGs/G1FT+YYCcojpXikpKad1L1+/qECNf2voCo38AU7SzWs T3fwQDJklILrWEfbv3AkM/GtJNVSDQagVSZKgjuzs3RpVJBXXwnPBOWx8nGJz2UUdy4yTE vip2FN7ErFOgp1bP1/5pyLahdxotdH1ilEq8T4CzECCORoGr+usm0sansCcGX39Ta8Pd/x WyiFiuuJtiqtAcDnk9tWVmLtYqfL8LqdYGVqPEApxQn2Aai9RndMqCBt8tghL/02i6ZjqZ 7rFYZ0LiVXAHKzGCnH3cTaGKvm+9ivKjVgMiSYIWB9Ns/GchIdvRoNYp/fMvlg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=envs.net header.s=modoboa header.b=LcdWRX9E; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1681015463; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=XiG8AofPlelgotAkEy2FGgu3VG02lXseCo7Y3QOGLFw=; b=g5ddhnuM+G9X0hdkGmZt2vMiyb5/rM/xjdLZkKTJoKWWumD3WOHxzsL/yZrWcTxZuGTBJz x8dvHV2+o639z+Hj2AzGKi1R51IRmZN6LQf7bSZPBfWomLwmzmkHOr+b6oIcFDOLa9dFNw Cmx9JReLS0ejnQutLTWr7BF60cHMVQh2iWrrLn2OJP2hZ2R089/y7v9rIc560f3RgEStMA UbSFNxzYV9cihr7iTrEUGtmiu9HPe1ItyPB/SB6QNEyp81DZuFg5Ebx7p2KEr6gdaY1IVf TU8Aii9bu4ct3wGo+8GGNIL50O1zQosCV/o0ubwKBSCT/1fxoPvePlLR9Tcobw== X-Migadu-Spam-Score: -2.22 X-Migadu-Scanner: scn1.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=envs.net header.s=modoboa header.b=LcdWRX9E; dmarc=pass (policy=none) header.from=gnu.org; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Spam-Score: -2.22 X-Migadu-Queue-Id: E0F993C904 X-TUID: NDjQ7cyugfJb From: 宋文武 * guix/scripts/refresh.scm (%options): Support '--select module:NAME'. (show-help): Adjust accordingly. (options->update-specs): Honor the module passed by '--select'. * doc/guix.texi (Invoking guix refresh): Document it. --- doc/guix.texi | 9 +++++++-- guix/scripts/refresh.scm | 36 +++++++++++++++++++++++++++++++----- 2 files changed, 38 insertions(+), 7 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index ed42488882..711755dbe3 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -14227,8 +14227,8 @@ $ ./pre-inst-env guix refresh -s non-core -u @item --select=[@var{subset}] @itemx -s @var{subset} -Select all the packages in @var{subset}, one of @code{core} or -@code{non-core}. +Select all the packages in @var{subset}, one of @code{core}, @code{non-core} +or @code{module:NAME}. The @code{core} subset refers to all the packages at the core of the distribution---i.e., packages that are used to build ``everything @@ -14241,6 +14241,11 @@ The @code{non-core} subset refers to the remaining packages. It is typically useful in cases where an update of the core packages would be inconvenient. +The @code{module:NAME} subset refers to all the packages in a specified +guile module. The module can be specified as @code{module:guile} or +@code{module:(gnu packages guile)}, the former is a shorthand for the +later. + @item --manifest=@var{file} @itemx -m @var{file} Select all the packages from the manifest in @var{file}. This is useful to diff --git a/guix/scripts/refresh.scm b/guix/scripts/refresh.scm index bc6c24967a..47c4d55ec4 100644 --- a/guix/scripts/refresh.scm +++ b/guix/scripts/refresh.scm @@ -32,6 +32,7 @@ (define-module (guix scripts refresh) #:use-module ((guix scripts build) #:select (%standard-build-options)) #:use-module (guix store) #:use-module (guix utils) + #:use-module (guix discovery) #:use-module (guix packages) #:use-module (guix profiles) #:use-module (guix upstream) @@ -44,6 +45,7 @@ (define-module (guix scripts refresh) #:use-module ((gnu packages commencement) #:select (%final-inputs)) #:use-module (ice-9 match) #:use-module (ice-9 format) + #:use-module (ice-9 regex) #:use-module (srfi srfi-1) #:use-module (srfi srfi-9) #:use-module (srfi srfi-26) @@ -71,8 +73,23 @@ (define %options ((or "core" "non-core") (alist-cons 'select (string->symbol arg) result)) + ((? (cut string-prefix? "module:" <>)) + (let ((mod (cond + ;; Shorthand name: "module:guile". + ((string-match "module:([^\( ]+)$" arg) => + (lambda (m) + `(gnu packages ,(string->symbol + (match:substring m 1))))) + ;; Full name : "module:(gnu packages guile)". + ((string-match "module:\\(([^)]+)\\)$" arg) => + (lambda (m) + (map string->symbol + (string-split + (match:substring m 1) #\space)))) + (else (leave (G_ "invalid module: ~a~%") arg))))) + (alist-cons 'select (cons 'module mod) result))) (x - (leave (G_ "~a: invalid selection; expected `core' or `non-core'~%") + (leave (G_ "~a: invalid selection; expected `core', `non-core' or `module:NAME'~%") arg))))) (option '(#\t "type") #t #f (lambda (opt name arg result) @@ -141,8 +158,10 @@ (define (show-help) (display (G_ " -u, --update update source files in place")) (display (G_ " - -s, --select=SUBSET select all the packages in SUBSET, one of - `core' or `non-core'")) + -s, --select=SUBSET select all the packages in SUBSET, one of `core`, + `non-core' or `module:NAME' (eg: module:guile) + the module can also be fully specified as + 'module:(gnu packages guile)'")) (display (G_ " -m, --manifest=FILE select all the packages from the manifest in FILE")) (display (G_ " @@ -257,13 +276,20 @@ (define update-specs (let ((select? (match (assoc-ref opts 'select) ('core core-package?) ('non-core (negate core-package?)) - (_ (const #t))))) + (_ (const #t)))) + (modules (match (assoc-ref opts 'select) + (('module . mod) + (list (resolve-interface mod))) + (_ (all-modules (%package-module-path) + #:warn + warn-about-load-error))))) (map update-spec (fold-packages (lambda (package result) (if (select? package) (keep-newest package result) result)) - '())))) + '() + modules)))) (some ;user-specified packages some))) base-commit: c1262edba9118af6507dc47ce6ad61ffdec02384 -- 2.39.2