GNU bug report logs - #74481
[PATCH 0/2] Handle corner cases of 'guix import go'

Previous Next

Package: guix-patches;

Reported by: Simon Tournier <zimon.toutoune <at> gmail.com>

Date: Fri, 22 Nov 2024 19:07:02 UTC

Severity: normal

Tags: patch

Done: Simon Tournier <zimon.toutoune <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #8 received at 74481 <at> debbugs.gnu.org (full text, mbox):

From: Simon Tournier <zimon.toutoune <at> gmail.com>
To: 74481 <at> debbugs.gnu.org
Cc: Simon Tournier <zimon.toutoune <at> gmail.com>
Subject: [PATCH 2/2] import: go: Warn instead of error out when reference is
 missing.
Date: Fri, 22 Nov 2024 20:09:27 +0100
* guix/import/go.scm (git-checkout-hash): Return some hash although the
checkout does not contain the expected reference.

Change-Id: I40287fae29042a0ba106939a413239df6efde97d
---
 guix/import/go.scm | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/guix/import/go.scm b/guix/import/go.scm
index 32cba25b33..25ae989378 100644
--- a/guix/import/go.scm
+++ b/guix/import/go.scm
@@ -6,7 +6,7 @@
 ;;; Copyright © 2021-2022 Ludovic Courtès <ludo <at> gnu.org>
 ;;; Copyright © 2021 Xinglu Chen <public <at> yoctocell.xyz>
 ;;; Copyright © 2021 Sarah Morgensen <iskarian <at> mgsn.dev>
-;;; Copyright © 2021 Simon Tournier <zimon.toutoune <at> gmail.com>
+;;; Copyright © 2021, 2024 Simon Tournier <zimon.toutoune <at> gmail.com>
 ;;; Copyright © 2023 Efraim Flashner <efraim <at> flashner.co.il>
 ;;; Copyright © 2024 Christina O'Donnell <cdo <at> mutix.org>
 ;;;
@@ -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)
@@ -566,7 +567,10 @@ (define* (git-checkout-hash url reference algorithm)
                   (update-cached-checkout url
                                           #:ref
                                           `(tag-or-commit . ,reference)))))
-    (file-hash* checkout #:algorithm algorithm #:recursive? #true)))
+    (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
-- 
2.46.0





This bug report was last modified 132 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.