From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id kNWUAEnpIGdMcwEAe85BDQ:P1 (envelope-from ) for ; Tue, 29 Oct 2024 13:55:21 +0000 Received: from aspmx1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id kNWUAEnpIGdMcwEAe85BDQ (envelope-from ) for ; Tue, 29 Oct 2024 14:55:21 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=HRuGiOA8; dkim=fail ("headers rsa verify failed") header.d=ngraves.fr header.s=ovhmo4487190-selector1 header.b=W+fgb9rV; dmarc=pass (policy=none) header.from=gnu.org; 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" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1730210120; a=rsa-sha256; cv=none; b=G8AD0+gof6f3Fc8tJi8XRLskuJ3CQDGk45csrsnBGzvf4GXz7hIOUYqAL8/T1nxPt9kjvh tMzWRJDQx2mCvKQ6YDCOOoo0y4MjYcmjTmlSdJpMUWAo2a7C47iHJYtuYVea0J/3J3Iryk CMxzuS+XJbm0EaZ7PH2Az/eeoDqYcMvbjvoNEcVvKCZwsdhlzrfrkeq4N9JqVgF/mMHVZg XXQW32QbYIbglx7Jq3Pz/LRhXG9inhp560sRJPJ4cxaPMRrVMyqJ43jvaHHJrCWzc5PrFu 5eEwpnxb3TTmZYF5xEcWERhNaxXhYRz9TFteCIPxMyd2rro/CDyjOFLvlKVrrw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=HRuGiOA8; dkim=fail ("headers rsa verify failed") header.d=ngraves.fr header.s=ovhmo4487190-selector1 header.b=W+fgb9rV; dmarc=pass (policy=none) header.from=gnu.org; 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" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1730210120; h=from:from:sender:sender:reply-to: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=R3A178bNmJT/jN/X1syVBzPpwIHFtVu5ZqAAdm+sXm4=; b=ucArUcQyxr3i+uYiNsyFl49/aDAF57xJVz3b1kmdisAKleR7Kyfc9u/Xpviyx+UjgAWSdy +F9Jnk3La9L3k8hi+xkHGFkaSxMnpU1DBlR/vwm276Q7vcGCJ2s0sShCx8QLcxlX6iPnRT eMpHFF61ll13tufVmiqhv5xhGav++0AJ5McPhWAfb9EQJdE4Xv0hg14dPUOQaeDZlbcegE LWl3JwYmdEP59WRWo2LmLe1JE/jCEfVqbDJxy56dKg+Ivt+8XjiAG75LKhC/9sGCOIp2wJ JuoIHEi5viL57Lpem+p81FV57lNmnbcqKaKBaFhZcVZZQB/DftmCrFa8aG1m4A== 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 0A6181F1DC for ; Tue, 29 Oct 2024 14:55:20 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t5mgb-0000CO-Jq; Tue, 29 Oct 2024 09:55:06 -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 1t5mgY-0000AD-SX for guix-patches@gnu.org; Tue, 29 Oct 2024 09:55:03 -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 1t5mgY-0003iy-Bw for guix-patches@gnu.org; Tue, 29 Oct 2024 09:55:02 -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=R3A178bNmJT/jN/X1syVBzPpwIHFtVu5ZqAAdm+sXm4=; b=HRuGiOA8Ks3QWJejTZ9WyxTPp4hESARFKhGMxxJmPphVJ7EHgoq1HIdA/dyg2qeEERkyWphDodHZgfkXc+uz/PCSaB6K4U1O0dqP0muPJKKTVIWcfLhRpIkTXUJvUJZ8soJa77/s8Gw5SXn1GTNIhNwH4hGjAG4ozWSnkOEGOnKj1SexB870ppj/mUbYWcFESmt9p2SZtS6EyLglRWnLHTrNa9LVbZRYddanB/rI/vXnZkwgn1zyItPAmULvS5AITSSJJbyFDct46OgNFk3H6q6AOvIqVr39oZH7Gy3aqOVX1wVosoOyaD8HJDCIY9rrdWaQXzXKnPl3JnFsb/7YLQ==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1t5mgY-0005c0-5U for guix-patches@gnu.org; Tue, 29 Oct 2024 09:55:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#74086] [PATCH] guix: import: hackage: Support updating to a specific version. Resent-From: Nicolas Graves Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 29 Oct 2024 13:55:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 74086 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 74086@debbugs.gnu.org Cc: Nicolas Graves X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.173021005021516 (code B ref -1); Tue, 29 Oct 2024 13:55:01 +0000 Received: (at submit) by debbugs.gnu.org; 29 Oct 2024 13:54:10 +0000 Received: from localhost ([127.0.0.1]:56470 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t5mfh-0005as-6X for submit@debbugs.gnu.org; Tue, 29 Oct 2024 09:54:09 -0400 Received: from lists.gnu.org ([209.51.188.17]:44782) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t5mff-0005am-68 for submit@debbugs.gnu.org; Tue, 29 Oct 2024 09:54: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 1t5mfe-00006x-F8 for guix-patches@gnu.org; Tue, 29 Oct 2024 09:54:07 -0400 Received: from 5.mo581.mail-out.ovh.net ([178.32.120.239]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t5mfZ-0003dx-J7 for guix-patches@gnu.org; Tue, 29 Oct 2024 09:54:06 -0400 Received: from director11.ghost.mail-out.ovh.net (unknown [10.108.17.183]) by mo581.mail-out.ovh.net (Postfix) with ESMTP id 4XdBYx1lygz1F5f for ; Tue, 29 Oct 2024 13:53:57 +0000 (UTC) Received: from ghost-submission-5b5ff79f4f-nzvfc (unknown [10.108.42.46]) by director11.ghost.mail-out.ovh.net (Postfix) with ESMTPS id 99ADD1FE31; Tue, 29 Oct 2024 13:53:56 +0000 (UTC) Received: from ngraves.fr ([37.59.142.108]) by ghost-submission-5b5ff79f4f-nzvfc with ESMTPSA id BSDNBvToIGeamggAfSYmxw (envelope-from ); Tue, 29 Oct 2024 13:53:56 +0000 X-OVh-ClientIp: 86.246.19.221 Date: Tue, 29 Oct 2024 14:53:51 +0100 Message-ID: <20241029135354.17423-1-ngraves@ngraves.fr> X-Mailer: git-send-email 2.46.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Ovh-Tracer-Id: 16786323186188477154 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: 0 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeeftddrvdekuddgheefucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucenucfjughrpefhvfevufffkffogggtgfesthekredtredtjeenucfhrhhomheppfhitgholhgrshcuifhrrghvvghsuceonhhgrhgrvhgvshesnhhgrhgrvhgvshdrfhhrqeenucggtffrrghtthgvrhhnpedtleelfedvveehuedtveffgeegteeifeffvefftedvleegvdevgeeuieelgeeuveenucffohhmrghinhephhgrshhkvghllhdrohhrghenucfkphepuddvjedrtddrtddruddpkeeirddvgeeirdduledrvddvuddpfeejrdehledrudegvddruddtkeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeduvdejrddtrddtrddupdhmrghilhhfrhhomhepnhhgrhgrvhgvshesnhhgrhgrvhgvshdrfhhrpdhnsggprhgtphhtthhopedupdhrtghpthhtohepghhuihigqdhprghttghhvghssehgnhhurdhorhhgpdfovfetjfhoshhtpehmohehkedupdhmohguvgepshhmthhpohhuth DKIM-Signature: a=rsa-sha256; bh=R3A178bNmJT/jN/X1syVBzPpwIHFtVu5ZqAAdm+sXm4=; c=relaxed/relaxed; d=ngraves.fr; h=From; s=ovhmo4487190-selector1; t=1730210037; v=1; b=W+fgb9rVwXPM9TeGkUOYSxruiHGS/ccPtlpYH0N9dpN1QimjnNpAKdDnrIrQJjf2NlPCYME3 X7OoiYBY3LM8FYdwwKuQb4ChdNte4LdG0PNwD/q20hM17kfdWZtLGmP0Y8/Sh0qXGQCc6DVSuOX xm52O8JCbZZKzoSizoXjk9saNR/cF4lFdMaBkz7TvGk3j/GCDtzK8osNa4GRTuOivxFlEKB+P7G +q+9W7ao4Wrb9hFl146Dg0qkIr4n7HiSgVkovLZj/oWxZPL+NZSct7z33jbqBkSf1crMXKXJ8IV 7wowiiOmsaaMeurIpcZjwCVHdOdUthulPSEzRwTdSXvtA== Received-SPF: pass client-ip=178.32.120.239; envelope-from=ngraves@ngraves.fr; helo=5.mo581.mail-out.ovh.net 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, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, 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: , Reply-to: Nicolas Graves X-ACL-Warn: , Nicolas Graves via Guix-patches From: Nicolas Graves via Guix-patches via 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-Spam-Score: 0.53 X-Spam-Score: 0.53 X-Migadu-Queue-Id: 0A6181F1DC X-Migadu-Scanner: mx12.migadu.com X-TUID: FGnw8u+v8zzD * gnu/import/hackage.scm (hackage-fetch-and-hash, hackage-fetch): Support name and version argument. (import-release): New variable, formerly known as latest-release. Support updating to a specific version. --- guix/import/hackage.scm | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/guix/import/hackage.scm b/guix/import/hackage.scm index 79a51d3300..e3ed98c089 100644 --- a/guix/import/hackage.scm +++ b/guix/import/hackage.scm @@ -9,6 +9,7 @@ ;;; Copyright © 2019 Simon Tournier ;;; Copyright © 2022 Hartmut Goebel ;;; Copyright © 2023-2024 Ludovic Courtès +;;; Copyright © 2024 Nicolas Graves ;;; ;;; This file is part of GNU Guix. ;;; @@ -136,7 +137,7 @@ (define (read-cabal-and-hash port) (values (read-cabal (canonical-newline-port port)) (bytevector->nix-base32-string (get-hash))))) -(define (hackage-fetch-and-hash name-version) +(define (hackage-fetch-and-hash name version) "Fetch the latest Cabal revision for the package NAME-VERSION, and return two values: the parsed Cabal file and its hash in nix-base32 format. If the version part is omitted from the package name, then fetch the latest @@ -144,18 +145,19 @@ (define (hackage-fetch-and-hash name-version) (guard (c ((and (http-get-error? c) (= 404 (http-get-error-code c))) (values #f #f))) ;"expected" if package is unknown - (let* ((name version (package-name->name+version name-version)) - (url (hackage-cabal-url name version)) - (port _ (http-fetch url)) - (cabal hash (read-cabal-and-hash port))) + (let* ((name new-version (package-name->name+version name)) + (version (or version new-version)) + (url (hackage-cabal-url name version)) + (port _ (http-fetch url)) + (cabal hash (read-cabal-and-hash port))) (close-port port) (values cabal hash)))) -(define (hackage-fetch name-version) +(define (hackage-fetch name version) "Return the Cabal file for the package NAME-VERSION, or #f on failure. If the version part is omitted from the package name, then return the latest version." - (let ((cabal hash (hackage-fetch-and-hash name-version))) + (let ((cabal hash (hackage-fetch-and-hash name version))) cabal)) (define string->license @@ -377,15 +379,10 @@ (define hackage-package? (let ((hackage-rx (make-regexp "(https?://hackage.haskell.org|mirror://hackage/)"))) (url-predicate (cut regexp-exec hackage-rx <>)))) -(define* (latest-release package #:key (version #f)) +(define* (import-release package #:key (version #f)) "Return an for the latest release of PACKAGE." - (when version - (raise - (formatted-message - (G_ "~a updater doesn't support updating to a specific version, sorry.") - "hackage"))) (let* ((hackage-name (package-upstream-name* package)) - (cabal-meta (hackage-fetch hackage-name))) + (cabal-meta (hackage-fetch hackage-name version))) (match cabal-meta (#f (format (current-error-port) @@ -407,6 +404,6 @@ (define %hackage-updater (name 'hackage) (description "Updater for Hackage packages") (pred hackage-package?) - (import latest-release))) + (import import-release))) ;;; cabal.scm ends here -- 2.46.0