From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:403:478a::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id UFBPODes1mS0PQAASxT56A (envelope-from ) for ; Fri, 11 Aug 2023 23:46:31 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:478a::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id qOJQODes1mQUIgEAauVa8A (envelope-from ) for ; Fri, 11 Aug 2023 23:46:31 +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 4532D4C924 for ; Fri, 11 Aug 2023 23:46:31 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20221208 header.b="O8/a3/C0"; 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"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1691790391; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=jYKHJhBNVt/SeFScOAF2HJZnoHM1vBlhpzu2GS5Ywms=; b=CuHUPbb4PV/syOkDT3STy7SppHDZaQB2ArpOUStrPvrZ7UxZkfFHIN/q05Mbek3taCbHJn nksEVsDhhQ38t1TVrAVwKHoTnu69IE+g9shCa9xNzaAi7791PhI5sPDyIWUO5LYnad7Heu r8DqlTO1fKHCrs0XsRSHs2cfJ+wGG7LEiYvJKXggQB4F7mMUIct6AHMV2G6sxph3CO7Kam HuuqK+4ngZQqJzy9LzuyOTlC731cIPImZz3Kk1to1wrBLjRo6TKzlotOp0cKV8EcPbwDZW gPFXxnerYx20t9jl+jvC1rZJ3EwMJR1f7OYAoDPAtTQFeLV/sHJyRmlhUErv/Q== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1691790391; a=rsa-sha256; cv=none; b=WVaYZbEH3dTWjTiWwFX4DqVNYVYiA7gpHvXeAAraTkKuut8vMeLfma8R9UyrDBONoKSZ5z 9r2BbKaH45hD/3z2+wcmm7twbGrckaUcgU84Ia5EBWwCVOQafPO8D4Xog9UT21fuytEReB bIrf6KbhiwUrPgOKxU2PZrSMTGwC17QREwGyPE6RZ9NdXJ6goXMyJkEwEOjIOqBTJtTGS/ Wwf0pljomqfPxl4h8SjtnIqnca+SVwl85CEub9+FIgrWTuh7Tqw0HAPrQrlgAQcmBKibGU iUGiE93eInOaDXoAmrknuwrekF6gQipWUf83SuiKKKhAmCehWAkjvHplqqSFow== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20221208 header.b="O8/a3/C0"; 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"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qUZxQ-0003pD-PP; Fri, 11 Aug 2023 17:46:08 -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 1qUZxP-0003ml-90 for guix-patches@gnu.org; Fri, 11 Aug 2023 17:46:07 -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 1qUZxN-0003Jt-UB; Fri, 11 Aug 2023 17:46:05 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qUZxK-0001f5-PO; Fri, 11 Aug 2023 17:46:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#65235] [PATCH] refresh: Add --to-version option. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: guix@cbaines.net, dev@jpoiret.xyz, ludo@gnu.org, othacehe@gnu.org, rekado@elephly.net, zimon.toutoune@gmail.com, me@tobias.gr, guix-patches@gnu.org Resent-Date: Fri, 11 Aug 2023 21:46:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 65235 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 65235@debbugs.gnu.org, maxim.cournoyer@gmail.com Cc: Christopher Baines , Josselin Poiret , Ludovic =?UTF-8?Q?Court=C3=A8s?= , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-To: guix-patches@gnu.org, maxim.cournoyer@gmail.com X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Ludovic =?UTF-8?Q?Court=C3=A8s?= , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by submit@debbugs.gnu.org id=B.16917903446306 (code B ref -1); Fri, 11 Aug 2023 21:46:02 +0000 Received: (at submit) by debbugs.gnu.org; 11 Aug 2023 21:45:44 +0000 Received: from localhost ([127.0.0.1]:48196 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qUZx1-0001db-L7 for submit@debbugs.gnu.org; Fri, 11 Aug 2023 17:45:44 -0400 Received: from lists.gnu.org ([2001:470:142::17]:60672) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qUZwx-0001co-2h for submit@debbugs.gnu.org; Fri, 11 Aug 2023 17:45:42 -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 1qUZwn-0003jP-Kz for guix-patches@gnu.org; Fri, 11 Aug 2023 17:45:29 -0400 Received: from mail-qt1-x834.google.com ([2607:f8b0:4864:20::834]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qUZwl-0003BK-92 for guix-patches@gnu.org; Fri, 11 Aug 2023 17:45:29 -0400 Received: by mail-qt1-x834.google.com with SMTP id d75a77b69052e-40feecefa84so14564851cf.1 for ; Fri, 11 Aug 2023 14:45:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691790326; x=1692395126; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=jYKHJhBNVt/SeFScOAF2HJZnoHM1vBlhpzu2GS5Ywms=; b=O8/a3/C0754vJfJ+Z1eUjomTSYp/jSMLfPUcyTUo0hgyt4mFSb70DkOtcbafC8r6JQ EVtaS0A/Lv8vGKUJYFrhKKMEozaitYs10O4Os9ETJLbhKunQPcVoCEiQrnIjz7wxQ/eh DSpiCEYvtp3yKWE56yumcvcMhCizW2go2/Mxd27Rbd0DOL2pqx/o5fO/z+iTWbytm3B2 dbNqRxA2chXPpzijWekUj4grBKGkMhn8LOj9KFXUssewKlEfXrnaxhtnF7M9sXvUvrAQ 40JVqMahHscUTBlDa5g/kCle/qDHps61R6mNs4hQQmkqJTPpi4U/Fow7RpdhoOa+oR5d 1MXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691790326; x=1692395126; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=jYKHJhBNVt/SeFScOAF2HJZnoHM1vBlhpzu2GS5Ywms=; b=IscB91XnKW5KuxExe2qszutZ09DBi46E0d9aO7L7KcqBTTDdKPWnIE0R18N2cFBYpx 3I3L+KvEFd2YvMBfZq/+gM0mWtHzALtHV3e1XaiQdHwgWE3Am/XU46bgs0/3Zuq5s6YZ i4HhVjEwF21XAIBlRPJICX7E3FQNQMs/ZwMzCsTCiIID+aNy/rqxS6nL8VFeBaXdx5JC U7vG1E9DyJpwNmuIkrUjkF2XNo1Lst+/CpPe12VZhGI4DSSRjm0rdIviaRdATLf4nGof 8OFCrYD+jRJr1dp0qHTNSG62JYV6n/Tvb8StSRuONLhx6W1MGUFg+xUfYWP6nskHojb1 mmtQ== X-Gm-Message-State: AOJu0YwiF2pDjmM78EK/JtGCDE4SPeN064lGAyLms9Ukuc2kjIhEX5u8 o2nhWFFNu6Mt67xjUeN8LQFPNbt4bALyXQ== X-Google-Smtp-Source: AGHT+IEXd4bRzeSU+TH7i5yiY3wpUzEyOsl0xR8kRhbBcQrAg0PoeQVJlpiZF7BAyMv0hUvuzgFR8Q== X-Received: by 2002:a05:622a:130f:b0:40a:6b19:654d with SMTP id v15-20020a05622a130f00b0040a6b19654dmr3785659qtk.67.1691790325773; Fri, 11 Aug 2023 14:45:25 -0700 (PDT) Received: from localhost.localdomain (dsl-205-236-230-92.b2b2c.ca. [205.236.230.92]) by smtp.gmail.com with ESMTPSA id i10-20020a37c20a000000b0076768dfe53esm1449320qkm.105.2023.08.11.14.45.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Aug 2023 14:45:24 -0700 (PDT) From: Maxim Cournoyer Date: Fri, 11 Aug 2023 17:45:11 -0400 Message-ID: <7abba6f5c3c2cc32a0f21fa701e64fffe7d27861.1691790311.git.maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2607:f8b0:4864:20::834; envelope-from=maxim.cournoyer@gmail.com; helo=mail-qt1-x834.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+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Queue-Id: 4532D4C924 X-Migadu-Scanner: mx0.migadu.com X-Migadu-Spam-Score: -0.58 X-Spam-Score: -0.58 X-TUID: ED7V/9cbxIX1 * guix/scripts/refresh.scm (%options): Register 'to-version' long version. (update-specification->update-spec): Add a fallback-version argument. (options->update-specs): Honor to-version option. * tests/guix-refresh.sh: Test it. * doc/guix.texi (Invoking guix refresh): Document it. --- doc/guix.texi | 20 ++++++++++++++++++++ guix/scripts/refresh.scm | 31 +++++++++++++++++++++++-------- tests/guix-refresh.sh | 7 +++++++ 3 files changed, 50 insertions(+), 8 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 409ca2ad62..ade80dd72a 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -14529,6 +14529,26 @@ Invoking guix refresh @dots{} @end example +In some specific cases, you may have many packages specified via a +manifest or a module selection which should all be updated together; for +these cases, the @option{--to-version} option can be provided to have +them all refreshed to the same version, as shown in the examples below: + +@example +$ guix refresh qtbase qtdeclarative --to-version=6.5.2 +gnu/packages/qt.scm:1248:13: qtdeclarative would be upgraded from 6.3.2 to 6.5.2 +gnu/packages/qt.scm:584:2: qtbase would be upgraded from 6.3.2 to 6.5.2 +@end example + +@example +$ guix refresh --manifest=qt5-manifest.scm --to-version=5.15.10 +gnu/packages/qt.scm:1173:13: qtxmlpatterns would be upgraded from 5.15.8 to 5.15.10 +gnu/packages/qt.scm:1202:13: qtdeclarative would be upgraded from 5.15.8 to 5.15.10 +gnu/packages/qt.scm:1762:13: qtserialbus would be upgraded from 5.15.8 to 5.15.10 +gnu/packages/qt.scm:2070:13: qtquickcontrols2 would be upgraded from 5.15.8 to 5.15.10 +@dots{} +@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 a9241aa20d..54ac7ceea3 100644 --- a/guix/scripts/refresh.scm +++ b/guix/scripts/refresh.scm @@ -10,6 +10,7 @@ ;;; Copyright © 2020 Simon Tournier ;;; Copyright © 2021 Sarah Morgensen ;;; Copyright © 2022 Hartmut Goebel +;;; Copyright © 2023 Maxim Cournoyer maxim.cournoyer@gmail.com> ;;; ;;; This file is part of GNU Guix. ;;; @@ -106,6 +107,9 @@ (define %options (option '(#\m "manifest") #t #f (lambda (opt name arg result) (alist-cons 'manifest arg result))) + (option '("to-version") #t #f + (lambda (opt name arg result) + (alist-cons 'to-version arg result))) (option '(#\e "expression") #t #f (lambda (opt name arg result) (alist-cons 'expression arg result))) @@ -164,6 +168,9 @@ (define (show-help) 'module:(gnu packages guile)'")) (display (G_ " -m, --manifest=FILE select all the packages from the manifest in FILE")) + (display (G_ " + --to-version=VERSION + update the package or packages to VERSION")) (display (G_ " -t, --type=UPDATER,... restrict to updates from the specified updaters (e.g., 'gnu')")) @@ -213,17 +220,20 @@ (define-record-type (define* (update-spec package #:optional version) (%update-spec package version)) -(define (update-specification->update-spec spec) +(define (update-specification->update-spec spec fallback-version) "Given SPEC, a package name like \"guile@2.0=2.0.8\", return a -record with two fields: the package to upgrade, and the target version." +record with two fields: the package to upgrade, and the target version. When +SPEC lacks a version, use FALLBACK-VERSION." (match (string-rindex spec #\=) - (#f (update-spec (specification->package spec) #f)) + (#f (update-spec (specification->package spec) fallback-version)) (idx (update-spec (specification->package (substring spec 0 idx)) (substring spec (1+ idx)))))) (define (options->update-specs opts) "Return the list of records requested by OPTS, honoring options like '--recursive'." + (define to-version (assoc-ref opts 'to-version)) + (define core-package? (let* ((input->package (match-lambda ((name (? package? package) _ ...) package) @@ -263,13 +273,18 @@ (define (options->update-specs opts) ;; Update specs explicitly passed as command-line arguments. (match (append-map (match-lambda (('argument . spec) - ;; Take either the specified version or the - ;; latest one. - (list (update-specification->update-spec spec))) + ;; Take either the specified version or the latest + ;; one. The version specified as part of a spec + ;; takes precedence, with the command-line specified + ;; --to-version used as a fallback. + (list (update-specification->update-spec spec + to-version))) (('expression . exp) - (list (update-spec (read/eval-package-expression exp)))) + (list (update-spec (read/eval-package-expression exp) + to-version))) (('manifest . manifest) - (map update-spec (packages-from-manifest manifest))) + (map (cut update-spec <> to-version) + (packages-from-manifest manifest))) (_ '())) opts) diff --git a/tests/guix-refresh.sh b/tests/guix-refresh.sh index 51d34c4b51..a2be93fce4 100644 --- a/tests/guix-refresh.sh +++ b/tests/guix-refresh.sh @@ -109,6 +109,13 @@ case "$(guix refresh -t test guile=2.0.0 2>&1)" in *"failed to find"*"2.0.0"*) true;; *) false;; esac + +guix refresh -t test guile --to-version=2.0.0 # XXX: should return non-zero? +case "$(guix refresh -t test guile --to-version=2.0.0 2>&1)" in + *"failed to find"*"2.0.0"*) true;; + *) false;; +esac + for spec in "guile=1.6.4" "guile@3=1.6.4" do guix refresh -t test "$spec" base-commit: 77251c5f5af193dcd031dffef744001cfc48f7e5 -- 2.41.0