From patchwork Fri Apr 11 14:00:53 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christopher Baines X-Patchwork-Id: 41587 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 3BB1A27BC4B; Fri, 11 Apr 2025 15:02:15 +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_INVALID, DKIM_SIGNED,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 9782E27BC49 for ; Fri, 11 Apr 2025 15:02:14 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1u3ExO-00066J-3B; Fri, 11 Apr 2025 10:02:10 -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 1u3ExK-00063E-VP for guix-patches@gnu.org; Fri, 11 Apr 2025 10:02: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 1u3ExJ-0004nJ-BA; Fri, 11 Apr 2025 10:02:05 -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=XcdqVVKdF3S7lc1Tyg4PeyhYR9dar/5g9Wmnm993pAc=; b=ZI4R57GOH98MvGNCW259NUhsW9lIhwP8c68j7jp7lA2Y+ExWHrRm9E3CX+M5/9dGg8lunLYCZ6XQkf3Rbk9SY/p0Yb1dhNvgv3i1+y7pATA5/uST4RzE0eWjeXxsxHpAxhGo4XV6iMBdTsveCzL5jLIz0/rC32wMzF4OpOqG/AP8hHxAbuquvcy3CFikk9NVF+7cg1UTgKtofMOhcSbbKgCbr9qVDq+BFcWWtXJ+Z/Y3R9NglyckyNvK4ZiayQ227qzwI2iHZ5ynBdeSVvErSm7nrxpve85Cjy48InldGihikO5ftelMV9Mj4n+yi6Iac2N9IjTh844Wz9j/LOt/GA==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1u3ExG-0000BF-J3; Fri, 11 Apr 2025 10:02:02 -0400 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 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-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 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(-) base-commit: 172e9a1aa1ee2ef3e557cf46a11e451aa7982983 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;;