From patchwork Sat May 17 05:40:19 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxim Cournoyer X-Patchwork-Id: 42645 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 8BFB327BC4B; Sat, 17 May 2025 06:41:50 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,RCVD_IN_VALIDITY_CERTIFIED, RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE,SPF_HELO_PASS, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 0567E27BC49 for ; Sat, 17 May 2025 06:41:50 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1uGAIK-0003Cg-6b; Sat, 17 May 2025 01:41:12 -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 1uGAII-0003CE-44 for guix-patches@gnu.org; Sat, 17 May 2025 01:41:10 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uGAIG-0000Z1-Rw; Sat, 17 May 2025 01:41:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:From:To:Subject; bh=ykXBccHFAMVudMfQRWw31jP6EHfXwotbq1zRr2t56hQ=; b=ldedsjjlLdBZqQp6IDlMClaV0jSDlAYC50I89bPxups9yoO+2+xaI27+LutE2PdUo419bsjNzqhYZ/SZe/CWo0AdoixTxcMR7YbvDwDsJA6NqcHSkz0RZvahLXNJDtiHuYV7P1RbOVd7cPQUdFZIb49C5cHbUjoeVxA0fJQ/G24XiayCIJlqs+p6dMwmBY3cvz9Vt/MDwVVUYVpf47XeOoMZFSGzO+FRkzhNf4xyRQ/LRMGKtIxw6kn1YS3ziB7pEh5uP7f3x67x6BmiWHwLRpRl6ESokEjed90GJAKh8J9Be/lnLGwe6bs15AIB0I2Oa2W8U3zCUIRhZjuaN9PPJQ==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1uGAI9-00050k-Rf; Sat, 17 May 2025 01:41:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#78462] [PATCH 1/2] refresh: Allow specifying a partial version via the version specification. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: guix@cbaines.net, gabriel@erlikon.ch, dev@jpoiret.xyz, ludo@gnu.org, othacehe@gnu.org, maxim.cournoyer@gmail.com, zimon.toutoune@gmail.com, me@tobias.gr, guix-patches@gnu.org Resent-Date: Sat, 17 May 2025 05:41:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 78462 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 78462@debbugs.gnu.org Cc: Maxim Cournoyer , Christopher Baines , Gabriel Wicki , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Maxim Cournoyer , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-To: guix-patches@gnu.org X-Debbugs-Original-Xcc: Christopher Baines , Gabriel Wicki , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Maxim Cournoyer , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by submit@debbugs.gnu.org id=B.174746044619198 (code B ref -1); Sat, 17 May 2025 05:41:01 +0000 Received: (at submit) by debbugs.gnu.org; 17 May 2025 05:40:46 +0000 Received: from localhost ([127.0.0.1]:44216 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uGAHu-0004za-4S for submit@debbugs.gnu.org; Sat, 17 May 2025 01:40:46 -0400 Received: from lists.gnu.org ([2001:470:142::17]:34282) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uGAHq-0004yx-PR for submit@debbugs.gnu.org; Sat, 17 May 2025 01:40:43 -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 1uGAHl-0003AL-35 for guix-patches@gnu.org; Sat, 17 May 2025 01:40:37 -0400 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uGAHi-0000Xy-PJ for guix-patches@gnu.org; Sat, 17 May 2025 01:40:36 -0400 Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-22fac0694aaso20551095ad.1 for ; Fri, 16 May 2025 22:40:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1747460432; x=1748065232; darn=gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=ykXBccHFAMVudMfQRWw31jP6EHfXwotbq1zRr2t56hQ=; b=gWYsQrXWzKbYO0xl3TIODJ33nkrJtBJi1YvI/GpHgiWnjwCzKnPvqDz63lsOegfmrD iOer4LWPnCeic0ef8YxdhqZKfQ4GulUThxzINdG5HnDG69wVzr7sjrgYu/LL4P8Sy+WI 5hdD+n+zJcMFm/xcOR/HN7h8vJSrGIx4v1dv7I4b8zSxmM7FGaSlb593uUgQTWR6efMa dSBIYSgspeQXd4vKMZEuLxXiZ6saU8gSK6vEKM8JZ5pBswRRPes0Fl1gmLhojVVMVRlA 0S42QTVYCTS9dGXAU8zghjB/1eTq08m/joMW7AftwTDOKlc2rsCwoujfQKSlTMlstYy3 bQmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1747460432; x=1748065232; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ykXBccHFAMVudMfQRWw31jP6EHfXwotbq1zRr2t56hQ=; b=v/FyMMMvz1GL2QI78EaaUffUwG7ppP0ckcZkqajhfnrhpgqcAxIzcJ6AvVpjCxx9sU FjlvcgyFA0Yl0rFepUZ78DWd+K8+Nuni5I34j3846rHAgNZLWoYx6TW4dmA/RNSD1+2t 8UWzE95L5UkoeMdFMzGVwYMsuTMaLVUlteFuQrOogXCcEKQIwUa4EHD5BHGHwMJShbz9 BvHaOGZZHJLPJixD4xUT6u10H4hzII/uPt7ynQxIUHoyUmvtw0j39LKNy4FkxXqVmG0p 41WH1b/+1bI79iIAH35mmJcAgfdS4GaHhXeZmNs11OL3jJ89QI94+lnbORxGnLG0+Aqz j9xA== X-Gm-Message-State: AOJu0YxuFy9unAuO9cD3/fjy/gbehx4pfsioCZlHHDvF8+swI9at1e82 Q6YdOO/P8pQgS2zBN2yNgEctkYyJR+S0vBkLhV171b+8zuOn+ju1DDWI5FMmSGId X-Gm-Gg: ASbGncu5Np9ldcaopvWZAA5LzZ5CJWpmfKAaJtwSffDNmE0R13HuzajQus0KSmV1Pw/ BRhNZn67XndGaPun0Iinqu723oJilOynGEfu21RjXD72NlLNQq54kPWk5qyqUhRUZxByyH8+SjZ HdZVoTHU8mrSwnHqeliYVM0HJCUampnlyJ6Zp9FfK67KuWnMuqGLJvA7oYoqx3hbc/FOD6H7I6D CseAvpcVy2G7aRhoLL8OoIU5U6WwQ/KBj0E0xxlVGIUT2R1gKrGB6PNNHOk8k6pSnAK8evULdBH geeNL0JFz/3rvL10loX4oMTluOa5mkJMh0HbBcgpH9b9sOYrHlX9Xv9ehruBnE0djlBC6d8= X-Google-Smtp-Source: AGHT+IFBSNW2MVxfDdCPvzfySvNC2QbhYRMMJXic6CIkmFbRLpY/n2T5Ku/6ynVQE6vhivCQeyoPYA== X-Received: by 2002:a17:903:41c7:b0:22e:37b8:7972 with SMTP id d9443c01a7336-231de3514dcmr72916825ad.10.1747460431850; Fri, 16 May 2025 22:40:31 -0700 (PDT) Received: from localhost.localdomain ([2405:6586:be0:0:83c8:d31d:2cec:f542]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-231d4ac957dsm23424505ad.52.2025.05.16.22.40.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 May 2025 22:40:31 -0700 (PDT) From: Maxim Cournoyer Date: Sat, 17 May 2025 14:40:19 +0900 Message-ID: X-Mailer: git-send-email 2.49.0 MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::636; envelope-from=maxim.cournoyer@gmail.com; helo=mail-pl1-x636.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham 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-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * guix/scripts/refresh.scm (update-specification->update-spec): Flag the update-spec as partial when it is prefixed with '~'. * tests/guix-refresh.sh: Test it. * doc/guix.texi (Invoking guix refresh): Document it. Change-Id: Iab4482d9367105f6ffcd2d6a49148736c93d53e4 --- doc/guix.texi | 11 +++++++++++ guix/scripts/refresh.scm | 7 +++++-- tests/guix-refresh.sh | 20 ++++++++++++++++++++ 3 files changed, 36 insertions(+), 2 deletions(-) base-commit: 3fadea42548389141e84a8481d271ac7280de7bc diff --git a/doc/guix.texi b/doc/guix.texi index 8e73685a216..584a42b6a79 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -15147,6 +15147,17 @@ Invoking guix refresh gnu/packages/qt.scm:452:13: qtbase would be upgraded from 5.15.8 to 5.15.10 @end example +@cindex partial version specification, guix refresh +A per-package equivalent to --target-version is made available by +prefixing the version specification with the @samp{~} (tilde) character. +For example: + +@example +$ guix refresh bash=~5 guile=~3 +gnu/packages/guile.scm:354:13: guile would be upgraded from 3.0.9 to 3.0.10 +gnu/packages/bash.scm:150:15: bash would be upgraded from 5.1.16 to 5.2.37 +@end example + Sometimes the upstream name differs from the package name used in Guix, and @command{guix refresh} needs a little help. Most updaters honor the @code{upstream-name} property in package definitions, which can be used diff --git a/guix/scripts/refresh.scm b/guix/scripts/refresh.scm index 2d086073284..4a94ec637bb 100644 --- a/guix/scripts/refresh.scm +++ b/guix/scripts/refresh.scm @@ -231,8 +231,11 @@ (define (update-specification->update-spec spec fallback-version) (match (string-rindex spec #\=) (#f (update-spec (specification->package spec) fallback-version (not (not fallback-version)))) - (idx (update-spec (specification->package (substring spec 0 idx)) - (substring spec (1+ idx)))))) + (idx (let ((version (substring spec (1+ idx))) + (package (specification->package (substring spec 0 idx)))) + (if (string-prefix? "~" version) + (update-spec package (string-drop version 1) #t) ;partial + (update-spec package version)))))) (define (options->update-specs opts) "Return the list of records requested by OPTS, honoring diff --git a/tests/guix-refresh.sh b/tests/guix-refresh.sh index 0f1af8cae7c..e287f37717f 100644 --- a/tests/guix-refresh.sh +++ b/tests/guix-refresh.sh @@ -126,6 +126,12 @@ case "$(guix refresh -t test guile --target-version=2.0.0 2>&1)" in *) false;; esac +guix refresh -t test guile=~2.0.0 # XXX: should return non-zero? +case "$(guix refresh -t test guile=~2.0.0 2>&1)" in + *"failed to find"*"2.0.0"*) true;; + *) false;; +esac + # Partial target version => select the newest release prefixed by it. guix refresh -t test guile --target-version=3 # XXX: should return non-zero? case "$(guix refresh -t test guile --target-version=3 2>&1)" in @@ -133,6 +139,20 @@ case "$(guix refresh -t test guile --target-version=3 2>&1)" in *) false;; esac +# Partial spec version => select the newest release prefixed by it. +guix refresh -t test guile=~3 # XXX: should return non-zero? +case "$(guix refresh -t test guile=~3 2>&1)" in + *"would be upgraded"*"3.13.3"*) true;; + *) false;; +esac + +# Conflicting --target-version and spec: spec wins +guix refresh -t test guile=~3 --target-version=1 # XXX: should return non-zero? +case "$(guix refresh -t test guile=~3 2>&1)" in + *"would be upgraded"*"3.13.3"*) true;; + *) false;; +esac + for spec in "guile=1.6.4" "guile@3=1.6.4" do guix refresh -t test "$spec"