diff mbox series

bug#44038: [PATCH] Fix deprecation warning for origin-sha256

Message ID 87k0vm1tla.fsf@gnu.org
State Accepted
Headers show
Series bug#44038: [PATCH] Fix deprecation warning for origin-sha256 | expand

Checks

Context Check Description
cbaines/applying patch fail View Laminar job

Commit Message

Ludovic Courtès Oct. 19, 2020, 8:57 a.m. UTC
Hi,

Helio Machado <0x2b3bfa0@gmail.com> skribis:

> From 31c8a3ee7e6819ca01c875cfefd2818f727bc32e Mon Sep 17 00:00:00 2001
> From: Helio Machado <0x2b3bfa0+git@googlemail.com>
> Date: Mon, 19 Oct 2020 00:15:00 +0200
> Subject: [PATCH] guix/import: Fix deprecation warning for origin-sha256
>
> * guix/import/print.scm (source->code source version): Replace
> origin-sha256 by origin-hash

The non-SHA256 case would let the raw <content-hash> record through, so
I amended it as follows (also removing an unnecessary ‘format’ call).

Thanks!

Ludo’.
diff mbox series

Patch

diff --git a/guix/import/print.scm b/guix/import/print.scm
index e79f831c76..d21ce57aeb 100644
--- a/guix/import/print.scm
+++ b/guix/import/print.scm
@@ -83,9 +83,11 @@  when evaluated."
                                  ((? string? uri) (list uri))
                                  (factorized factorized))))
          ,(if (equal? (content-hash-algorithm hash) 'sha256)
-              `(sha256 (base32 ,(format #f "~a" (bytevector->nix-base32-string
-                                                 (content-hash-value hash)))))
-              `(hash ,hash))
+              `(sha256 (base32 ,(bytevector->nix-base32-string
+                                 (content-hash-value hash))))
+              `(hash (content-hash ,(bytevector->nix-base32-string
+                                     (content-hash-value hash))
+                                   ,(content-hash-algorithm hash))))
          ;; FIXME: in order to be able to throw away the directory prefix,
          ;; we just assume that the patch files can be found with
          ;; "search-patches".