distro: Search bootstrap binaries and patches in %LOAD-PATH.

* Makefile.am (patchdir, bootstrapdir): Change to be sub-directories of
  $(guilemoduledir).
  (.scm.go): Remove `DISTRO_' environment variables.
* distro.scm (not-colon): Remove.
  (%patch-path, %bootstrap-binaries-path): Default to sub-directories of
  the entries in %LOAD-PATH.
* pre-inst-env.in: Remove definition of `DISTRO_' environment variables.
This commit is contained in:
Ludovic Courtès 2012-11-25 16:28:52 +01:00
parent fe7777c14b
commit 0b3651bc93
3 changed files with 13 additions and 20 deletions

View file

@ -87,7 +87,7 @@ GOBJECTS = $(MODULES:%.scm=%.go) guix/config.go
nobase_dist_guilemodule_DATA = $(MODULES)
patchdir = $(pkgdatadir)/patches
patchdir = $(guilemoduledir)/distro/packages/patches
dist_patch_DATA = \
distro/packages/patches/binutils-ld-new-dtags.patch \
distro/packages/patches/diffutils-gets-undeclared.patch \
@ -108,7 +108,7 @@ dist_patch_DATA = \
distro/packages/patches/shishi-gets-undeclared.patch \
distro/packages/patches/tar-gets-undeclared.patch
bootstrapdir = $(pkgdatadir)/bootstrap
bootstrapdir = $(guilemoduledir)/distro/packages/bootstrap
bootstrap_x86_64_linuxdir = $(bootstrapdir)/x86_64-linux
bootstrap_i686_linuxdir = $(bootstrapdir)/i686-linux
@ -196,8 +196,6 @@ CLEANFILES = $(GOBJECTS) *.log
.scm.go:
$(MKDIR_P) `dirname "$@"`
DISTRO_INSTALLED_PATCH_DIRECTORY="$(patchdir)" \
DISTRO_INSTALLED_BOOTSTRAP_DIRECTORY="$(bootstrapdir)" \
$(top_builddir)/pre-inst-env \
$(GUILD) compile -L "$(top_builddir)" -L "$(top_srcdir)" \
-Wformat -Wunbound-variable -Warity-mismatch \

View file

@ -26,6 +26,7 @@ (define-module (distro)
#:export (search-patch
search-bootstrap-binary
%patch-directory
%bootstrap-binaries-path
fold-packages
find-packages-by-name))
@ -38,23 +39,21 @@ (define-module (distro)
(define _ (cut gettext <> "guix"))
(define not-colon
;; The char set that contains all the characters but `:'.
(char-set-complement (char-set #\:)))
;; By default, we store patches and bootstrap binaries alongside Guile
;; modules. This is so that these extra files can be found without
;; requiring a special setup, such as a specific installation directory
;; and an extra environment variable. One advantage of this setup is
;; that everything just works in an auto-compilation setting.
(define %patch-path
(make-parameter
(or (and=> (getenv "DISTRO_PATCH_PATH")
(cut string-tokenize <> not-colon))
(compile-time-value
(list (getenv "DISTRO_INSTALLED_PATCH_DIRECTORY"))))))
(map (cut string-append <> "/distro/packages/patches")
%load-path)))
(define %bootstrap-binaries-path
(make-parameter
(or (and=> (getenv "DISTRO_BOOTSTRAP_PATH")
(cut string-tokenize <> not-colon))
(compile-time-value
(list (getenv "DISTRO_INSTALLED_BOOTSTRAP_DIRECTORY"))))))
(map (cut string-append <> "/distro/packages/bootstrap")
%load-path)))
(define (search-patch file-name)
"Search the patch FILE-NAME."

View file

@ -23,12 +23,8 @@
# Run COMMAND in a pre-installation environment. Typical use is
# "./pre-inst-env guix-build hello".
DISTRO_PATCH_PATH="@abs_top_srcdir@/distro/packages/patches"
DISTRO_BOOTSTRAP_PATH="@abs_top_srcdir@/distro/packages/bootstrap:@abs_top_builddir@/distro/packages/bootstrap"
GUILE_LOAD_COMPILED_PATH="@abs_top_builddir@${GUILE_LOAD_COMPILED_PATH:+:}$GUILE_LOAD_COMPILED_PATH"
GUILE_LOAD_PATH="@abs_top_srcdir@${GUILE_LOAD_PATH:+:}:$GUILE_LOAD_PATH"
export DISTRO_PATCH_PATH DISTRO_BOOTSTRAP_PATH
GUILE_LOAD_PATH="@abs_top_builddir@:@abs_top_srcdir@${GUILE_LOAD_PATH:+:}:$GUILE_LOAD_PATH"
export GUILE_LOAD_COMPILED_PATH GUILE_LOAD_PATH
# Define $PATH so that `guix-build' and friends are easily found.