summaryrefslogtreecommitdiff
path: root/src/chroot-tools/libremakepkg
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2013-09-14 14:14:20 -0400
committerLuke Shumaker <LukeShu@sbcglobal.net>2013-09-14 14:14:20 -0400
commit564a4cfa06a8a1cf880583669cc578f8cc45dc44 (patch)
treebe5c9eff2d0c96fff6a8f956e47f6e5e7821f210 /src/chroot-tools/libremakepkg
parent6556108c9d8a4d93f482f84c8321bda9565eac37 (diff)
libremakepkg: add a librechroot_flags variable, split chrootbuild up
We split chrootbuild so that the initialization bit runs before hook_pre_build.
Diffstat (limited to 'src/chroot-tools/libremakepkg')
-rwxr-xr-xsrc/chroot-tools/libremakepkg32
1 files changed, 19 insertions, 13 deletions
diff --git a/src/chroot-tools/libremakepkg b/src/chroot-tools/libremakepkg
index 45f57ea..5494202 100755
--- a/src/chroot-tools/libremakepkg
+++ b/src/chroot-tools/libremakepkg
@@ -33,6 +33,7 @@ NONET=true # can be changed with the -N flag
# {SRC,LOG,PKG}DEST set at runtime by makepkg.conf
# MAKEFLAGS, PACKAGER set at runtime by makepkg.conf
# LIBREUSER, LIBREHOME are set by conf.sh
+librechroot_flags=()
# Hooks ########################################################################
@@ -89,23 +90,21 @@ add_to_local_repo() {
build() (
local copydir=$1; shift
- local cmd=(/chrootbuild "$@")
-
- run_hook pre_build "$copydir"
- trap "run_hook post_build '$copydir'" EXIT
local netflag=''
+ local run=()
if $INCHROOT; then
- ! $NONET || netflag='-n'
- unshare $netflag -- "${cmd[@]}"
- else
! $NONET || netflag='-N'
- librechroot $netflag \
- -r "$PWD:/startdir_host" \
- -r "$SRCDEST:/srcdest_host" \
- -l "$copydir" \
- run "${cmd[@]}"
+ run=(unshare)
+ else
+ ! $NONET || netflag='-n'
+ run=(librechroot "${librechroot_flags[@]}" run)
fi
+
+ "${run[@]}" /chrootprepare "$@"
+ run_hook pre_build "$copydir"
+ trap "run_hook post_build '$copydir'" EXIT
+ "${run[@]}" /chrootbuild "$@"
)
# The main program #############################################################
@@ -211,6 +210,13 @@ main() {
MAKEFLAGS="$(get_conf_makepkg MAKEFLAGS '')"
PACKAGER="$(get_conf_makepkg PACKAGER '')"
+ librechroot_flags=(
+ -r "$PWD:/startdir_host"
+ -r "$SRCDEST:/srcdest_host"
+ -n "$CHROOT"
+ -l "$copy"
+ )
+
# OK, we are starting now ##############################################
if $INCHROOT; then
@@ -221,7 +227,7 @@ main() {
lock 9 "$copydir.lock" \
"Waiting for existing lock on chroot copy to be released: [%s]" "$copy"
# Create the chroot if it does not exist
- librechroot -n "$CHROOT" -l "$copy" make
+ librechroot "${librechroot_flags[@]}" make
fi
# Set target CARCH