From patchwork Mon Oct 12 21:09:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 24597 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 B8AA427BBEB; Mon, 12 Oct 2020 22:11:16 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 190AD27BBEA for ; Mon, 12 Oct 2020 22:11:15 +0100 (BST) Received: from localhost ([::1]:39444 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kS56A-0005r0-73 for patchwork@mira.cbaines.net; Mon, 12 Oct 2020 17:11:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45724) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kS55z-0005p9-06 for guix-patches@gnu.org; Mon, 12 Oct 2020 17:11:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:60784) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kS55y-0006yU-LT for guix-patches@gnu.org; Mon, 12 Oct 2020 17:11:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kS55y-00065I-F3 for guix-patches@gnu.org; Mon, 12 Oct 2020 17:11:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#43968] [PATCH 1/3] git: Require Guile-Git 0.3.0 or later. References: <20201012204957.8320-1-ludo@gnu.org> In-Reply-To: <20201012204957.8320-1-ludo@gnu.org> Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 12 Oct 2020 21:11:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 43968 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 43968@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= Received: via spool by 43968-submit@debbugs.gnu.org id=B43968.160253702023320 (code B ref 43968); Mon, 12 Oct 2020 21:11:02 +0000 Received: (at 43968) by debbugs.gnu.org; 12 Oct 2020 21:10:20 +0000 Received: from localhost ([127.0.0.1]:44092 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kS55E-00063x-Ca for submit@debbugs.gnu.org; Mon, 12 Oct 2020 17:10:20 -0400 Received: from eggs.gnu.org ([209.51.188.92]:38632) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kS559-00063S-L0 for 43968@debbugs.gnu.org; Mon, 12 Oct 2020 17:10:15 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:50495) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kS553-0006hm-Mw; Mon, 12 Oct 2020 17:10:05 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=54554 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1kS552-0005SP-V4; Mon, 12 Oct 2020 17:10:05 -0400 From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Mon, 12 Oct 2020 23:09:53 +0200 Message-Id: <20201012210955.8753-1-ludo@gnu.org> X-Mailer: git-send-email 2.28.0 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" X-getmail-retrieved-from-mailbox: Patches * guix/git.scm (auth-supported?): Remove. (clone*): Inline code that was dependent on AUTH-SUPPORTED?. (update-cached-checkout): Likewise. (resolve-reference): Remove check for 'object-lookup-prefix' and use it unconditionally. (load-git-submodules): Remove. (update-submodules): Use 'repository-submodules', 'submodule-lookup', etc. unconditionally. (update-cached-checkout): Use 'repository-close!' unconditionally. * m4/guix.m4 (GUIX_CHECK_GUILE_GIT): New macro. * configure.ac: Use it and error out when it fails. * doc/guix.texi (Requirements): Bump to Guile-Git 0.3.0. --- configure.ac | 5 +++ doc/guix.texi | 4 +-- guix/git.scm | 84 ++++++++++++++------------------------------------- m4/guix.m4 | 22 ++++++++++++++ 4 files changed, 52 insertions(+), 63 deletions(-) diff --git a/configure.ac b/configure.ac index 6861112eaf..6e718afdd1 100644 --- a/configure.ac +++ b/configure.ac @@ -144,6 +144,11 @@ if test "x$guix_cv_have_recent_guile_gcrypt" != "xyes"; then AC_MSG_ERROR([A recent Guile-Gcrypt could not be found; please install it.]) fi +GUIX_CHECK_GUILE_GIT +if test "x$guix_cv_have_recent_guile_git" != "xyes"; then + AC_MSG_ERROR([A recent Guile-Git could not be found; please install it.]) +fi + dnl Check for Guile-zlib. GUILE_MODULE_AVAILABLE([have_guile_zlib], [(zlib)]) if test "x$have_guile_zlib" != "xyes"; then diff --git a/doc/guix.texi b/doc/guix.texi index 7150adeaa8..73156e9492 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -809,8 +809,8 @@ or later; @item @uref{https://notabug.org/guile-lzlib/guile-lzlib, Guile-lzlib}; @item @c FIXME: Specify a version number once a release has been made. -@uref{https://gitlab.com/guile-git/guile-git, Guile-Git}, from August -2017 or later; +@uref{https://gitlab.com/guile-git/guile-git, Guile-Git}, version 0.3.0 +or later; @item @uref{https://savannah.nongnu.org/projects/guile-json/, Guile-JSON} 4.3.0 or later; @item @url{https://www.gnu.org/software/make/, GNU Make}. diff --git a/guix/git.scm b/guix/git.scm index 637936c16a..cfb8d626f5 100644 --- a/guix/git.scm +++ b/guix/git.scm @@ -20,6 +20,7 @@ (define-module (guix git) #:use-module (git) #:use-module (git object) + #:use-module (git submodule) #:use-module (guix i18n) #:use-module (guix base32) #:use-module (gcrypt hash) @@ -116,10 +117,6 @@ the 'SSL_CERT_FILE' and 'SSL_CERT_DIR' environment variables." (string-append "R:" url) url)))))) -;; Authentication appeared in Guile-Git 0.3.0, check if it is available. -(define auth-supported? - (false-if-exception (resolve-interface '(git auth)))) - (define (clone* url directory) "Clone git repository at URL into DIRECTORY. Upon failure, make sure no empty directory is left behind." @@ -127,18 +124,10 @@ make sure no empty directory is left behind." (lambda () (mkdir-p directory) - ;; Note: Explicitly pass options to work around the invalid default - ;; value in Guile-Git: . - (if (module-defined? (resolve-interface '(git)) - 'clone-init-options) - (let ((auth-method (and auth-supported? - (%make-auth-ssh-agent)))) - (clone url directory - (if auth-supported? - (make-clone-options - #:fetch-options (make-fetch-options auth-method)) - (clone-init-options)))) - (clone url directory))) + (let ((auth-method (%make-auth-ssh-agent))) + (clone url directory + (make-clone-options + #:fetch-options (make-fetch-options auth-method))))) (lambda _ (false-if-exception (rmdir directory))))) @@ -167,12 +156,7 @@ corresponding Git object." ;; read out-of-bounds when passed a string shorter than 40 chars, ;; which is why we delay calls to it below. (if (< len 40) - (if (module-defined? (resolve-interface '(git object)) - 'object-lookup-prefix) - (object-lookup-prefix repository (string->oid commit) len) - (raise (condition - (&message - (message "long Git object ID is required"))))) + (object-lookup-prefix repository (string->oid commit) len) (object-lookup repository (string->oid commit))))) (('tag-or-commit . str) (if (or (> (string-length str) 40) @@ -234,40 +218,23 @@ dynamic extent of EXP." (lambda (key err) (report-git-error err)))) -(define (load-git-submodules) - "Attempt to load (git submodules), which was missing until Guile-Git 0.2.0. -Return true on success, false on failure." - (match (false-if-exception (resolve-interface '(git submodule))) - (#f - (set! load-git-submodules (const #f)) - #f) - (iface - (module-use! (resolve-module '(guix git)) iface) - (set! load-git-submodules (const #t)) - #t))) - (define* (update-submodules repository #:key (log-port (current-error-port))) "Update the submodules of REPOSITORY, a Git repository object." - ;; Guile-Git < 0.2.0 did not have (git submodule). - (if (load-git-submodules) - (for-each (lambda (name) - (let ((submodule (submodule-lookup repository name))) - (format log-port (G_ "updating submodule '~a'...~%") - name) - (submodule-update submodule) + (for-each (lambda (name) + (let ((submodule (submodule-lookup repository name))) + (format log-port (G_ "updating submodule '~a'...~%") + name) + (submodule-update submodule) - ;; Recurse in SUBMODULE. - (let ((directory (string-append - (repository-working-directory repository) - "/" (submodule-path submodule)))) - (with-repository directory repository - (update-submodules repository - #:log-port log-port))))) - (repository-submodules repository)) - (format (current-error-port) - (G_ "Support for submodules is missing; \ -please upgrade Guile-Git.~%")))) + ;; Recurse in SUBMODULE. + (let ((directory (string-append + (repository-working-directory repository) + "/" (submodule-path submodule)))) + (with-repository directory repository + (update-submodules repository + #:log-port log-port))))) + (repository-submodules repository))) (define-syntax-rule (false-if-git-not-found exp) "Evaluate EXP, returning #false if a GIT_ENOTFOUND error is raised." @@ -331,12 +298,9 @@ it unchanged." ;; Only fetch remote if it has not been cloned just before. (when (and cache-exists? (not (reference-available? repository ref))) - (if auth-supported? - (let ((auth-method (and auth-supported? - (%make-auth-ssh-agent)))) - (remote-fetch (remote-lookup repository "origin") - #:fetch-options (make-fetch-options auth-method))) - (remote-fetch (remote-lookup repository "origin")))) + (let ((auth-method (%make-auth-ssh-agent))) + (remote-fetch (remote-lookup repository "origin") + #:fetch-options (make-fetch-options auth-method)))) (when recursive? (update-submodules repository #:log-port log-port)) @@ -359,9 +323,7 @@ it unchanged." ;; Reclaim file descriptors and memory mappings associated with ;; REPOSITORY as soon as possible. - (when (module-defined? (resolve-interface '(git repository)) - 'repository-close!) - (repository-close! repository)) + (repository-close! repository) (values cache-directory (oid->string oid) relation))))) diff --git a/m4/guix.m4 b/m4/guix.m4 index 2fcc65e039..4fa7cdf737 100644 --- a/m4/guix.m4 +++ b/m4/guix.m4 @@ -204,6 +204,28 @@ AC_DEFUN([GUIX_CHECK_GUILE_GCRYPT], [ fi]) ]) +dnl GUIX_CHECK_GUILE_GIT +dnl +dnl Check whether a recent-enough Guile-Git is available. +AC_DEFUN([GUIX_CHECK_GUILE_GIT], [ + dnl Check whether we're using Guile-Git 0.3.0 or later. 0.3.0 + dnl introduced SSH authentication support and more. + AC_CACHE_CHECK([whether Guile-Git is available and recent enough], + [guix_cv_have_recent_guile_git], + [GUILE_CHECK([retval], + [(use-modules (git) (git auth) (git submodule)) + (let ((auth (%make-auth-ssh-agent))) + repository-close! + object-lookup-prefix + (make-clone-options + #:fetch-options (make-fetch-options auth)))]) + if test "$retval" = 0; then + guix_cv_have_recent_guile_git="yes" + else + guix_cv_have_recent_guile_git="no" + fi]) +]) + dnl GUIX_TEST_ROOT_DIRECTORY AC_DEFUN([GUIX_TEST_ROOT_DIRECTORY], [ AC_CACHE_CHECK([for unit test root directory], From patchwork Mon Oct 12 21:09:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 24596 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 0F5D427BBEC; Mon, 12 Oct 2020 22:11:16 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 1970D27BBEB for ; Mon, 12 Oct 2020 22:11:15 +0100 (BST) Received: from localhost ([::1]:39448 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kS56A-0005r3-7E for patchwork@mira.cbaines.net; Mon, 12 Oct 2020 17:11:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45728) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kS55z-0005qI-Ng for guix-patches@gnu.org; Mon, 12 Oct 2020 17:11:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:60786) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kS55z-0006yc-EB for guix-patches@gnu.org; Mon, 12 Oct 2020 17:11:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kS55z-00065X-AR for guix-patches@gnu.org; Mon, 12 Oct 2020 17:11:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#43968] [PATCH 2/3] git: Display a progress bar while fetching a repo. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 12 Oct 2020 21:11:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 43968 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 43968@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= Received: via spool by 43968-submit@debbugs.gnu.org id=B43968.160253702123333 (code B ref 43968); Mon, 12 Oct 2020 21:11:03 +0000 Received: (at 43968) by debbugs.gnu.org; 12 Oct 2020 21:10:21 +0000 Received: from localhost ([127.0.0.1]:44096 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kS55I-00064C-RJ for submit@debbugs.gnu.org; Mon, 12 Oct 2020 17:10:21 -0400 Received: from eggs.gnu.org ([209.51.188.92]:38644) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kS55A-00063U-U7 for 43968@debbugs.gnu.org; Mon, 12 Oct 2020 17:10:16 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:50497) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kS555-0006i5-N0; Mon, 12 Oct 2020 17:10:07 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=54554 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1kS554-0005SP-0d; Mon, 12 Oct 2020 17:10:07 -0400 From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Mon, 12 Oct 2020 23:09:54 +0200 Message-Id: <20201012210955.8753-2-ludo@gnu.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201012210955.8753-1-ludo@gnu.org> References: <20201012210955.8753-1-ludo@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" X-getmail-retrieved-from-mailbox: Patches Fixes . This uses the API of the yet-to-be-released Guile-Git 0.4.0. Using an older version is still possible, but progress report is disabled. * guix/git.scm (show-progress, make-default-fetch-options): New procedures. (clone*, update-cached-checkout): Use it instead of 'make-fetch-options'. --- guix/git.scm | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 57 insertions(+), 2 deletions(-) diff --git a/guix/git.scm b/guix/git.scm index cfb8d626f5..b81a011443 100644 --- a/guix/git.scm +++ b/guix/git.scm @@ -31,7 +31,9 @@ #:use-module (guix gexp) #:use-module (guix sets) #:use-module ((guix diagnostics) #:select (leave)) + #:use-module (guix progress) #:use-module (rnrs bytevectors) + #:use-module (ice-9 format) #:use-module (ice-9 match) #:use-module (srfi srfi-1) #:use-module (srfi srfi-11) @@ -117,6 +119,59 @@ the 'SSL_CERT_FILE' and 'SSL_CERT_DIR' environment variables." (string-append "R:" url) url)))))) +(define (show-progress progress) + "Display a progress bar as we fetch Git code. PROGRESS is an + record from (git)." + (define total + (indexer-progress-total-objects progress)) + + (define hundredth + (match (quotient (indexer-progress-total-objects progress) 100) + (0 1) + (x x))) + + (define-values (done label) + (if (< (indexer-progress-received-objects progress) total) + (values (indexer-progress-received-objects progress) + (G_ "receiving objects")) + (values (indexer-progress-indexed-objects progress) + (G_ "indexing objects")))) + + (define % + (* 100. (/ done total))) + + (when (and (< % 100) (zero? (modulo done hundredth))) + (erase-current-line (current-error-port)) + (let ((width (max (- (current-terminal-columns) + (string-length label) 7) + 3))) + (format (current-error-port) "~a ~3,d% ~a" + label (inexact->exact (round %)) + (progress-bar % width))) + (force-output (current-error-port))) + + (when (= % 100.) + ;; We're done, erase the line. + (erase-current-line (current-error-port)) + (force-output (current-error-port))) + + ;; Return true to indicate that we should go on. + #t) + +(define (make-default-fetch-options) + "Return the default fetch options." + (let ((auth-method (%make-auth-ssh-agent))) + ;; The #:transfer-progress option appeared in Guile-Git 0.4.0. Omit it + ;; when using an older version. + (catch 'wrong-number-of-args + (lambda () + (make-fetch-options auth-method + #:transfer-progress + (and (isatty? (current-error-port)) + show-progress))) + (lambda args + (make-fetch-options auth-method))))) + (define (clone* url directory) "Clone git repository at URL into DIRECTORY. Upon failure, make sure no empty directory is left behind." @@ -127,7 +182,7 @@ make sure no empty directory is left behind." (let ((auth-method (%make-auth-ssh-agent))) (clone url directory (make-clone-options - #:fetch-options (make-fetch-options auth-method))))) + #:fetch-options (make-default-fetch-options))))) (lambda _ (false-if-exception (rmdir directory))))) @@ -300,7 +355,7 @@ it unchanged." (not (reference-available? repository ref))) (let ((auth-method (%make-auth-ssh-agent))) (remote-fetch (remote-lookup repository "origin") - #:fetch-options (make-fetch-options auth-method)))) + #:fetch-options (make-default-fetch-options)))) (when recursive? (update-submodules repository #:log-port log-port)) From patchwork Mon Oct 12 21:09:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 24598 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 B218D27BBEB; Mon, 12 Oct 2020 22:15:53 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 6A94827BBEA for ; Mon, 12 Oct 2020 22:15:53 +0100 (BST) Received: from localhost ([::1]:45298 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kS5Ae-0000H5-Jw for patchwork@mira.cbaines.net; Mon, 12 Oct 2020 17:15:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45726) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kS55z-0005pf-A1 for guix-patches@gnu.org; Mon, 12 Oct 2020 17:11:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:60785) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kS55z-0006yY-0k for guix-patches@gnu.org; Mon, 12 Oct 2020 17:11:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kS55y-00065Q-Sn for guix-patches@gnu.org; Mon, 12 Oct 2020 17:11:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#43968] [PATCH 3/3] git: Support HTTP and HTTPS proxies. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 12 Oct 2020 21:11:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 43968 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 43968@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= Received: via spool by 43968-submit@debbugs.gnu.org id=B43968.160253702023327 (code B ref 43968); Mon, 12 Oct 2020 21:11:02 +0000 Received: (at 43968) by debbugs.gnu.org; 12 Oct 2020 21:10:20 +0000 Received: from localhost ([127.0.0.1]:44094 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kS55I-000645-Ht for submit@debbugs.gnu.org; Mon, 12 Oct 2020 17:10:20 -0400 Received: from eggs.gnu.org ([209.51.188.92]:38650) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kS55C-00063W-1Q for 43968@debbugs.gnu.org; Mon, 12 Oct 2020 17:10:15 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:50498) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kS556-0006ii-Rh; Mon, 12 Oct 2020 17:10:08 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=54554 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1kS556-0005SP-0y; Mon, 12 Oct 2020 17:10:08 -0400 From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Mon, 12 Oct 2020 23:09:55 +0200 Message-Id: <20201012210955.8753-3-ludo@gnu.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201012210955.8753-1-ludo@gnu.org> References: <20201012210955.8753-1-ludo@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" X-getmail-retrieved-from-mailbox: Patches This allows 'guix pull' and similar to fetch code over a proxy. * guix/git.scm (make-default-fetch-options): Pass #:proxy-url. --- guix/git.scm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/guix/git.scm b/guix/git.scm index b81a011443..364b4997ae 100644 --- a/guix/git.scm +++ b/guix/git.scm @@ -161,11 +161,14 @@ the 'SSL_CERT_FILE' and 'SSL_CERT_DIR' environment variables." (define (make-default-fetch-options) "Return the default fetch options." (let ((auth-method (%make-auth-ssh-agent))) - ;; The #:transfer-progress option appeared in Guile-Git 0.4.0. Omit it - ;; when using an older version. + ;; The #:transfer-progress and #:proxy-url options appeared in Guile-Git + ;; 0.4.0. Omit them when using an older version. (catch 'wrong-number-of-args (lambda () (make-fetch-options auth-method + ;; Guile-Git doesn't distinguish between these. + #:proxy-url (or (getenv "http_proxy") + (getenv "https_proxy")) #:transfer-progress (and (isatty? (current-error-port)) show-progress)))