From patchwork Mon Jul 10 09:20:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christopher Baines X-Patchwork-Id: 51658 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 2BB3827BBE9; Mon, 10 Jul 2023 10:22:24 +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 A351D27BBE2 for ; Mon, 10 Jul 2023 10:22:23 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIn5t-0006xq-D4; Mon, 10 Jul 2023 05:22:09 -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 1qIn5s-0006xX-4H for guix-patches@gnu.org; Mon, 10 Jul 2023 05:22:08 -0400 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 1qIn5r-0008MX-PH; Mon, 10 Jul 2023 05:22:07 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qIn5m-0007PQ-N0; Mon, 10 Jul 2023 05:22:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#64551] [PATCH] svn-download: Use download-nar. Resent-From: Christopher Baines Original-Sender: "Debbugs-submit" Resent-CC: mail@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: Mon, 10 Jul 2023 09:22:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 64551 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 64551@debbugs.gnu.org Cc: Christopher Baines , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Ricardo Wurmus , 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 , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by submit@debbugs.gnu.org id=B.168898086128387 (code B ref -1); Mon, 10 Jul 2023 09:22:02 +0000 Received: (at submit) by debbugs.gnu.org; 10 Jul 2023 09:21:01 +0000 Received: from localhost ([127.0.0.1]:47741 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qIn4m-0007NZ-RB for submit@debbugs.gnu.org; Mon, 10 Jul 2023 05:21:01 -0400 Received: from lists.gnu.org ([209.51.188.17]:33066) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qIn4l-0007NS-9F for submit@debbugs.gnu.org; Mon, 10 Jul 2023 05:20:59 -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 1qIn4k-0006gV-6X for guix-patches@gnu.org; Mon, 10 Jul 2023 05:20:59 -0400 Received: from mira.cbaines.net ([212.71.252.8]) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qIn4i-000776-4D for guix-patches@gnu.org; Mon, 10 Jul 2023 05:20:57 -0400 Received: from localhost (unknown [IPv6:2a02:8010:68c1:0:3a91:a0a4:ecee:f157]) by mira.cbaines.net (Postfix) with ESMTPSA id C5EA427BBE2 for ; Mon, 10 Jul 2023 10:20:54 +0100 (BST) Received: from localhost (localhost [local]) by localhost (OpenSMTPD) with ESMTPA id 84e6f761 for ; Mon, 10 Jul 2023 09:20:54 +0000 (UTC) From: Christopher Baines Date: Mon, 10 Jul 2023 10:20:54 +0100 Message-ID: X-Mailer: git-send-email 2.41.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, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, 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 This should help if there are issues fetching from the source repository. * guix/svn-download.scm (svn-fetch): Use download-nar and adjust accordingly. --- guix/svn-download.scm | 45 +++++++++++++++++++++++++++++-------------- 1 file changed, 31 insertions(+), 14 deletions(-) base-commit: 9c164d72b2bbdb1823befb32bede82f6af431750 prerequisite-patch-id: 08325c0c53413d75ee6dbb363626fd11858a2960 diff --git a/guix/svn-download.scm b/guix/svn-download.scm index 769571b5f6..6a53d5d2eb 100644 --- a/guix/svn-download.scm +++ b/guix/svn-download.scm @@ -23,6 +23,7 @@ (define-module (guix svn-download) #:use-module (guix gexp) #:use-module (guix store) #:use-module (guix monads) + #:use-module (guix modules) #:use-module (guix packages) #:use-module (guix utils) #:use-module ((guix build svn) #:prefix build:) @@ -79,22 +80,38 @@ (define* (svn-fetch ref hash-algo hash "Return a fixed-output derivation that fetches REF, a object. The output is expected to have recursive hash HASH of type HASH-ALGO (a symbol). Use NAME as the file name, or a generic name if #f." + + (define guile-json + (module-ref (resolve-interface '(gnu packages guile)) 'guile-json-4)) + + (define guile-lzlib + (module-ref (resolve-interface '(gnu packages guile)) 'guile-lzlib)) + + (define guile-gnutls + (module-ref (resolve-interface '(gnu packages tls)) 'guile-gnutls)) + (define build - (with-imported-modules '((guix build svn) - (guix build utils)) - #~(begin - (use-modules (guix build svn) - (ice-9 match)) + (with-imported-modules + (source-module-closure '((guix build svn) + (guix build download-nar) + (guix build utils))) + (with-extensions (list guile-json guile-gnutls ;for (guix swh) + guile-lzlib) + #~(begin + (use-modules (guix build svn) + (guix build download-nar) + (ice-9 match)) - (svn-fetch (getenv "svn url") - (string->number (getenv "svn revision")) - #$output - #:svn-command #+(file-append svn "/bin/svn") - #:recursive? (match (getenv "svn recursive?") - ("yes" #t) - (_ #f)) - #:user-name (getenv "svn user name") - #:password (getenv "svn password"))))) + (or (svn-fetch (getenv "svn url") + (string->number (getenv "svn revision")) + #$output + #:svn-command #+(file-append svn "/bin/svn") + #:recursive? (match (getenv "svn recursive?") + ("yes" #t) + (_ #f)) + #:user-name (getenv "svn user name") + #:password (getenv "svn password")) + (download-nar #$output)))))) (mlet %store-monad ((guile (package->derivation guile system))) (gexp->derivation (or name "svn-checkout") build