From patchwork Sat Feb 11 10:08:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lars-Dominik Braun X-Patchwork-Id: 46818 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 7C5AB16620; Sat, 11 Feb 2023 10:10:11 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-3.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, URIBL_BLOCKED autolearn=ham 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 3FB661661A for ; Sat, 11 Feb 2023 10:10:10 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pQmop-0004sk-6W; Sat, 11 Feb 2023 05:09:19 -0500 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 1pQmob-0004nr-BP for guix-patches@gnu.org; Sat, 11 Feb 2023 05:09:08 -0500 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pQmoa-00009G-F5 for guix-patches@gnu.org; Sat, 11 Feb 2023 05:09:05 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pQmoa-0004CS-BB for guix-patches@gnu.org; Sat, 11 Feb 2023 05:09:04 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#61420] [PATCH 08/31] import: hackage: Use upstream-name property. Resent-From: Lars-Dominik Braun Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 11 Feb 2023 10:09:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61420 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 61420@debbugs.gnu.org Cc: Lars-Dominik Braun Received: via spool by 61420-submit@debbugs.gnu.org id=B61420.167611013415975 (code B ref 61420); Sat, 11 Feb 2023 10:09:04 +0000 Received: (at 61420) by debbugs.gnu.org; 11 Feb 2023 10:08:54 +0000 Received: from localhost ([127.0.0.1]:38866 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pQmoQ-00049V-4r for submit@debbugs.gnu.org; Sat, 11 Feb 2023 05:08:54 -0500 Received: from mout-p-202.mailbox.org ([80.241.56.172]:34006) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pQmoH-00046S-6n for 61420@debbugs.gnu.org; Sat, 11 Feb 2023 05:08:46 -0500 Received: from smtp102.mailbox.org (smtp102.mailbox.org [10.196.197.102]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-202.mailbox.org (Postfix) with ESMTPS id 4PDRBs5bPnz9sct; Sat, 11 Feb 2023 11:08:37 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6xq.net; s=MBO0001; t=1676110117; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=C3HB5SFk4WX9OxVAJbPys7QyQzJJ3Jupv4d+mbJHNg8=; b=HS0Pbb/KnpV5LNHALMIY+w1ILBgTXBmmdVT6uDpDIqWYsErG1LPVvZUi9JKAft+6FqGc6W pSGvGjJyHMX4WCaApbiIbWVN21DDi9zAcYSnMAXHWKCIER0kBNMITHp6fQYute0NQeag1m IrMMPD+OuYAbEDGC++D3LCyWTnV82cS3qH2+Wag80eU3m8zxDUv1NGP9MOdgSzfYJ4BFPO BN8TJu0pqSCtw5mtekQEq3pCJze7Dl9336WcjOKHK7Yy1YGFWEbhKD+50KqJUzlblzZL8w xX5WQCLltWgU5a4zBMwzSxvxiTO7/ZJLXOUL5KmOswVQfp7rppgcGiDiW7UIYw== From: Lars-Dominik Braun Date: Sat, 11 Feb 2023 11:08:04 +0100 Message-Id: <20230211100825.47971-7-lars@6xq.net> In-Reply-To: <20230211100825.47971-1-lars@6xq.net> References: <20230211100825.47971-1-lars@6xq.net> MIME-Version: 1.0 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 * guix/import/hackage.scm (guix-package->hackage-name): Removed. (latest-release): Use package-upstream-name* instead. * guix/import/stackage.scm (latest-lts-release): Ditto. (stackage-lts-package?): Ditto. --- guix/import/hackage.scm | 14 +------------- guix/import/stackage.scm | 4 ++-- 2 files changed, 3 insertions(+), 15 deletions(-) diff --git a/guix/import/hackage.scm b/guix/import/hackage.scm index 9e305cf080..2f901af47b 100644 --- a/guix/import/hackage.scm +++ b/guix/import/hackage.scm @@ -52,7 +52,6 @@ (define-module (guix import hackage) hackage-recursive-import %hackage-updater - guix-package->hackage-name hackage-name->package-name hackage-fetch hackage-source-url @@ -126,17 +125,6 @@ (define (hackage-name->package-name name) (string-downcase name) (string-append package-name-prefix (string-downcase name)))) -(define guix-package->hackage-name - (let ((uri-rx (make-regexp "(https?://hackage.haskell.org|mirror://hackage)/package/([^/]+)/.*")) - (name-rx (make-regexp "(.*)-[0-9\\.]+"))) - (lambda (package) - "Given a Guix package name, return the corresponding Hackage name." - (let* ((source-url (and=> (package-source package) origin-uri)) - (name (match:substring (regexp-exec uri-rx source-url) 2))) - (match (regexp-exec name-rx name) - (#f name) - (m (match:substring m 1))))))) - (define (read-cabal-and-hash port) "Read a Cabal file from PORT and return it and its hash in nix-base32 format as two values." @@ -371,7 +359,7 @@ (define* (latest-release package #:key (version #f)) (formatted-message (G_ "~a updater doesn't support updating to a specific version, sorry.") "hackage"))) - (let* ((hackage-name (guix-package->hackage-name package)) + (let* ((hackage-name (package-upstream-name* package)) (cabal-meta (hackage-fetch hackage-name))) (match cabal-meta (#f diff --git a/guix/import/stackage.scm b/guix/import/stackage.scm index 9462e70791..735eeb75f7 100644 --- a/guix/import/stackage.scm +++ b/guix/import/stackage.scm @@ -149,7 +149,7 @@ (define latest-lts-release (formatted-message (G_ "~a updater doesn't support updating to a specific version, sorry.") "stackage"))) - (let* ((hackage-name (guix-package->hackage-name pkg)) + (let* ((hackage-name (package-upstream-name* pkg)) (version (lts-package-version (packages) hackage-name)) (name-version (hackage-name-version hackage-name version))) (match (and=> name-version hackage-fetch) @@ -173,7 +173,7 @@ (define (stackage-lts-package? package) (false-if-networking-error (let ((packages (stackage-lts-packages (stackage-lts-info-fetch %default-lts-version))) - (hackage-name (guix-package->hackage-name package))) + (hackage-name (package-upstream-name* package))) (find (lambda (package) (string=? (stackage-package-name package) hackage-name)) packages)))))