From mboxrd@z Thu Jan 1 00:00:00 1970 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 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-Message-ID: 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 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: 38546@debbugs.gnu.org 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-sys= tem.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 =C2=A9 2019 Nicol=C3=B2 Balzarotti +;;; Copyright =C2=A9 2019, 2020 Nicol=C3=B2 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/") =20 -(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) =20 -;; 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 f= irst + ;; 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 n= ot + ;; 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 " pac= kage))) #t) =20 (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) =20 --=20 2.24.1