From unknown Tue Aug 19 21:02:13 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#77741] [PATCH] upstream: Do not update to same version. Resent-From: Christopher Baines Original-Sender: "Debbugs-submit" Resent-CC: guix@cbaines.net, dev@jpoiret.xyz, ludo@gnu.org, othacehe@gnu.org, zimon.toutoune@gmail.com, me@tobias.gr, guix-patches@gnu.org Resent-Date: Fri, 11 Apr 2025 14:02:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 77741 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 77741@debbugs.gnu.org Cc: Christopher Baines , Josselin Poiret , Ludovic =?UTF-8?Q?Court=C3=A8s?= , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-To: guix-patches@gnu.org X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Ludovic =?UTF-8?Q?Court=C3=A8s?= , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by submit@debbugs.gnu.org id=B.1744380075433 (code B ref -1); Fri, 11 Apr 2025 14:02:02 +0000 Received: (at submit) by debbugs.gnu.org; 11 Apr 2025 14:01:15 +0000 Received: from localhost ([127.0.0.1]:50965 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u3EwV-00006u-0z for submit@debbugs.gnu.org; Fri, 11 Apr 2025 10:01:15 -0400 Received: from lists.gnu.org ([2001:470:142::17]:59948) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u3EwT-0008Vv-Em for submit@debbugs.gnu.org; Fri, 11 Apr 2025 10:01:13 -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 1u3EwD-0005rR-Tu for guix-patches@gnu.org; Fri, 11 Apr 2025 10:00:57 -0400 Received: from mira.cbaines.net ([212.71.252.8]) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1u3EwB-0004g1-Uu for guix-patches@gnu.org; Fri, 11 Apr 2025 10:00:57 -0400 Received: from localhost (unknown [IPv6:2a02:6b67:e390:8b00::1ce5]) by mira.cbaines.net (Postfix) with ESMTPSA id 1E0C927BC49 for ; Fri, 11 Apr 2025 15:00:54 +0100 (BST) Received: from localhost (localhost [local]) by localhost (OpenSMTPD) with ESMTPA id a1e6e65d for ; Fri, 11 Apr 2025 14:00:53 +0000 (UTC) From: Christopher Baines Date: Fri, 11 Apr 2025 15:00:53 +0100 Message-ID: X-Mailer: git-send-email 2.49.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=212.71.252.8; envelope-from=mail@cbaines.net; helo=mira.cbaines.net X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.9 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.1 (/) From: Maxim Cournoyer Previously, 'guix refresh --update' would do actually rewrite the file with the same version/hash information when the target version was the same as the current version: guix refresh --update idutils=4.6 idutils.scm: warning: downgrading 'idutils' from 4.6 to 4.6 [...] idutils.scm: idutils: updating from version 4.6 to version 4.6... This changes handles this case so that it does and prints nothing. * guix/upstream.scm (package-update): Use `version-compare' to distinguish the equal versions case. Change-Id: I079e030d573f5968725ef13b3f626e2f8d02cb2f --- guix/upstream.scm | 63 +++++++++++++++++++++++-------------------- tests/guix-refresh.sh | 9 +++++++ 2 files changed, 43 insertions(+), 29 deletions(-) diff --git a/guix/upstream.scm b/guix/upstream.scm index af09f62088..259c074412 100644 --- a/guix/upstream.scm +++ b/guix/upstream.scm @@ -525,39 +525,44 @@ (define* (package-update store package partially specified, in which case the package will be updated to the newest compatible version if there are no exact match for VERSION. For example, providing \"46\" as the version may update the package to version \"46.6.4\"." + (define (update* source) + (let ((method (match (package-source package) + ((? origin? origin) + (origin-method origin)) + (_ + #f)))) + (match (assq method %method-updates) + (#f + (raise (make-compound-condition + (formatted-message (G_ "cannot download for \ +this method: ~s") + method) + (condition + (&error-location + (location (package-location package))))))) + ((_ . update) + (update store package source + #:key-server key-server + #:key-download key-download))))) + (match (package-latest-release package updaters #:version version #:partial-version? partial-version?) ((? upstream-source? source) - (if (or (version>? (upstream-source-version source) - (package-version package)) - (and version - (begin - (warning (package-location package) - (G_ "downgrading '~a' from ~a to ~a~%") - (package-name package) - (package-version package) - (upstream-source-version source)) - #t))) - (let ((method (match (package-source package) - ((? origin? origin) - (origin-method origin)) - (_ - #f)))) - (match (assq method %method-updates) - (#f - (raise (make-compound-condition - (formatted-message (G_ "cannot download for \ -this method: ~s") - method) - (condition - (&error-location - (location (package-location package))))))) - ((_ . update) - (update store package source - #:key-server key-server - #:key-download key-download)))) - (values #f #f #f))) + (case (version-compare (upstream-source-version source) + (package-version package)) + ((>) + (update* source)) + ((<) + (and version + (warning (package-location package) + (G_ "downgrading '~a' from ~a to ~a~%") + (package-name package) + (package-version package) + (upstream-source-version source))) + (update* source)) + (else + (values #f #f #f)))) (#f ;; Warn rather than abort so that other updates can still take place. (if version diff --git a/tests/guix-refresh.sh b/tests/guix-refresh.sh index b5b38189cb..0f1af8cae7 100644 --- a/tests/guix-refresh.sh +++ b/tests/guix-refresh.sh @@ -44,6 +44,15 @@ case "$(guix refresh -t test idutils 2>&1)" in *"$idutils_version"*"already the latest version"*) true;; *) false;; esac + +# No-op when updating to same version. +case "$(guix refresh -t test -u idutils \ +--target-version=$idutils_version 2>&1)" in + *downgrading*) false;; + *updating*) false;; + *) true;; +esac + guix refresh -t test libreoffice # XXX: should return non-zero? case "$(guix refresh -t test libreoffice 2>&1)" in *"greater than the latest known version"*"1.0"*) true;; base-commit: 172e9a1aa1ee2ef3e557cf46a11e451aa7982983 -- 2.49.0 From unknown Tue Aug 19 21:02:13 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#77741] [PATCH] upstream: Do not update to same version. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 11 Apr 2025 15:00:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 77741 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Christopher Baines Cc: Josselin Poiret , Simon Tournier , Mathieu Othacehe , Tobias Geerinckx-Rice , Christopher Baines , 77741@debbugs.gnu.org Received: via spool by 77741-submit@debbugs.gnu.org id=B77741.174438358315790 (code B ref 77741); Fri, 11 Apr 2025 15:00:02 +0000 Received: (at 77741) by debbugs.gnu.org; 11 Apr 2025 14:59:43 +0000 Received: from localhost ([127.0.0.1]:51191 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u3Fr4-00046a-KA for submit@debbugs.gnu.org; Fri, 11 Apr 2025 10:59:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54918) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u3Fr1-00046K-BB for 77741@debbugs.gnu.org; Fri, 11 Apr 2025 10:59:40 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1u3Fqv-0005Bq-KU; Fri, 11 Apr 2025 10:59:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=fj1P9QkZdaxMOZJ+vFbudGatAp2UKYimLFtU6ukHxbo=; b=Vm8yzJoedmyWnSnLZYO5 8higG/H2W+l9hkjYJDIWgRermRVNZ03cWwQ0g1us89TfrLK3Brqbq40xB5/PoEeFJiq7WjUdo5uri nWKMgyz8kY5JM99YT9McO+5egEA0rrKolRAsBsWxapjB3/WcLUMbaN2Cmzh9oW4/NAEAV09BmDbTN JUYAF5pGhSW5rQh/JCJlVjNbxNW8bXRYec7R7zuAdTK3oFEF5V/du+EkAVqHMdz1Gzqu4SCVskMxB x4kO8ZN9yJO4XImW6sWR5O4JnMVlPDupSCLF4/UcJDuHLRImUnfW+VetHxnXqVppSFmt9lxzga9mv GCz0fri39uoiNw==; From: Ludovic =?UTF-8?Q?Court=C3=A8s?= In-Reply-To: (Christopher Baines's message of "Fri, 11 Apr 2025 15:00:53 +0100") References: User-Agent: mu4e 1.12.9; emacs 29.4 X-URL: https://people.bordeaux.inria.fr/lcourtes/ X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu X-Revolutionary-Date: Duodi 22 Germinal an 233 de la =?UTF-8?Q?R=C3=A9volution,?= jour de la Romaine Date: Fri, 11 Apr 2025 16:58:40 +0200 Message-ID: <87v7rakan3.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Christopher Baines skribis: > From: Maxim Cournoyer > > Previously, 'guix refresh --update' would do actually rewrite the file with > the same version/hash information when the target version was the same as the > current version: > > guix refresh --update idutils=4.6 > idutils.scm: warning: downgrading 'idutils' from 4.6 to 4.6 > [...] > idutils.scm: idutils: updating from version 4.6 to version 4.6... > > This changes handles this case so that it does and prints nothing. > > * guix/upstream.scm (package-update): Use `version-compare' to distinguish the > equal versions case. > > Change-Id: I079e030d573f5968725ef13b3f626e2f8d02cb2f LGTM! From unknown Tue Aug 19 21:02:13 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Christopher Baines Subject: bug#77741: closed (Re: [bug#77741] [PATCH] upstream: Do not update to same version.) Message-ID: References: <87zfg1eq16.fsf@cbaines.net> X-Gnu-PR-Message: they-closed 77741 X-Gnu-PR-Package: guix-patches X-Gnu-PR-Keywords: patch Reply-To: 77741@debbugs.gnu.org Date: Sun, 27 Apr 2025 12:41:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1745757662-7419-1" This is a multi-part message in MIME format... ------------=_1745757662-7419-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #77741: [PATCH] upstream: Do not update to same version. which was filed against the guix-patches package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 77741@debbugs.gnu.org. --=20 77741: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D77741 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1745757662-7419-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 77741-done) by debbugs.gnu.org; 27 Apr 2025 12:40:28 +0000 Received: from localhost ([127.0.0.1]:40160 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u91J5-0001uQ-P1 for submit@debbugs.gnu.org; Sun, 27 Apr 2025 08:40:28 -0400 Received: from mira.cbaines.net ([212.71.252.8]:44204) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u91J3-0001uI-Mf for 77741-done@debbugs.gnu.org; Sun, 27 Apr 2025 08:40:26 -0400 Received: from localhost (unknown [IPv6:2a02:6b67:e390:8b00::1ce5]) by mira.cbaines.net (Postfix) with ESMTPSA id EED2927BC49; Sun, 27 Apr 2025 13:40:24 +0100 (BST) Received: from fang (localhost [127.0.0.1]) by localhost (OpenSMTPD) with ESMTP id 223c3fb4; Sun, 27 Apr 2025 12:40:24 +0000 (UTC) From: Christopher Baines To: Ludovic =?utf-8?Q?Court=C3=A8s?= Subject: Re: [bug#77741] [PATCH] upstream: Do not update to same version. In-Reply-To: <87v7rakan3.fsf@gnu.org> ("Ludovic =?utf-8?Q?Court=C3=A8s=22'?= =?utf-8?Q?s?= message of "Fri, 11 Apr 2025 16:58:40 +0200") References: <87v7rakan3.fsf@gnu.org> User-Agent: mu4e 1.12.9; emacs 29.4 Date: Sun, 27 Apr 2025 13:40:21 +0100 Message-ID: <87zfg1eq16.fsf@cbaines.net> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 77741-done Cc: 77741-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Ludovic Court=C3=A8s writes: > Christopher Baines skribis: > >> From: Maxim Cournoyer >> >> Previously, 'guix refresh --update' would do actually rewrite the file w= ith >> the same version/hash information when the target version was the same a= s the >> current version: >> >> guix refresh --update idutils=3D4.6 >> idutils.scm: warning: downgrading 'idutils' from 4.6 to 4.6 >> [...] >> idutils.scm: idutils: updating from version 4.6 to version 4.6... >> >> This changes handles this case so that it does and prints nothing. >> >> * guix/upstream.scm (package-update): Use `version-compare' to distingui= sh the >> equal versions case. >> >> Change-Id: I079e030d573f5968725ef13b3f626e2f8d02cb2f > > LGTM! Thanks for taking a look, I've pushed this to master as a369932d042d0212b354def48f8f0c87b9f65e69. --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQKlBAEBCgCPFiEEPonu50WOcg2XVOCyXiijOwuE9XcFAmgOJbVfFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDNF ODlFRUU3NDU4RTcyMEQ5NzU0RTBCMjVFMjhBMzNCMEI4NEY1NzcRHG1haWxAY2Jh aW5lcy5uZXQACgkQXiijOwuE9XcODhAAps0Fc0a9E41Pj2/CatNQi88H7YKJiiMc qB0O9BnbnW1XdThUu0nz3W2Ac9FUcBwDVSb/M89dnF5rcBj/6IiCnIS/hgXIgG6Z lc4IwUB4O2606ASnaBNHkY+bOAaDa13R65hJUtVg7mDPwOO6pFk2puIoakQHZUtz oMIqppBW9IN4YhgOemW6kscE3/+t3CiQopXCVzH2DUmHRHrskJjSJB5Y2J8t7v+/ wtgYabvaplslYAtcsH9hlLSUf5Et+ndC2WjRbSI1KM2NXzIUbSmQfinJBMgBgMrX n1Yl9SR0GFNUqYeWcXG/kRViVDfXTFn1NgrwWHhy/gIExJv442XOr3VFDSUoUqWl rBRy5pPiNBDD91ZtuHRVEAHNzuPJUeVfkLzwq6WW3lW5J8l8rWSABJcpVDzZBhdd vglZPIN/pXI23sn5ScjhCBJMauwpmhO+Gm2ZOnS+bJehY2CIuY/RdVfMM2jEJYFV o/AY+W5ZlUs82914lCPxLrEOXnOhIHR6hHa3+ce0GzIjTY/3zOulAlSQjExBixo7 WJLGqnmnJKhg+3y90FcN0/jmIoTdLRSZ4sBBHezmvlo8e7jRsmwxTyYWsywPJvzG EHMGdKQMOBrLBAkG8zEsqApdycVx5qkev6fla1MRPcjZgM22RYdMBePlHH27GMzE VShFXGkWTsY= =Rg1K -----END PGP SIGNATURE----- --=-=-=-- ------------=_1745757662-7419-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 11 Apr 2025 14:01:15 +0000 Received: from localhost ([127.0.0.1]:50965 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u3EwV-00006u-0z for submit@debbugs.gnu.org; Fri, 11 Apr 2025 10:01:15 -0400 Received: from lists.gnu.org ([2001:470:142::17]:59948) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u3EwT-0008Vv-Em for submit@debbugs.gnu.org; Fri, 11 Apr 2025 10:01:13 -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 1u3EwD-0005rR-Tu for guix-patches@gnu.org; Fri, 11 Apr 2025 10:00:57 -0400 Received: from mira.cbaines.net ([212.71.252.8]) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1u3EwB-0004g1-Uu for guix-patches@gnu.org; Fri, 11 Apr 2025 10:00:57 -0400 Received: from localhost (unknown [IPv6:2a02:6b67:e390:8b00::1ce5]) by mira.cbaines.net (Postfix) with ESMTPSA id 1E0C927BC49 for ; Fri, 11 Apr 2025 15:00:54 +0100 (BST) Received: from localhost (localhost [local]) by localhost (OpenSMTPD) with ESMTPA id a1e6e65d for ; Fri, 11 Apr 2025 14:00:53 +0000 (UTC) From: Christopher Baines To: guix-patches@gnu.org Subject: [PATCH] upstream: Do not update to same version. Date: Fri, 11 Apr 2025 15:00:53 +0100 Message-ID: X-Mailer: git-send-email 2.49.0 MIME-Version: 1.0 X-Debbugs-Cc: Christopher Baines , Josselin Poiret , Ludovic Courtès , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=212.71.252.8; envelope-from=mail@cbaines.net; helo=mira.cbaines.net X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.9 (/) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.1 (/) From: Maxim Cournoyer Previously, 'guix refresh --update' would do actually rewrite the file with the same version/hash information when the target version was the same as the current version: guix refresh --update idutils=4.6 idutils.scm: warning: downgrading 'idutils' from 4.6 to 4.6 [...] idutils.scm: idutils: updating from version 4.6 to version 4.6... This changes handles this case so that it does and prints nothing. * guix/upstream.scm (package-update): Use `version-compare' to distinguish the equal versions case. Change-Id: I079e030d573f5968725ef13b3f626e2f8d02cb2f --- guix/upstream.scm | 63 +++++++++++++++++++++++-------------------- tests/guix-refresh.sh | 9 +++++++ 2 files changed, 43 insertions(+), 29 deletions(-) diff --git a/guix/upstream.scm b/guix/upstream.scm index af09f62088..259c074412 100644 --- a/guix/upstream.scm +++ b/guix/upstream.scm @@ -525,39 +525,44 @@ (define* (package-update store package partially specified, in which case the package will be updated to the newest compatible version if there are no exact match for VERSION. For example, providing \"46\" as the version may update the package to version \"46.6.4\"." + (define (update* source) + (let ((method (match (package-source package) + ((? origin? origin) + (origin-method origin)) + (_ + #f)))) + (match (assq method %method-updates) + (#f + (raise (make-compound-condition + (formatted-message (G_ "cannot download for \ +this method: ~s") + method) + (condition + (&error-location + (location (package-location package))))))) + ((_ . update) + (update store package source + #:key-server key-server + #:key-download key-download))))) + (match (package-latest-release package updaters #:version version #:partial-version? partial-version?) ((? upstream-source? source) - (if (or (version>? (upstream-source-version source) - (package-version package)) - (and version - (begin - (warning (package-location package) - (G_ "downgrading '~a' from ~a to ~a~%") - (package-name package) - (package-version package) - (upstream-source-version source)) - #t))) - (let ((method (match (package-source package) - ((? origin? origin) - (origin-method origin)) - (_ - #f)))) - (match (assq method %method-updates) - (#f - (raise (make-compound-condition - (formatted-message (G_ "cannot download for \ -this method: ~s") - method) - (condition - (&error-location - (location (package-location package))))))) - ((_ . update) - (update store package source - #:key-server key-server - #:key-download key-download)))) - (values #f #f #f))) + (case (version-compare (upstream-source-version source) + (package-version package)) + ((>) + (update* source)) + ((<) + (and version + (warning (package-location package) + (G_ "downgrading '~a' from ~a to ~a~%") + (package-name package) + (package-version package) + (upstream-source-version source))) + (update* source)) + (else + (values #f #f #f)))) (#f ;; Warn rather than abort so that other updates can still take place. (if version diff --git a/tests/guix-refresh.sh b/tests/guix-refresh.sh index b5b38189cb..0f1af8cae7 100644 --- a/tests/guix-refresh.sh +++ b/tests/guix-refresh.sh @@ -44,6 +44,15 @@ case "$(guix refresh -t test idutils 2>&1)" in *"$idutils_version"*"already the latest version"*) true;; *) false;; esac + +# No-op when updating to same version. +case "$(guix refresh -t test -u idutils \ +--target-version=$idutils_version 2>&1)" in + *downgrading*) false;; + *updating*) false;; + *) true;; +esac + guix refresh -t test libreoffice # XXX: should return non-zero? case "$(guix refresh -t test libreoffice 2>&1)" in *"greater than the latest known version"*"1.0"*) true;; base-commit: 172e9a1aa1ee2ef3e557cf46a11e451aa7982983 -- 2.49.0 ------------=_1745757662-7419-1--