From: Simon Tournier <zimon.toutoune@gmail.com>
To: 74481@debbugs.gnu.org
Cc: Simon Tournier <zimon.toutoune@gmail.com>,
Katherine Cox-Buday <cox.katherine.e+guix@gmail.com>,
Sharlatan Hellseher <sharlatanus@gmail.com>
Subject: [bug#74481] [PATCH v2] import: go: Warn instead of error out when Git fails.
Date: Tue, 17 Dec 2024 18:45:02 +0100 [thread overview]
Message-ID: <494fef0566a7105bf4ae04f5efeae742561f3abb.1734457415.git.zimon.toutoune@gmail.com> (raw)
In-Reply-To: <cover.1732302033.git.zimon.toutoune@gmail.com>
* guix/import/go.scm (git-checkout-hash): Return some hash although updating
the cache fails.
Change-Id: I87e7701023a5f76f5d1494827473616e6a1275aa
---
guix/import/go.scm | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/guix/import/go.scm b/guix/import/go.scm
index 32cba25b33..6ede152601 100644
--- a/guix/import/go.scm
+++ b/guix/import/go.scm
@@ -38,7 +38,8 @@ (define-module (guix import go)
#:use-module (guix http-client)
#:use-module (guix memoization)
#:autoload (htmlprag) (html->sxml) ;from Guile-Lib
- #:autoload (guix base32) (bytevector->nix-base32-string)
+ #:autoload (guix base32) (bytevector->nix-base32-string
+ nix-base32-string->bytevector)
#:autoload (guix build utils) (mkdir-p)
#:autoload (guix ui) (warning)
#:autoload (gcrypt hash) (hash-algorithm sha256)
@@ -563,10 +564,18 @@ (define* (git-checkout-hash url reference algorithm)
(chmod cache #o700)
(let-values (((checkout commit _)
(parameterize ((%repository-cache-directory cache))
- (update-cached-checkout url
- #:ref
- `(tag-or-commit . ,reference)))))
- (file-hash* checkout #:algorithm algorithm #:recursive? #true)))
+ (catch 'git-error
+ (lambda ()
+ (update-cached-checkout url
+ #:ref
+ `(tag-or-commit . ,reference)))
+ (lambda (key err)
+ (warning (G_ "update-cached-checkout: ~s ~s~%") key err)
+ (values #f #f #f))))))
+ (if (and checkout commit)
+ (file-hash* checkout #:algorithm algorithm #:recursive? #true)
+ (nix-base32-string->bytevector
+ "0000000000000000000000000000000000000000000000000000"))))
(define (vcs->origin vcs-type vcs-repo-url version subdir)
"Generate the `origin' block of a package depending on what type of source
base-commit: a9003b8e6b40b59c9545ae87bb441d3549630db7
--
2.45.2
next prev parent reply other threads:[~2024-12-17 17:47 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-22 19:05 [bug#74481] [PATCH 0/2] Handle corner cases of 'guix import go' Simon Tournier
2024-11-22 19:09 ` [bug#74481] [PATCH 1/2] git: Catch Git errors when updating cached checkout Simon Tournier
2024-12-12 11:34 ` Ludovic Courtès
2024-12-12 12:04 ` Simon Tournier
2024-12-17 10:55 ` Ludovic Courtès
2024-12-17 18:06 ` Simon Tournier
2024-12-26 21:17 ` Ludovic Courtès
2024-12-31 15:25 ` Simon Tournier
2024-11-22 19:09 ` [bug#74481] [PATCH 2/2] import: go: Warn instead of error out when reference is missing Simon Tournier
2024-12-10 14:09 ` [bug#74481] [PATCH 0/2] Handle corner cases of 'guix import go' Simon Tournier
2024-12-10 18:40 ` Sharlatan Hellseher
2024-12-17 17:45 ` Simon Tournier [this message]
2024-12-26 21:14 ` [bug#74481] [PATCH v2] import: go: Warn instead of error out when Git fails Ludovic Courtès
2025-01-06 11:25 ` Simon Tournier
2024-12-18 20:18 ` [bug#74481] [PATCH 0/2] Handle corner cases of 'guix import go' Sharlatan Hellseher
2025-01-06 11:26 ` Simon Tournier
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=494fef0566a7105bf4ae04f5efeae742561f3abb.1734457415.git.zimon.toutoune@gmail.com \
--to=zimon.toutoune@gmail.com \
--cc=74481@debbugs.gnu.org \
--cc=cox.katherine.e+guix@gmail.com \
--cc=sharlatanus@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 external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.