From patchwork Tue Mar 5 11:06:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 61374 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 4B5BF27BBEA; Tue, 5 Mar 2024 11:09:53 +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=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,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 6281F27BBE2 for ; Tue, 5 Mar 2024 11:09:52 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rhSfZ-00051M-7K; Tue, 05 Mar 2024 06:09:13 -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 1rhSew-00046n-Qb for guix-patches@gnu.org; Tue, 05 Mar 2024 06:08:39 -0500 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 1rhSew-0003Kh-D1; Tue, 05 Mar 2024 06:08:34 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rhSfO-0000B3-3R; Tue, 05 Mar 2024 06:09:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#69328] [PATCH v2 08/12] svn-download: Use =?utf-8?q?=E2=80=98s?= =?utf-8?q?wh-download-directory-by-nar-hash=E2=80=99=2E?= Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix@cbaines.net, dev@jpoiret.xyz, ludo@gnu.org, othacehe@gnu.org, rekado@elephly.net, zimon.toutoune@gmail.com, me@tobias.gr, guix-patches@gnu.org Resent-Date: Tue, 05 Mar 2024 11:09:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69328 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 69328@debbugs.gnu.org Cc: Timothy Sample , Ludovic =?utf-8?q?Court=C3=A8s?= , Christopher Baines , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by 69328-submit@debbugs.gnu.org id=B69328.1709636895594 (code B ref 69328); Tue, 05 Mar 2024 11:09:02 +0000 Received: (at 69328) by debbugs.gnu.org; 5 Mar 2024 11:08:15 +0000 Received: from localhost ([127.0.0.1]:46465 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rhSeW-00009D-OZ for submit@debbugs.gnu.org; Tue, 05 Mar 2024 06:08:15 -0500 Received: from eggs.gnu.org ([209.51.188.92]:49800) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rhSeL-00004u-2m for 69328@debbugs.gnu.org; Tue, 05 Mar 2024 06:07:58 -0500 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 1rhSdk-0002wu-6m; Tue, 05 Mar 2024 06:07:21 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=kn6fmIGpiP7s+2FT3HULwuTCk/sW1ObA6ST/vQdp6kI=; b=TMMOcWmt8tHItyhjXPMG ZyvE/vD49VCzqIvrzmuTzCXYv9Sezq8SdTpRtdl1V7pWBPKUfL8rDZNTXqXZHpKdvcFunDWVzCA4m pJpqJaWpFMWr2AYHMy83ZkzVQzPw7Jk17yx448DcTSaU9n50CbEW0mSfrTsxjB2HdUpwCZwFhL9sO XV7+ogQHF/oQ5XO1mjKWc3hGmAin0FxaSxjbV6j3HSTz6FQfnx2DqxuTpbe2QLpkr8YmCLXGC0Dew DJKdr4TKxjM6Zh4V7iO1lc6QAX6VR57A3AfaiSVHzCCjH56tW1wkP5VqfYdIvrfcYS26oJHh40gFf dfwVanRU66BgRw==; From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Tue, 5 Mar 2024 12:06:56 +0100 Message-ID: <81113a322b0f885ed0e09867b00a1ca46c6c7bbd.1709636144.git.ludo@gnu.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <87o7btc5du.fsf@gnu.org> References: <87o7btc5du.fsf@gnu.org> 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 Fixes . * guix/svn-download.scm (svn-fetch)[build]: Add ‘swh-download-directory-by-nar-hash’ call as a last resort. Import (guix swh). * guix/svn-download.scm (svn-multi-fetch)[build]: Likewise. Change-Id: Ifcb9be1e9c2b05ce172c44e45dcf3a3ea6df8e76 --- guix/svn-download.scm | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/guix/svn-download.scm b/guix/svn-download.scm index c6688908de..64af996a06 100644 --- a/guix/svn-download.scm +++ b/guix/svn-download.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2014-2016, 2019, 2021-2023 Ludovic Courtès +;;; Copyright © 2014-2016, 2019, 2021-2024 Ludovic Courtès ;;; Copyright © 2014 Sree Harsha Totakura ;;; Copyright © 2017, 2019, 2021 Ricardo Wurmus ;;; @@ -94,12 +94,14 @@ (define* (svn-fetch ref hash-algo hash (with-imported-modules (source-module-closure '((guix build svn) (guix build download-nar) - (guix build utils))) + (guix build utils) + (guix swh))) (with-extensions (list guile-json guile-gnutls ;for (guix swh) guile-lzlib) #~(begin (use-modules (guix build svn) (guix build download-nar) + (guix swh) (ice-9 match)) (or (svn-fetch (getenv "svn url") @@ -111,7 +113,10 @@ (define* (svn-fetch ref hash-algo hash (_ #f)) #:user-name (getenv "svn user name") #:password (getenv "svn password")) - (download-nar #$output)))))) + (download-nar #$output) + (parameterize ((%verify-swh-certificate? #f)) + (swh-download-directory-by-nar-hash #$hash '#$hash-algo + #$output))))))) (mlet %store-monad ((guile (package->derivation guile system))) (gexp->derivation (or name "svn-checkout") build @@ -174,13 +179,15 @@ (define* (svn-multi-fetch ref hash-algo hash (with-imported-modules (source-module-closure '((guix build svn) (guix build download-nar) - (guix build utils))) + (guix build utils) + (guix swh))) (with-extensions (list guile-json guile-gnutls ;for (guix swh) guile-lzlib) #~(begin (use-modules (guix build svn) (guix build utils) (guix build download-nar) + (guix swh) (srfi srfi-1) (ice-9 match)) @@ -206,7 +213,14 @@ (define* (svn-multi-fetch ref hash-algo hash (begin (when (file-exists? #$output) (delete-file-recursively #$output)) - (download-nar #$output))))))) + (or (download-nar #$output) + (parameterize ((%verify-swh-certificate? #f)) + ;; SWH keeps HASH as an ExtID for the combination of + ;; files/directories, which allows us to retrieve the + ;; entire combination at once: + ;; . + (swh-download-directory-by-nar-hash + #$hash '#$hash-algo #$output))))))))) (mlet %store-monad ((guile (package->derivation guile system))) (gexp->derivation (or name "svn-checkout") build