From: "Ludovic Courtès" <ludo@gnu.org>
To: 74776@debbugs.gnu.org
Cc: "Ludovic Courtès" <ludo@gnu.org>,
"Christopher Baines" <guix@cbaines.net>,
"Josselin Poiret" <dev@jpoiret.xyz>,
"Ludovic Courtès" <ludo@gnu.org>,
"Mathieu Othacehe" <othacehe@gnu.org>,
"Simon Tournier" <zimon.toutoune@gmail.com>,
"Tobias Geerinckx-Rice" <me@tobias.gr>
Subject: [bug#74776] [PATCH 3/7] guix download: Honor ‘--no-check-certificate’ for ‘--git’.
Date: Wed, 11 Dec 2024 00:34:42 +0100 [thread overview]
Message-ID: <4c0835f5958108ad2235c4bb63f22d2b742356d2.1733873391.git.ludo@gnu.org> (raw)
In-Reply-To: <cover.1733873391.git.ludo@gnu.org>
Until now ‘--no-check-certificate’ had no effect when combined with
‘--git’. This can be tested with:
guix shell libfaketime -- faketime 2019-01-01 \
guix download --no-check-certificate --git \
https://git.savannah.gnu.org/git/shepherd.git
* guix/scripts/download.scm (git-download-to-file): Add #:verify-certificate?
and honor it.
(git-download-to-store*): Likewise.
(add-git-download-option): Likewise.
(%options): Likewise.
Change-Id: Ib3905398199d814a02319ed3328eb8a4ed219bd5
---
guix/scripts/download.scm | 34 +++++++++++++++++++---------------
1 file changed, 19 insertions(+), 15 deletions(-)
diff --git a/guix/scripts/download.scm b/guix/scripts/download.scm
index de68e6f328..f373e46941 100644
--- a/guix/scripts/download.scm
+++ b/guix/scripts/download.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2012, 2013, 2015, 2016, 2017, 2020 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2012-2013, 2015-2017, 2020, 2024 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2021 Simon Tournier <zimon.toutoune@gmail.com>
;;;
;;; This file is part of GNU Guix.
@@ -94,7 +94,8 @@ (define (copy-recursively-without-dot-git source destination)
#t
source))
-(define (git-download-to-file url file reference recursive?)
+(define* (git-download-to-file url file reference recursive?
+ #:key (verify-certificate? #t))
"Download the git repo at URL to file, checked out at REFERENCE.
REFERENCE must be a pair argument as understood by 'latest-repository-commit'.
Return FILE."
@@ -108,7 +109,8 @@ (define (git-download-to-file url file reference recursive?)
(else url))))
(copy-recursively-without-dot-git
(with-git-error-handling
- (update-cached-checkout url #:ref reference #:recursive? recursive?))
+ (update-cached-checkout url #:ref reference #:recursive? recursive?
+ #:verify-certificate? verify-certificate?))
file))
file)
@@ -151,12 +153,13 @@ (define* (git-download-to-store* url
(string-drop url (string-length "file:")))
url)))
(with-store store
- ;; TODO: Verify certificate support and deactivation.
(with-git-error-handling
(latest-repository-commit store
url
#:recursive? recursive?
- #:ref reference)))))
+ #:ref reference
+ #:verify-certificate?
+ verify-certificate?)))))
(define %default-options
;; Alist of default option values.
@@ -207,9 +210,10 @@ (define (show-help)
(define (add-git-download-option result)
(alist-cons 'download-proc
- ;; XXX: #:verify-certificate? currently ignored.
(lambda* (url #:key verify-certificate? ref recursive?)
- (git-download-to-store* url ref recursive?))
+ (git-download-to-store* url ref recursive?
+ #:verify-certificate?
+ verify-certificate?))
(alist-delete 'download result)))
(define %options
@@ -243,20 +247,20 @@ (define %options
(alist-cons 'verify-certificate? #f result)))
(option '(#\o "output") #t #f
(lambda (opt name arg result)
- (let* ((git
- (assoc-ref result 'git-reference)))
+ (let* ((git (assoc-ref result 'git-reference)))
(if git
(alist-cons 'download-proc
- (lambda* (url
- #:key
- verify-certificate?
- ref
- recursive?)
+ (lambda* (url #:key
+ (verify-certificate? #t)
+ ref
+ recursive?)
(git-download-to-file
url
arg
(assoc-ref result 'git-reference)
- recursive?))
+ recursive?
+ #:verify-certificate?
+ verify-certificate?))
(alist-delete 'download result))
(alist-cons 'download-proc
(lambda* (url
--
2.46.0
next prev parent reply other threads:[~2024-12-10 23:36 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-10 23:33 [bug#74776] [PATCH 0/7] Adding '--no-check-certificate' to 'pull' and 'time-machine' Ludovic Courtès
2024-12-10 23:34 ` [bug#74776] [PATCH 1/7] git: Remove Guile-Git < 0.4.0 compatibility fallback Ludovic Courtès
2024-12-10 23:34 ` [bug#74776] [PATCH 2/7] git: Allow X.509 certificate verification to be disabled Ludovic Courtès
2024-12-10 23:34 ` Ludovic Courtès [this message]
2024-12-10 23:34 ` [bug#74776] [PATCH 4/7] channels: Add #:verify-certificate? and honor it Ludovic Courtès
2024-12-10 23:34 ` [bug#74776] [PATCH 5/7] pull: Add ‘--no-check-certificate’ Ludovic Courtès
2024-12-11 2:45 ` Maxim Cournoyer
2024-12-10 23:34 ` [bug#74776] [PATCH 6/7] inferior: Add #:verify-certificate? to ‘cached-channel-instance’ Ludovic Courtès
2024-12-10 23:34 ` [bug#74776] [PATCH 7/7] time-machine: Add ‘--no-check-certificate’ Ludovic Courtès
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4c0835f5958108ad2235c4bb63f22d2b742356d2.1733873391.git.ludo@gnu.org \
--to=ludo@gnu.org \
--cc=74776@debbugs.gnu.org \
--cc=dev@jpoiret.xyz \
--cc=guix@cbaines.net \
--cc=me@tobias.gr \
--cc=othacehe@gnu.org \
--cc=zimon.toutoune@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).