GNU bug report logs - #44038
[PATCH] Fix deprecation warning for origin-sha256

Previous Next

Package: guix-patches;

Reported by: Helio Machado <0x2b3bfa0 <at> gmail.com>

Date: Fri, 16 Oct 2020 18:23:01 UTC

Severity: normal

Tags: patch

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 44038 in the body.
You can then email your comments to 44038 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#44038; Package guix-patches. (Fri, 16 Oct 2020 18:23:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Helio Machado <0x2b3bfa0 <at> gmail.com>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Fri, 16 Oct 2020 18:23:02 GMT) Full text and rfc822 format available.

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

From: Helio Machado <0x2b3bfa0 <at> gmail.com>
To: guix-patches <at> gnu.org
Subject: [PATCH] Fix deprecation warning for origin-sha256
Date: Fri, 16 Oct 2020 18:14:29 +0200
[Message part 1 (text/plain, inline)]
This patch fixes the following build-time deprecation warning:

    guix/import/print.scm:77:21: warning: 'origin-sha256' is deprecated,
use 'origin-hash' instead
[Message part 2 (text/html, inline)]
[0001-guix-import-Fix-deprecation-warning-for-origin-sha25.patch (application/octet-stream, attachment)]

Information forwarded to guix-patches <at> gnu.org:
bug#44038; Package guix-patches. (Sat, 17 Oct 2020 20:22:01 GMT) Full text and rfc822 format available.

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

From: Ludovic Courtès <ludo <at> gnu.org>
To: Helio Machado <0x2b3bfa0 <at> gmail.com>
Cc: 44038 <at> debbugs.gnu.org
Subject: Re: [bug#44038] [PATCH] Fix deprecation warning for origin-sha256
Date: Sat, 17 Oct 2020 22:21:45 +0200
Hi,

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

> This patch fixes the following build-time deprecation warning:
>
>     guix/import/print.scm:77:21: warning: 'origin-sha256' is deprecated,
> use 'origin-hash' instead

Thanks for looking into it!  The deprecation warning is a bit confusing
though in this case because ‘origin-hash’ is not exactly a drop-in
replacement for ‘origin-sha256’, as can be seen in the manual, so this
patch wouldn’t have the desired effect.

Instead, ‘print.scm’ could be changed to emit a (sha256 …) form when the
<content-hash> object is indeed a sha256 hash, and otherwise use a (hash
…) form.

See
<https://guix.gnu.org/manual/devel/en/html_node/origin-Reference.html#index-content_002dhash>.

Thanks,
Ludo’.




Information forwarded to guix-patches <at> gnu.org:
bug#44038; Package guix-patches. (Sun, 18 Oct 2020 22:51:03 GMT) Full text and rfc822 format available.

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

From: Helio Machado <0x2b3bfa0 <at> gmail.com>
To: Ludovic Courtès <ludo <at> gnu.org>, 44038 <at> debbugs.gnu.org
Subject: Re: [bug#44038] [PATCH] Fix deprecation warning for origin-sha256
Date: Mon, 19 Oct 2020 00:25:34 +0200
[Message part 1 (text/plain, inline)]
Hello,

Sorry for the low-quality patch; it seemed so obvious that laziness won
over good sense.

The amended patch implements your suggestion and checks whether the used
hash is `sha256` or anything else, adapting the output accordingly in each
case.

Thank you for your patience,
Helio.

On Sat, 17 Oct 2020 at 22:21, Ludovic Courtès <ludo <at> gnu.org> wrote:

> Hi,
>
> Helio Machado <0x2b3bfa0 <at> gmail.com> skribis:
>
> > This patch fixes the following build-time deprecation warning:
> >
> >     guix/import/print.scm:77:21: warning: 'origin-sha256' is deprecated,
> > use 'origin-hash' instead
>
> Thanks for looking into it!  The deprecation warning is a bit confusing
> though in this case because ‘origin-hash’ is not exactly a drop-in
> replacement for ‘origin-sha256’, as can be seen in the manual, so this
> patch wouldn’t have the desired effect.
>
> Instead, ‘print.scm’ could be changed to emit a (sha256 …) form when the
> <content-hash> object is indeed a sha256 hash, and otherwise use a (hash
> …) form.
>
> See
> <
> https://guix.gnu.org/manual/devel/en/html_node/origin-Reference.html#index-content_002dhash
> >.
>
> Thanks,
> Ludo’.
>
[Message part 2 (text/html, inline)]
[0001-guix-import-Fix-deprecation-warning-for-origin-sha25.patch (application/octet-stream, attachment)]

Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Mon, 19 Oct 2020 08:58:03 GMT) Full text and rfc822 format available.

Notification sent to Helio Machado <0x2b3bfa0 <at> gmail.com>:
bug acknowledged by developer. (Mon, 19 Oct 2020 08:58:04 GMT) Full text and rfc822 format available.

Message #16 received at 44038-done <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Helio Machado <0x2b3bfa0 <at> gmail.com>
Cc: 44038-done <at> debbugs.gnu.org
Subject: Re: [bug#44038] [PATCH] Fix deprecation warning for origin-sha256
Date: Mon, 19 Oct 2020 10:57:21 +0200
[Message part 1 (text/plain, inline)]
Hi,

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

> From 31c8a3ee7e6819ca01c875cfefd2818f727bc32e Mon Sep 17 00:00:00 2001
> From: Helio Machado <0x2b3bfa0+git <at> 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’.

[Message part 2 (text/x-patch, inline)]
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".

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 16 Nov 2020 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 235 days ago.

Previous Next


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