From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id uHSeAlkm8l4EPAAA0tVLHw (envelope-from ) for ; Tue, 23 Jun 2020 15:57:13 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id ALMSOlgm8l4qCwAAB5/wlQ (envelope-from ) for ; Tue, 23 Jun 2020 15:57:12 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id C4FA194053B for ; Tue, 23 Jun 2020 15:57:12 +0000 (UTC) Received: from localhost ([::1]:45536 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jnlIN-00072m-Po for larch@yhetil.org; Tue, 23 Jun 2020 11:57:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57510) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jnlIF-00070k-5m for guix-patches@gnu.org; Tue, 23 Jun 2020 11:57:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:53694) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jnlIE-0000xD-Q0 for guix-patches@gnu.org; Tue, 23 Jun 2020 11:57:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jnlIE-0007MG-Q2 for guix-patches@gnu.org; Tue, 23 Jun 2020 11:57:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#42020] [PATCH 4/4] packages: Recognize SHA3 and BLAKE2s for 'content-hash'. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 23 Jun 2020 15:57:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 42020 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 42020@debbugs.gnu.org Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= Received: via spool by 42020-submit@debbugs.gnu.org id=B42020.159292777328208 (code B ref 42020); Tue, 23 Jun 2020 15:57:02 +0000 Received: (at 42020) by debbugs.gnu.org; 23 Jun 2020 15:56:13 +0000 Received: from localhost ([127.0.0.1]:37005 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jnlHR-0007Ko-6c for submit@debbugs.gnu.org; Tue, 23 Jun 2020 11:56:13 -0400 Received: from eggs.gnu.org ([209.51.188.92]:42784) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jnlHI-0007Ja-4k for 42020@debbugs.gnu.org; Tue, 23 Jun 2020 11:56:08 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:35823) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jnlHC-0000OO-RS; Tue, 23 Jun 2020 11:55:58 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=57536 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jnlHB-0006sV-E3; Tue, 23 Jun 2020 11:55:58 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Date: Tue, 23 Jun 2020 17:55:47 +0200 Message-Id: <20200623155547.15886-4-ludo@gnu.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200623155547.15886-1-ludo@gnu.org> References: <20200623155547.15886-1-ludo@gnu.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Spam-Score: -3.3 (---) X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Spam-Score: 3.99 X-TUID: aAGBlvdv+IZX * guix/packages.scm (build-content-hash): Add 'sha3-256', 'sha3-512', and 'blake2s-256'. * tests/packages.scm ("package-source-derivation, origin, sha3-512"): New test. --- guix/packages.scm | 5 ++++- tests/packages.scm | 26 ++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/guix/packages.scm b/guix/packages.scm index 1e0ec41b76..68ef718872 100644 --- a/guix/packages.scm +++ b/guix/packages.scm @@ -191,7 +191,10 @@ its first argument has the right size for the chosen algorithm." (define-content-hash-constructor build-content-hash (sha256 32) - (sha512 64)) + (sha512 64) + (sha3-256 32) + (sha3-512 64) + (blake2s-256 64)) (define-syntax content-hash (lambda (s) diff --git a/tests/packages.scm b/tests/packages.scm index c7b6f669b5..26377b269b 100644 --- a/tests/packages.scm +++ b/tests/packages.scm @@ -524,6 +524,32 @@ (build-derivations %store (list drv)) (call-with-input-file output get-string-all))) +(test-equal "package-source-derivation, origin, sha3-512" + "hello, sha3" + (let* ((bash (search-bootstrap-binary "bash" (%current-system))) + (builder (add-text-to-store %store "my-fixed-builder.sh" + "echo -n hello, sha3 > $out" '())) + (method (lambda* (url hash-algo hash #:optional name + #:rest rest) + (and (eq? hash-algo 'sha3-512) + (raw-derivation name bash (list builder) + #:sources (list builder) + #:hash hash + #:hash-algo hash-algo)))) + (source (origin + (method method) + (uri "unused://") + (file-name "origin-sha3") + (hash (content-hash + (gcrypt:bytevector-hash (string->utf8 "hello, sha3") + (gcrypt:lookup-hash-algorithm + 'sha3-512)) + sha3-512)))) + (drv (package-source-derivation %store source)) + (output (derivation->output-path drv))) + (build-derivations %store (list drv)) + (call-with-input-file output get-string-all))) + (unless (network-reachable?) (test-skip 1)) (test-equal "package-source-derivation, snippet" "OK" -- 2.26.2