[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Improve shell script headers and pre-inst-env handling
From: |
Ludovic Courtès |
Subject: |
Re: [PATCH] Improve shell script headers and pre-inst-env handling |
Date: |
Wed, 13 Feb 2013 21:57:29 +0100 |
User-agent: |
Gnus/5.130005 (Ma Gnus v0.5) Emacs/24.2 (gnu/linux) |
Mark H Weaver <address@hidden> skribis:
> So I've been working on a patch to fix the ./pre-inst-env problem using
> portable shell code instead of Guile code, as you suggested, and this is
> the kind of code I'm coming up with:
The first snippet looks good to me.
> but the more I look at this ugly, buggy code; and the more I fret
> about the inherent bugs having to do with poor handling of shell
> meta-characters and colons in file names; and the more I read of the
> "Portable Shell Programming" chapter of the autoconf manual, the less
> I understand why you feel so strongly about using this awful language
> instead of the Guile code I wrote. To save a few lines?
I think either we mix shell and Scheme (which we more or less have to do
because Guile is largely unusable as a shebang for several reasons), in
which case the shell snippet should be as small as possible, or we do
Scheme-only (which I thought was impossible, but I could be wrong.)
So:
> Please take a look at my proposed code one more time with fresh eyes:
[...]
> startup="
> (let ()
> (define-syntax-rule (push! elt v) (set! v (cons elt v)))
> (define (main interpreter module-dir script-file . args)
> (unless (getenv \"GUIX_UNINSTALLED\")
> (push! module-dir %load-path)
> (push! module-dir %load-compiled-path))
> (load script-file)
> (let ((proc (module-ref (resolve-interface '($script))
> '$script)))
> (apply proc args)))
> (apply main (command-line)))
Would this work if we used address@hidden@ -ds” and do that from there?
> * The boilerplate code is identical in all scripts except on line 4
> (script=guix-build).
Note that I think we’ll most likely have a single ‘guix’ script in the
near future, so that ‘guix-pull’ can actually update everything: Guix,
commands, and distro.
>> (BTW, rather than $GUIX_UNINSTALLED, it just occurred to me that
>> $GUIX_LOAD_PATH would do just as well while being more generic and
>> easier to implement/use.)
>
> I thought about this too, but it seems to me that it wouldn't work
> properly for "./pre-inst-env guile". Or am I missing something?
Something like:
--8<---------------cut here---------------start------------->8---
GUILE_LOAD_COMPILED_PATH="${GUIX_LOAD_PATH}${GUIX_LOAD_PATH:+:address@hidden@:$GUILE_LOAD_COMPILED_PATH"
export GUILE_LOAD_COMPILED_PATH
GUILE_LOAD_PATH="${GUIX_LOAD_PATH}${GUIX_LOAD_PATH:+:address@hidden@:$GUILE_LOAD_PATH"
export GUILE_LOAD_PATH
main='(module-ref (resolve-interface '\''(guix-package)) '\'guix-package')'
exec address@hidden@} -l "$0" ...
--8<---------------cut here---------------end--------------->8---
Thoughts? :-)
Ludo’.
- [PATCH] Improve shell script headers and pre-inst-env handling, Mark H Weaver, 2013/02/11
- Re: [PATCH] Improve shell script headers and pre-inst-env handling, Mark H Weaver, 2013/02/11
- Re: [PATCH] Improve shell script headers and pre-inst-env handling, Ludovic Courtès, 2013/02/12
- Re: [PATCH] Improve shell script headers and pre-inst-env handling, Mark H Weaver, 2013/02/12
- Re: [PATCH] Improve shell script headers and pre-inst-env handling, Mark H Weaver, 2013/02/13
- Re: [PATCH] Improve shell script headers and pre-inst-env handling,
Ludovic Courtès <=
- Re: [PATCH] Improve shell script headers and pre-inst-env handling, Mark H Weaver, 2013/02/14
- [PATCH] Replace individual scripts with master 'guix' script, Mark H Weaver, 2013/02/14
- Re: [PATCH] Replace individual scripts with master 'guix' script, Ludovic Courtès, 2013/02/14
- Re: [PATCH] Replace individual scripts with master 'guix' script, Mark H Weaver, 2013/02/14
- Re: [PATCH] Replace individual scripts with master 'guix' script, Ludovic Courtès, 2013/02/16
- Re: [PATCH] Replace individual scripts with master 'guix' script, Ludovic Courtès, 2013/02/17