I'm attaching a patch. It's a separate file; if I add these lines
#:use-module (guix packages) #:use-module (guix store) to 'guix/build/utils.scm', they will raise the following error on 'make'. Backtrace: In ice-9/eval.scm: 400: 19 [eval # ()] In ice-9/boot-9.scm: 2681: 18 [define-module* (guix utils) #:filename ...] 2656: 17 [resolve-imports (((guix config)) ((guix packages)) ((guix store)) ...)] 2594: 16 [resolve-interface (guix packages) #:select ...] 2519: 15 [#<procedure 8fee7a0 at ice-9/boot-9.scm:2507:4 (name #:optional autoload version #:key ensure)> # ...] 2786: 14 [try-module-autoload (guix packages) #f] 2131: 13 [save-module-excursion #<procedure 92a4eb8 at ice-9/boot-9.scm:2787:17 ()>] 2797: 12 [#<procedure 92a4eb8 at ice-9/boot-9.scm:2787:17 ()>] In unknown file: ?: 11 [primitive-load-path "guix/packages" #f] In guix/packages.scm: 19: 10 [#<procedure 92cece0 ()>] In ice-9/boot-9.scm: 2681: 9 [define-module* (guix packages) #:filename ...] 2656: 8 [resolve-imports (((guix utils)) ((guix store)) ((guix base32)) ...)] 2594: 7 [resolve-interface (guix derivations) #:select ...] 2519: 6 [#<procedure 8fee7a0 at ice-9/boot-9.scm:2507:4 (name #:optional autoload version #:key ensure)> # ...] 2786: 5 [try-module-autoload (guix derivations) #f] 2131: 4 [save-module-excursion #<procedure 93f87c8 at ice-9/boot-9.scm:2787:17 ()>] 2797: 3 [#<procedure 93f87c8 at ice-9/boot-9.scm:2787:17 ()>] In unknown file: ?: 2 [primitive-load-path "guix/derivations" #f] In guix/derivations.scm: 317: 1 [#<procedure 9439920 ()>] In ice-9/boot-9.scm: 106: 0 [#<procedure 913a8c0 at ice-9/boot-9.scm:97:6 (thrown-k . args)> unbound-variable ...] ice-9/boot-9.scm:106:20: In procedure #<procedure 913a8c0 at ice-9/boot-9.scm:97:6 (thrown-k . args)>: ice-9/boot-9.scm:106:20: In procedure module-lookup: Unbound variable: memoize make[2]: *** [guix/utils.go] Error 1 make[2]: Leaving directory `/home/guix-savannah' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/home/guix-savannah' make: *** [all] Error 2 I don't think that 'store-location' is really needed. I added it because I hadn't found a procedure that can return something like '/nix/store/*-wget-1.14/bin/wget'. Also, 'bin-location' and 'chmod' are not safe. It can be solved with 'file-exists?', but I decided not to use it because I want to rewrite the whole thing. Any suggestions? Example: scheme@(guile-user)> ,use (gnu packages wget) (gnu packages gawk) scheme@(guile-user)> ,use (wrap-program) scheme@(guile-user)> (wrap-program wget #t "PATH" (store-location gawk "out" "/bin")) #!/bin/sh export PATH="/nix/store/l5gkkxbjrlhddpxyxl6glhyczvh0gggw-gawk-4.0.0/bin:$PATH" exec ./.wget-real "$@"
;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2013 Nikita Karetnikov <nik...@karetnikov.org> ;;; ;;; 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 (wrap-program) #:use-module (guix packages) #:use-module (guix store) #:use-module (srfi srfi-26) #:export (store-location wrap-program)) (define (store-location package output rest) "Return a PACKAGE-related location." (string-append (package-output (open-connection) package output) rest)) (define (wrap-program program prefix? variable var-dir) "Copy PROGRAM to .PROGRAM-real and make PROGRAM a wrapper." (let* ((bin-location (store-location program "out" (string-append "/bin"))) ; not safe (program-name (package-name program)) (old (string-append bin-location "/" program-name)) (new (string-append bin-location "/." program-name "-real")) (tmp (string-append bin-location "/." program-name "-tmp"))) (define (change-variable) ;; Prepend VAR-DIR to VARIABLE or return VAR-DIR. (if prefix? (string-append var-dir ":$" variable) var-dir)) (copy-file old new) (call-with-output-file tmp (cut format <> "#!/bin/sh~%export ~a=\"~a\"~%exec ./~a \"$@\"~%" variable (change-variable) (basename new))) (chmod tmp #o755) (rename-file tmp old)))
pgp5zx3bDnQUg.pgp
Description: PGP signature