From patchwork Sun Aug 28 13:18:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Hartmut Goebel X-Patchwork-Id: 42040 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 A985327BBEA; Sun, 28 Aug 2022 14:21:34 +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=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, SPF_HELO_PASS 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 E394727BBE9 for ; Sun, 28 Aug 2022 14:21:33 +0100 (BST) Received: from localhost ([::1]:34688 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oSIEH-000669-2y for patchwork@mira.cbaines.net; Sun, 28 Aug 2022 09:21:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59418) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oSICw-0002zU-CY for guix-patches@gnu.org; Sun, 28 Aug 2022 09:20:11 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:39845) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oSICw-0002gF-0H for guix-patches@gnu.org; Sun, 28 Aug 2022 09:20:10 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oSICv-0006zK-Se for guix-patches@gnu.org; Sun, 28 Aug 2022 09:20:09 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#57460] [PATCH 16/20] refresh: Allow updating to a specific version (upstream) Resent-From: Hartmut Goebel Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 28 Aug 2022 13:20:09 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 57460 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 57460@debbugs.gnu.org Received: via spool by 57460-submit@debbugs.gnu.org id=B57460.166169278226699 (code B ref 57460); Sun, 28 Aug 2022 13:20:09 +0000 Received: (at 57460) by debbugs.gnu.org; 28 Aug 2022 13:19:42 +0000 Received: from localhost ([127.0.0.1]:57806 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oSICT-0006wP-C1 for submit@debbugs.gnu.org; Sun, 28 Aug 2022 09:19:41 -0400 Received: from mout.kundenserver.de ([212.227.126.130]:44637) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oSICK-0006uv-1e for 57460@debbugs.gnu.org; Sun, 28 Aug 2022 09:19:32 -0400 Received: from hermia.goebel-consult.de ([46.87.137.46]) by mrelayeu.kundenserver.de (mreue009 [212.227.15.167]) with ESMTPSA (Nemesis) id 1Mzz6s-1pO7wG1tjS-00x6Yq for <57460@debbugs.gnu.org>; Sun, 28 Aug 2022 15:19:26 +0200 Received: from lenashee.fritz.box (lenashee.goebel-consult.de [192.168.110.2]) by hermia.goebel-consult.de (Postfix) with ESMTP id 59DDA65A4C; Sun, 28 Aug 2022 15:18:56 +0200 (CEST) From: Hartmut Goebel Date: Sun, 28 Aug 2022 15:18:42 +0200 Message-Id: <02bbc32e2c9955e4bcbe535c38cafba4bc6034bc.1661691694.git.h.goebel@crazy-compilers.com> X-Mailer: git-send-email 2.30.4 In-Reply-To: References: MIME-Version: 1.0 X-Provags-ID: V03:K1:M2LKrxbOYco6sPdloA2CMg1+DDM3iE5CZ8EJ5f5Rc4z9GFrEuFE uMELBjLOKC82Vuj0GbxmbZvsnAhxN+Bq3SreVWKYxdO+2XGt6894NwfNunRo0V9jiAuLyJV WLiHD3LxtXaxKgGnl+CtiIv2y3Lz2+axaBPU0WsRHGjdZRziKy/AMlwRZWEzySeXdN+hwwd vTfaKgYwHehCk9WQFz14g== X-UI-Out-Filterresults: notjunk:1;V03:K0:PHLuffk9/RM=:cU+Rw+m+cmUpA8w2AJGaFb vF4sWN6z9k2AOnTGRAhIhFD+wjLxi8HfNAOERngZDQGtU5rCidgewa3TpiouUZ3KYef52ux73 aNySaluj2ezedErbR0XqkZ8nl46gTkuidxIcLp1wW/kf9DgWNtwH3U1AnGPgxVjFTRNE/ITXA zWnsown6M9kY3e2PN4nw6n3W7Do+4o3QhgW3Zllz7J4d44BetOXtePj2SH5aEdkK5a7t7mEXg 7NbPdKJu8h7NB6RFJ/ubjaoSBuZs1r7AaIyILc0XIB9olPfwG52cYhvv1iA6CCMDET2tEbkoK ezZL075zdkX1gccp2K3nXz+6C2KCMk0NqXe11z3qgcdyBykqyU1eAe+hjjj/d+BkBwzNTGIAV qkj3EDQPBAnEw/zmVlBwWI3O437EdEgmYUo2Z7mDt4G4JFZxqGNmS3N8GmGsHrbFveFty2YUx g7MT6LwUTT4e1+JdiEnRYSaouXCemKFtUjIXpr9nj0j6ao7HwaJcyRgGOT/lK5s55x37g2PGg sGqAPaq+98GrNbjCiOulGaBS1/S6N1WyY+Umy3IoKwnRrp2JDRkZ/JtrXwXuByiANtjfxt78R mX7KwdhehfImvEdokcaDROPN70VSWuvciZt6X2aepxruvtWA1Y0tgFL9rTOpWIsB2BnYQe6Qc KwNyVS2qK1/fAZRd83sRENsgihhwV/sihmV9uuA108vVs/qnVg8scpKPKV6dezJj9UXZNUON6 D18i79toPKcYV9HkZ5/gomLAToVLc7BJ7ZQ2yotkKdaLByhSjtpUFm5g8sU= 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" X-getmail-retrieved-from-mailbox: Patches * guix/upstream.scm(package-latest-release): Add keyword-argument 'version' and pass it on to the updater's 'import' function. (package-update): add keyword-argument 'version' and pass it on to package-latest-release. Differentiate the error message issued when no package was found, depending on whether version was given or not. --- guix/upstream.scm | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/guix/upstream.scm b/guix/upstream.scm index 6cee6440c3..faffb3347a 100644 --- a/guix/upstream.scm +++ b/guix/upstream.scm @@ -4,6 +4,7 @@ ;;; Copyright © 2019, 2022 Ricardo Wurmus ;;; Copyright © 2021 Sarah Morgensen ;;; Copyright © 2021, 2022 Maxime Devos +;;; Copyright © 2022 Hartmut Goebel ;;; ;;; This file is part of GNU Guix. ;;; @@ -277,7 +278,8 @@ them matches." (define* (package-latest-release package #:optional - (updaters (force %updaters))) + (updaters (force %updaters)) + #:key (version #f)) "Return an upstream source to update PACKAGE, a object, or #f if none of UPDATERS matches PACKAGE. When several updaters match PACKAGE, try them until one of them returns an upstream source. It is the caller's @@ -286,7 +288,7 @@ one." (any (match-lambda (($ name description pred import) (and (pred package) - (import package)))) + (import package #:version version)))) updaters)) (define* (package-latest-release* package @@ -490,13 +492,13 @@ SOURCE, an ." (define* (package-update store package #:optional (updaters (force %updaters)) - #:key (key-download 'interactive)) + #:key (key-download 'interactive) (version #f)) "Return the new version, the file name of the new version tarball, and input changes for PACKAGE; return #f (three values) when PACKAGE is up-to-date; raise an error when the updater could not determine available releases. KEY-DOWNLOAD specifies a download policy for missing OpenPGP keys; allowed values: 'always', 'never', and 'interactive' (default)." - (match (package-latest-release package updaters) + (match (package-latest-release package updaters #:version version) ((? upstream-source? source) (if (version>? (upstream-source-version source) (package-version package)) @@ -520,8 +522,11 @@ this method: ~s") (values #f #f #f))) (#f ;; Warn rather than abort so that other updates can still take place. - (warning (G_ "updater failed to determine available releases for ~a~%") - (package-name package)) + (if version + (warning (G_ "updater failed to find release ~a@~a~%") + (package-name package) version) + (warning (G_ "updater failed to determine available releases for ~a~%") + (package-name package))) (values #f #f #f)))) (define* (update-package-source package source hash)