From patchwork Fri Jan 17 18:40:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Nicol=C3=B2_Balzarotti?= X-Patchwork-Id: 19864 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 0746517A2D; Sat, 18 Jan 2020 13:36:18 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id E42E51794A for ; Sat, 18 Jan 2020 13:36:16 +0000 (GMT) Received: from localhost ([::1]:40386 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1isoGt-0001Oy-W6 for patchwork@mira.cbaines.net; Sat, 18 Jan 2020 08:36:16 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:42753) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1isoGi-0001MV-0h for guix-patches@gnu.org; Sat, 18 Jan 2020 08:36:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1isoGg-0004oE-GG for guix-patches@gnu.org; Sat, 18 Jan 2020 08:36:03 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:34726) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1isoGg-0004nw-CX for guix-patches@gnu.org; Sat, 18 Jan 2020 08:36:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1isoGg-00077v-9f for guix-patches@gnu.org; Sat, 18 Jan 2020 08:36:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#38546] [PATCH 05/11] gnu: build: julia-build-system: fix package References: <87v9qpvbyr.fsf@guixSD.i-did-not-set--mail-host-address--so-tickle-me> In-Reply-To: <87v9qpvbyr.fsf@guixSD.i-did-not-set--mail-host-address--so-tickle-me> Resent-From: nixo Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 18 Jan 2020 13:36:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 38546 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 38546@debbugs.gnu.org Received: via spool by 38546-submit@debbugs.gnu.org id=B38546.157935452027248 (code B ref 38546); Sat, 18 Jan 2020 13:36:02 +0000 Received: (at 38546) by debbugs.gnu.org; 18 Jan 2020 13:35:20 +0000 Received: from localhost ([127.0.0.1]:40680 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1isoFz-00075P-W5 for submit@debbugs.gnu.org; Sat, 18 Jan 2020 08:35:20 -0500 Received: from mail-wr1-f67.google.com ([209.85.221.67]:44794) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1isoFw-00074p-Kk for 38546@debbugs.gnu.org; Sat, 18 Jan 2020 08:35:18 -0500 Received: by mail-wr1-f67.google.com with SMTP id q10so25226857wrm.11 for <38546@debbugs.gnu.org>; Sat, 18 Jan 2020 05:35:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=3wHwIKzcx13DtpDUPgHgk/mc6iYE8CtmkxrF8EUOukw=; b=fG25p3DXwS1CdJn5djnqJFHijytlTCcTcQkwV1rLjbIHcRd9jG41E/2tlNvshj3xGZ cl2nFgQgDGb9KKyWYkw5hhC3wdFRPpfFxPm9y3MFWSObfaq97N3fkYIexR38D4/L4voz yYT46MbzgPIHu+OmnXrnwjzEaQa8jQGo9K3xziChb7YjKP13krAAgqBkCc2xDttUNnsQ tRdnT1/I9LR2yh/dTz6Ttxgr0W5CwXXve9d+8E/5KsUyR3V/VODrqQm8ZlEjSSNLHVbe dH+uF9FKRo7x095RuBPzJ3bJ5aI1cldbuattvRhdGaASbs6fv/I1eQqak16dzmrzM9pu FfZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=3wHwIKzcx13DtpDUPgHgk/mc6iYE8CtmkxrF8EUOukw=; b=jHG8ECp+dmIWwvF7xqECfdniA/41gJABSN8VMOGhiFXxmXKn/u77JVDfJzlePQQHDF VEc7/35f/E0O4aUgFdiFAgTGrJe6c/d5j/CyVX11tLKJj6sGRFG2WuXggVcsz61Q5sEc y7IK5lbkVO9i1pFXgZeejuUwiRoOD/7Lln9XkM40IqwRq7rSDTMHvPALeLxFkFUBO9v5 IzigcmGL9nKwDLMYvmjLa0m0TRTb+jZz5JX3wS9PGHDjXQ2QGypBRCpkM80lZ5+EfaEx lK9jSUCj2MTEqUrypLjxF+nQWX7zxaj8wn6Q1tQqb8OpSGrgrB3oKimbPpAmdesF1WK3 /YBg== X-Gm-Message-State: APjAAAW2F2wPjVmDsbHbxQ1urgC3gLNhZT4CLbo/1DJw/teJCcMOIxWF t0iOz4PXh5xWEEH2WC63DbuckWLU X-Google-Smtp-Source: APXvYqzB5fFXuymWkcOKfhO2UqU0mucpCXl/dXbS2lDTZVY9oY0QGOiJH6kx6HQ+AVJxQI6vnDX/rA== X-Received: by 2002:adf:fd07:: with SMTP id e7mr8381561wrr.21.1579354510576; Sat, 18 Jan 2020 05:35:10 -0800 (PST) Received: from guixSD (host146-19-dynamic.50-79-r.retail.telecomitalia.it. [79.50.19.146]) by smtp.gmail.com with ESMTPSA id f1sm38767911wru.6.2020.01.18.05.35.09 for <38546@debbugs.gnu.org> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 Jan 2020 05:35:10 -0800 (PST) From: nixo X-Google-Original-From: nixo Date: Fri, 17 Jan 2020 19:40:55 +0100 Message-ID: <87k15ovqeq.fsf@guixSD.i-did-not-set--mail-host-address--so-tickle-me> MIME-Version: 1.0 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 precompilation --- guix/build/julia-build-system.scm | 51 +++++++++++++------------------ 1 file changed, 22 insertions(+), 29 deletions(-) diff --git a/guix/build/julia-build-system.scm b/guix/build/julia-build-system.scm index ff6fcf5fe3..dbd4af623d 100644 --- a/guix/build/julia-build-system.scm +++ b/guix/build/julia-build-system.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2019 Nicolò Balzarotti +;;; Copyright © 2019, 2020 Nicolò Balzarotti ;;; ;;; This file is part of GNU Guix. ;;; @@ -37,53 +37,46 @@ ;; subpath where we store the package content (define %package-path "/share/julia/packages/") -(define (generate-load-path inputs outputs) - (string-append - (string-join (map (match-lambda - ((_ . path) - (string-append path %package-path))) - ;; Restrict to inputs beginning with "julia-". - (filter (match-lambda - ((name . _) - (string-prefix? "julia-" name))) - inputs)) - ":") - (string-append ":" (assoc-ref outputs "out") %package-path) - ;; stdlib is always required to find Julia's standard libraries. - ;; usually there are other two paths in this variable: - ;; "@" and "@v#.#" - ":@stdlib")) - (define* (install #:key source inputs outputs #:allow-other-keys) (let* ((out (assoc-ref outputs "out")) (package-dir (string-append out %package-path - (string-append - (strip-store-file-name source))))) - (setenv "JULIA_LOAD_PATH" (generate-load-path inputs outputs)) + (strip-store-file-name source)))) (mkdir-p package-dir) - (copy-recursively source package-dir)) + (copy-recursively (getcwd) package-dir)) #t) -;; TODO: Precompilation is working, but I don't know how to tell -;; julia to use use it. If (on rantime) we set HOME to -;; store path, julia tries to write files there (failing) (define* (precompile #:key source inputs outputs #:allow-other-keys) (let* ((out (assoc-ref outputs "out")) (builddir (string-append out "/share/julia/")) (package (strip-store-file-name source))) (mkdir-p builddir) + ;; With a patch, SOURCE_DATE_EPOCH is honored + (setenv "SOURCE_DATE_EPOCH" "1") (setenv "JULIA_DEPOT_PATH" builddir) - (setenv "JULIA_LOAD_PATH" (generate-load-path inputs outputs)) - ;; Actual precompilation - (invoke-julia (string-append "using " package))) + ;; add new package dir to the load path + (setenv "JULIA_LOAD_PATH" + (string-append builddir "packages/" ":" + (or (getenv "JULIA_LOAD_PATH") + ""))) + ;; Actual precompilation. + (invoke-julia + ;; when using julia as a user, julia writes precompile cache to the first + ;; entry of the DEPOT_PATH list (by default, the home dir). We want to + ;; write it to the store, so let's push the store path as the first + ;; element of DEPOT_PATH. Once the cache file exists, this hack is not + ;; needed anymore (like in the check phase). If the user install new + ;; pacakges, those will be installed and precompiled in the home dir + (string-append "pushfirst!(DEPOT_PATH, pop!(DEPOT_PATH)); using " package))) #t) (define* (check #:key source inputs outputs #:allow-other-keys) (let* ((out (assoc-ref outputs "out")) (package (strip-store-file-name source)) (builddir (string-append out "/share/julia/"))) + ;; With a patch, SOURCE_DATE_EPOCH is honored + (setenv "SOURCE_DATE_EPOCH" "1") (setenv "JULIA_DEPOT_PATH" builddir) - (setenv "JULIA_LOAD_PATH" (generate-load-path inputs outputs)) + (setenv "JULIA_LOAD_PATH" (string-append builddir "packages/")) (invoke-julia (string-append "using Pkg;Pkg.test(\"" package "\")"))) #t)