From: Helio Machado <0x2b3bfa0@gmail.com>
To: "Ludovic Courtès" <ludo@gnu.org>, 44038@debbugs.gnu.org
Subject: [bug#44038] [PATCH] Fix deprecation warning for origin-sha256
Date: Mon, 19 Oct 2020 00:25:34 +0200 [thread overview]
Message-ID: <CANe01w6ujivzD8xgP_7banGyz+dLVSmU==cejA3xVeTePQ-1Bg@mail.gmail.com> (raw)
In-Reply-To: <87y2k44n8m.fsf@gnu.org>
[-- 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 --]
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
---
guix/import/print.scm | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/guix/import/print.scm b/guix/import/print.scm
index 11cc218285..e79f831c76 100644
--- a/guix/import/print.scm
+++ b/guix/import/print.scm
@@ -74,7 +74,7 @@ when evaluated."
(define (source->code source version)
(let ((uri (origin-uri source))
(method (origin-method source))
- (sha256 (origin-sha256 source))
+ (hash (origin-hash source))
(file-name (origin-file-name source))
(patches (origin-patches source)))
`(origin
@@ -82,9 +82,10 @@ when evaluated."
(uri (string-append ,@(match (factorize-uri uri version)
((? string? uri) (list uri))
(factorized factorized))))
- (sha256
- (base32
- ,(format #f "~a" (bytevector->nix-base32-string sha256))))
+ ,(if (equal? (content-hash-algorithm hash) 'sha256)
+ `(sha256 (base32 ,(format #f "~a" (bytevector->nix-base32-string
+ (content-hash-value hash)))))
+ `(hash ,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".
--
2.24.3 (Apple Git-128)
next prev parent reply other threads:[~2020-10-18 22:51 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2020-10-19 8:57 ` bug#44038: " Ludovic Courtès
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
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CANe01w6ujivzD8xgP_7banGyz+dLVSmU==cejA3xVeTePQ-1Bg@mail.gmail.com' \
--to=0x2b3bfa0@gmail.com \
--cc=44038@debbugs.gnu.org \
--cc=ludo@gnu.org \
/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 public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).