GNU bug report logs - #78462
[PATCH 1/2] refresh: Allow specifying a partial version via the version specification.

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: guix-patches; Reported by: Maxim Cournoyer <maxim.cournoyer@HIDDEN>; Keywords: patch; merged with #78463; dated Sat, 17 May 2025 05:41:01 UTC; Maintainer for guix-patches is guix-patches@HIDDEN.
Forcibly Merged 78462 78463. Request was from Maxim Cournoyer <maxim.cournoyer@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 17 May 2025 05:40:46 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat May 17 01:40:46 2025
Received: from localhost ([127.0.0.1]:44216 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1uGAHu-0004za-4S
	for submit <at> 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 <maxim.cournoyer@HIDDEN>)
 id 1uGAHq-0004yx-PR
 for submit <at> 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 <maxim.cournoyer@HIDDEN>)
 id 1uGAHl-0003AL-35
 for guix-patches@HIDDEN; 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 <maxim.cournoyer@HIDDEN>)
 id 1uGAHi-0000Xy-PJ
 for guix-patches@HIDDEN; Sat, 17 May 2025 01:40:36 -0400
Received: by mail-pl1-x636.google.com with SMTP id
 d9443c01a7336-22fac0694aaso20551095ad.1
 for <guix-patches@HIDDEN>; 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 <maxim.cournoyer@HIDDEN>
To: guix-patches@HIDDEN
Subject: [PATCH 1/2] refresh: Allow specifying a partial version via the
 version specification.
Date: Sat, 17 May 2025 14:40:19 +0900
Message-ID: <eb4cb32e1c94b8873250e9df4958a9c06059719e.1747460420.git.maxim.cournoyer@HIDDEN>
X-Mailer: git-send-email 2.49.0
MIME-Version: 1.0
X-Debbugs-Cc: Christopher Baines <guix@HIDDEN>, Gabriel Wicki <gabriel@HIDDEN>, Josselin Poiret <dev@HIDDEN>, Ludovic Courtès <ludo@HIDDEN>, Mathieu Othacehe <othacehe@HIDDEN>, Maxim Cournoyer <maxim.cournoyer@HIDDEN>, Simon Tournier <zimon.toutoune@HIDDEN>, Tobias Geerinckx-Rice <me@HIDDEN>
Content-Transfer-Encoding: 8bit
Received-SPF: pass client-ip=2607:f8b0:4864:20::636;
 envelope-from=maxim.cournoyer@HIDDEN; 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-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: submit
Cc: Maxim Cournoyer <maxim.cournoyer@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)

* 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(-)

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 <update-spec> 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"

base-commit: 3fadea42548389141e84a8481d271ac7280de7bc
-- 
2.49.0





Acknowledgement sent to Maxim Cournoyer <maxim.cournoyer@HIDDEN>:
New bug report received and forwarded. Copy sent to guix@HIDDEN, gabriel@HIDDEN, dev@HIDDEN, ludo@HIDDEN, othacehe@HIDDEN, maxim.cournoyer@HIDDEN, zimon.toutoune@HIDDEN, me@HIDDEN, guix-patches@HIDDEN. Full text available.
Report forwarded to guix@HIDDEN, gabriel@HIDDEN, dev@HIDDEN, ludo@HIDDEN, othacehe@HIDDEN, maxim.cournoyer@HIDDEN, zimon.toutoune@HIDDEN, me@HIDDEN, guix-patches@HIDDEN:
bug#78462; Package guix-patches. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sat, 17 May 2025 06:00:03 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.