unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / Atom feed
* [bug#44038] [PATCH] Fix deprecation warning for origin-sha256
@ 2020-10-16 16:14 Helio Machado
  2020-10-17 20:21 ` Ludovic Courtès
  0 siblings, 1 reply; 4+ messages in thread
From: Helio Machado @ 2020-10-16 16:14 UTC (permalink / raw)
  To: 44038


[-- Attachment #1.1: Type: text/plain, Size: 163 bytes --]

This patch fixes the following build-time deprecation warning:

    guix/import/print.scm:77:21: warning: 'origin-sha256' is deprecated,
use 'origin-hash' instead

[-- Attachment #1.2: Type: text/html, Size: 252 bytes --]

[-- Attachment #2: 0001-guix-import-Fix-deprecation-warning-for-origin-sha25.patch --]
[-- Type: application/octet-stream, Size: 954 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [bug#44038] [PATCH] Fix deprecation warning for origin-sha256
  2020-10-16 16:14 [bug#44038] [PATCH] Fix deprecation warning for origin-sha256 Helio Machado
@ 2020-10-17 20:21 ` Ludovic Courtès
  2020-10-18 22:25   ` Helio Machado
  0 siblings, 1 reply; 4+ messages in thread
From: Ludovic Courtès @ 2020-10-17 20:21 UTC (permalink / raw)
  To: Helio Machado; +Cc: 44038

Hi,

Helio Machado <0x2b3bfa0@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’.




^ permalink raw reply	[flat|nested] 4+ messages in thread

* [bug#44038] [PATCH] Fix deprecation warning for origin-sha256
  2020-10-17 20:21 ` Ludovic Courtès
@ 2020-10-18 22:25   ` Helio Machado
  2020-10-19  8:57     ` bug#44038: " Ludovic Courtès
  0 siblings, 1 reply; 4+ messages in thread
From: Helio Machado @ 2020-10-18 22:25 UTC (permalink / raw)
  To: Ludovic Courtès, 44038


[-- Attachment #1.1: Type: text/plain, Size: 1212 bytes --]

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@gnu.org> wrote:

> Hi,
>
> Helio Machado <0x2b3bfa0@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’.
>

[-- Attachment #1.2: Type: text/html, Size: 1883 bytes --]

[-- Attachment #2: 0001-guix-import-Fix-deprecation-warning-for-origin-sha25.patch --]
[-- Type: application/octet-stream, Size: 1724 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#44038: [PATCH] Fix deprecation warning for origin-sha256
  2020-10-18 22:25   ` Helio Machado
@ 2020-10-19  8:57     ` Ludovic Courtès
  0 siblings, 0 replies; 4+ messages in thread
From: Ludovic Courtès @ 2020-10-19  8:57 UTC (permalink / raw)
  To: Helio Machado; +Cc: 44038-done

[-- Attachment #1: Type: text/plain, Size: 575 bytes --]

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’.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 1067 bytes --]

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".

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-10-19  8:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-16 16:14 [bug#44038] [PATCH] Fix deprecation warning for origin-sha256 Helio Machado
2020-10-17 20:21 ` Ludovic Courtès
2020-10-18 22:25   ` Helio Machado
2020-10-19  8:57     ` bug#44038: " Ludovic Courtès

unofficial mirror of guix-patches@gnu.org 

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://yhetil.org/guix-patches/1 guix-patches/git/1.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 guix-patches guix-patches/ https://yhetil.org/guix-patches \
		guix-patches@gnu.org
	public-inbox-index guix-patches

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://news.yhetil.org/yhetil.gnu.guix.patches


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git