Christopher Lemmer Webber <cweb...@dustycloud.org> writes: > Bonface M. K. writes: >
[...] > I have the notes that Dimos wrote up not long ago in case anyone is > interested. Dimos, do you mind if I post them to the list? > > - Chris Hi! I've been trying to hack around the racket build system(see attached) for some time now; mostly using raco... The biggest problem I've faced so far is that AFAICT, when you use raco to install packages, racket updates some files from where it's called(in guix's case store this is the store where racket is in)--- and I don't think you are allowed to do this. I've tried doing "raco install <zipfile>", and also just doing "raco install" from inside the directory. The command for building: --8<---------------cut here---------------start------------->8--- env GUIX_PACKAGE_PATH="/home/bonface/projects/guix-bioinformatics:/home/bonface/projects/guix-past/modules" ./pre-inst-env guix build racket-hello-racket -K --8<---------------cut here---------------end--------------->8--- with the error: --8<---------------cut here---------------start------------->8--- starting phase `install' make-directory: cannot make directory path: /homeless-shelter/ system error: Permission denied; errno=13 context...: /gnu/store/4f148vh30qmrdl6apq1ff6yqb7kl8xlm-racket-minimal-7.8/share/racket/collects/racket/file.rkt:114:0: make-directory* [repeats 1 more time] /gnu/store/4f148vh30qmrdl6apq1ff6yqb7kl8xlm-racket-minimal-7.8/share/racket/collects/pkg/private/lock.rkt:26:0: with-pkg-lock* /gnu/store/4f148vh30qmrdl6apq1ff6yqb7kl8xlm-racket-minimal-7.8/share/racket/collects/pkg/main.rkt:216:16 (submod "/gnu/store/4f148vh30qmrdl6apq1ff6yqb7kl8xlm-racket-minimal-7.8/share/racket/collects/pkg/main.rkt" main): [running body] temp35_0 for-loop run-module-instance! for-loop [repeats 1 more time] run-module-instance! "/gnu/store/4f148vh30qmrdl6apq1ff6yqb7kl8xlm-racket-minimal-7.8/share/racket/collects/raco/raco.rkt": [running body] temp35_0 for-loop run-module-instance! "/gnu/store/4f148vh30qmrdl6apq1ff6yqb7kl8xlm-racket-minimal-7.8/share/racket/collects/raco/main.rkt": [running body] ... Inferred package name from given `--clone' path package: source given path: /tmp/guix-build-racket-hello-racket-0.0.1.drv-0/source command "raco" "pkg" "install" "--no-cache" "--no-setup" "--ignore-checksums" "--clone" "/tmp/guix-build-racket-hello-racket-0.0.1.drv-0/source" failed with status 1 builder for `/gnu/store/filph2d8m7k1rq6rpglwx1y082ris6g0-racket-hello-racket-0.0.1.drv' failed with exit code 1 build of /gnu/store/filph2d8m7k1rq6rpglwx1y082ris6g0-racket-hello-racket-0.0.1.drv failed View build log at '/var/log/guix/drvs/fi/lph2d8m7k1rq6rpglwx1y082ris6g0-racket-hello-racket-0.0.1.drv.bz2'. guix build: error: build of `/gnu/store/filph2d8m7k1rq6rpglwx1y082ris6g0-racket-hello-racket-0.0.1.drv' failed --8<---------------cut here---------------end--------------->8--- And when troubleshooting: --8<---------------cut here---------------start------------->8--- cd /tmp/guix-build-racket-hello-racket-0.0.1.drv-0 /home/bonface/guix/pre-inst-env guix environment \ --no-grafts -C racket-hello-racket --ad-hoc strace gdb source ./environment-variables $GUIX_ENVIRONMENT/bin/raco pkg install --no-cache \ --no-setup --ignore-checksums --8<---------------cut here---------------end--------------->8--- Which works just fine since I'm updating files inside $GUIX_ENVIRONMENT. Right now I'm looking for ideas to experiment with to try to overcome this, and the low hanging fruit is to successfully build a hello-racket package with zero deps and no tests. To simply put it, AFAIU updating a package would require racket to update it's references(either links, and other references that I won't go into), hence creating some form of "global state"; thereby if you use raco, every package updated would lead to some update with racket's search paths or dirs somewhere. Any ideas to overcome this wall? (or anything I've got wrong somewhere?)
;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2020 Bonface Munyoki Kilyungi <bonfacemuny...@gmail.com> ;;; ;;; This file is part of GNU Guix. ;;; ;;; GNU Guix is free software; you can redistribute it and/or modify it ;;; under the terms of the GNU General Public License as published by ;;; the Free Software Foundation; either version 3 of the License, or (at ;;; your option) any later version. ;;; ;;; GNU Guix is distributed in the hope that it will be useful, but ;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;; GNU General Public License for more details. ;;; ;;; You should have received a copy of the GNU General Public License ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. (define-module (guix build racket-build-system) #:use-module ((guix build gnu-build-system) #:prefix gnu:) #:use-module (guix build union) #:use-module (guix build utils) #:use-module (srfi srfi-1) #:use-module (srfi srfi-26) #:export (%standard-phases racket-build)) ;; Commentary: ;; ;; Builder-side code of the racket package build procedure. ;; ;; Code: (define (racket-package? name) (string-prefix? "racket-" name)) ;; Currently not working (define* (check #:key tests? #:allow-other-keys) "Run tests for the racket package" (if tests? (invoke "raco" "test") (format #t "test suite not run~%")) #t) (define (call-raco-pkg command params) (apply invoke "raco" "pkg" command params)) ;; TODO: Find a work around to make this work without modifying where racket ;; store (define* (install #:key outputs #:allow-other-keys) "Install the racket pkg" (let ((out (assoc-ref outputs "out"))) (call-raco-pkg "install" `("--no-cache" "--no-setup" "--ignore-checksums" "--clone" ,(getcwd))))) (define %standard-phases (modify-phases gnu:%standard-phases (delete 'bootstrap) (delete 'configure) (delete 'patch-generated-file-shebangs) (delete 'build) (replace 'install install))) (define* (racket-build #:key inputs (phases %standard-phases) #:allow-other-keys #:rest args) "Build the given racket package, applying all of PHASES in order." (apply gnu:gnu-build #:inputs inputs #:phases phases args))
;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2020 Bonface Munyoki Kilyungi <bonfacemuny...@gmail.com> ;;; ;;; This file is part of GNU Guix. ;;; ;;; GNU Guix is free software; you can redistribute it and/or modify it ;;; under the terms of the GNU General Public License as published by ;;; the Free Software Foundation; either version 3 of the License, or (at ;;; your option) any later version. ;;; ;;; GNU Guix is distributed in the hope that it will be useful, but ;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;; GNU General Public License for more details. ;;; ;;; You should have received a copy of the GNU General Public License ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. (define-module (guix build-system racket) #:use-module (guix utils) #:use-module (guix derivations) #:use-module (guix search-paths) #:use-module (guix build-system) #:use-module (guix build-system gnu) #:use-module (guix packages) #:use-module (ice-9 match) #:export (%racket-build-system-modules racket-build racket-build-system)) ;; Commentary: ;; Builder-side code of the standard Racket package build procedure ;; ;; ;; Background about the Racket Installation methods (define %racket-build-system-modules ;; Build-side modules imported and used by default. `((guix build racket-build-system) (guix build union) ,@%gnu-build-system-modules)) (define (default-racket) (let ((scheme (resolve-interface '(gnu packages scheme)))) (module-ref scheme 'racket-minimal))) (define* (lower name #:key source inputs native-inputs outputs system target (racket (default-racket)) #:allow-other-keys #:rest arguments) "Return a bag for NAME." (define private-keywords '(#:source #:target #:racket #:inputs #:native-inputs)) (and (not target) (bag (name name) (system system) (host-inputs `(,@(if source `(("source" ,source)) '()) ,@inputs ;; Keep the standard inputs of 'gnu-build-system'. ,@(standard-packages))) (build-inputs `(("racket" ,racket) ,@native-inputs)) (outputs outputs) (build racket-build) (arguments (strip-keyword-arguments private-keywords arguments))))) (define* (racket-build store name inputs #:key (phases '(@ (guix build racket-build-system) %standard-phases)) (outputs '("out")) (search-paths '()) (unpack-path "") (build-flags ''()) (tests? #t) (system (%current-system)) (guile #f) (imported-modules %racket-build-system-modules) (modules '((guix build racket-build-system) (guix build union) (guix build utils)))) (define builder `(begin (use-modules ,@modules) (racket-build #:name ,name #:source ,(match (assoc-ref inputs "source") (((? derivation? source)) (derivation->output-path source)) ((source) source) (source source)) #:system ,system #:phases ,phases #:outputs %outputs #:search-paths ',(map search-path-specification->sexp search-paths) #:unpack-path ,unpack-path #:build-flags ,build-flags #:tests? ,tests? #:inputs %build-inputs))) (define guile-for-build (match guile ((? package?) (package-derivation store guile system #:graft? #f)) (#f ; the default (let* ((distro (resolve-interface '(gnu packages commencement))) (guile (module-ref distro 'guile-final))) (package-derivation store guile system #:graft? #f))))) (build-expression->derivation store name builder #:inputs inputs #:system system #:modules imported-modules #:outputs outputs #:guile-for-build guile-for-build)) (define racket-build-system (build-system (name 'racket) (description "Build system for Racket programs") (lower lower)))
-- Bonface M. K. <https://www.bonfacemunyoki.com> Chief Emacs Bazu / Rieng ya software sare Mchochezi of: <https://upbookclub.com> / Twitter: @BonfaceKilz GPG Key: D4F09EB110177E03C28E2FE1F5BBAE1E0392253F
signature.asc
Description: PGP signature