From patchwork Mon Mar 9 09:02:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Maja_K=C4=85dzio=C5=82ka?= X-Patchwork-Id: 20605 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 8F28327BBE4; Mon, 9 Mar 2020 09:02:11 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id 0D81C27BBEA for ; Mon, 9 Mar 2020 09:02:11 +0000 (GMT) Received: from localhost ([::1]:39022 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jBEIc-0008EJ-Gv for patchwork@mira.cbaines.net; Mon, 09 Mar 2020 05:02:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52402) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jBEIV-0008Dv-KJ for guix-patches@gnu.org; Mon, 09 Mar 2020 05:02:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jBEIU-0007it-Ee for guix-patches@gnu.org; Mon, 09 Mar 2020 05:02:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:43785) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jBEIU-0007im-B7 for guix-patches@gnu.org; Mon, 09 Mar 2020 05:02:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jBEIU-0007ir-8V for guix-patches@gnu.org; Mon, 09 Mar 2020 05:02:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#39982] [PATCH 2/2] gnu: rust: Add 1.39 References: <20200308131403.11680-1-kuba@kadziolka.net> In-Reply-To: <20200308131403.11680-1-kuba@kadziolka.net> Resent-From: Jakub =?utf-8?b?S8SFZHppb8WCa2E=?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 09 Mar 2020 09:02:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 39982 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 39982@debbugs.gnu.org Received: via spool by 39982-submit@debbugs.gnu.org id=B39982.158374450229658 (code B ref 39982); Mon, 09 Mar 2020 09:02:02 +0000 Received: (at 39982) by debbugs.gnu.org; 9 Mar 2020 09:01:42 +0000 Received: from localhost ([127.0.0.1]:49757 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jBEIA-0007iI-56 for submit@debbugs.gnu.org; Mon, 09 Mar 2020 05:01:42 -0400 Received: from pat.zlotemysli.pl ([37.59.186.212]:56802) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jBEI7-0007i8-PZ for 39982@debbugs.gnu.org; Mon, 09 Mar 2020 05:01:40 -0400 Received: (qmail 20006 invoked by uid 1009); 9 Mar 2020 10:01:37 +0100 Received: from 188.123.215.55 (kuba@kadziolka.net@188.123.215.55) by pat (envelope-from , uid 1002) with qmail-scanner-2.08st (clamdscan: 0.98.6/25745. spamassassin: 3.4.0. perlscan: 2.08st. Clear:RC:1(188.123.215.55):. Processed in 0.009673 secs); 09 Mar 2020 09:01:37 -0000 Received: from unknown (HELO localhost.localdomain) (kuba@kadziolka.net@188.123.215.55) by pat.zlotemysli.pl with AES256-SHA encrypted SMTP; 9 Mar 2020 10:01:37 +0100 From: Jakub =?utf-8?b?S8SFZHppb8WCa2E=?= Date: Mon, 9 Mar 2020 10:02:18 +0100 Message-Id: <20200309090218.31768-1-kuba@kadziolka.net> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Qmailux-2.08st: added fake Content-Type header X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * gnu/packages/rust.scm (rust-1.39): New variable. (%cargo-reference-hash): Add a comment explaining the role of the variable. --- I'm just gonna send all my Rust updates to this bug number... I just realized that I forgot to add the trailing #t to the phase in my last patch, this is now fixed as can be seen in the context for this patch. gnu/packages/rust.scm | 46 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/gnu/packages/rust.scm b/gnu/packages/rust.scm index e0106841c8..11522b933e 100644 --- a/gnu/packages/rust.scm +++ b/gnu/packages/rust.scm @@ -55,6 +55,32 @@ #:use-module (ice-9 match) #:use-module (srfi srfi-26)) +;; This is the hash for the empty file, and the reason it's relevant is not +;; the most obvious. +;; +;; The root of the problem is that Cargo keeps track of a file called +;; Cargo.lock, that contains the hash of the tarball source of each dependency. +;; +;; However, tarball sources aren't handled well by Guix because of the need to +;; patch shebangs in any helper scripts. This is why we use Cargo's vendoring +;; capabilities, where instead of the tarball, a directory is provided in its +;; place. (In the case of rustc, the source code already ships with vendored +;; dependencies, but crates built with cargo-build-system undergo vendoring +;; during the build.) +;; +;; To preserve the advantages of checksumming, vendored dependencies contain +;; a file called .cargo-checksum.json, which contains the hash of the tarball, +;; as well as the list of files in it, with the hash of each file. +;; +;; The patch-cargo-checksums phase of cargo-build-system runs after +;; any Guix-specific patches to the vendored dependencies and regenerates the +;; .cargo-checksum.json files, but it's hard to know the tarball checksum that +;; should be written to the file - and taking care of any unhandled edge case +;; would require rebuilding everything that depends on rust. This is why we lie, +;; and say that the tarball has the hash of an empty file. It's not a problem +;; because cargo-build-system removes the Cargo.lock file. We can't do that +;; for rustc because of a quirk of its build system, so we modify the lock file +;; to substitute the hash. (define %cargo-reference-hash "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855") @@ -1130,4 +1156,24 @@ move around." (("ignore-sgx") "ignore-sgx\n// ignore-tidy-linelength")) #t))))))))) +(define-public rust-1.39 + (let ((base-rust + (rust-bootstrapped-package rust-1.38 "1.39.0" + "0mwkc1bnil2cfyf6nglpvbn2y0zfbv44zfhsd5qg4c9rm6vgd8dl"))) + (package + (inherit base-rust) + (arguments + (substitute-keyword-arguments (package-arguments base-rust) + ((#:phases phases) + `(modify-phases ,phases + (replace 'patch-cargo-checksums + ;; The Cargo.lock format changed. + (lambda* _ + (use-modules (guix build cargo-utils)) + (substitute* "Cargo.lock" + (("(checksum = )\".*\"" all name) + (string-append name "\"" ,%cargo-reference-hash "\""))) + (generate-all-checksums "vendor") + #t))))))))) + (define-public rust rust-1.37)