From 288b447edaf86c6bdc00f7100cda338f4d63887a Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 10 Jun 2013 21:02:01 -0600 Subject: libremakepkg: integrate distcc-tool --- src/chroot-tools/libremakepkg | 67 ++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 63 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/chroot-tools/libremakepkg b/src/chroot-tools/libremakepkg index d2ce222..f4fda83 100755 --- a/src/chroot-tools/libremakepkg +++ b/src/chroot-tools/libremakepkg @@ -52,7 +52,12 @@ run() ( local copydir=$1; shift local cmd="$*" - trap "rm -f -- '$copydir/chrootexec'" EXIT + if $HASNET; then + trap "rm -f -- '$copydir/chrootexec'" EXIT + else + distcc_start "$copydir" + trap "rm -f -- '$copydir/chrootexec'; distcc_stop '$copydir'" EXIT + fi cat >"$copydir/chrootexec" < "$home/.makepkg.conf" + + printf '%s\n' \ + 'Host *' \ + ' ProxyCommand /distcc-tool client %h %p' \ + > "$home/.ssh/config" + + distcc-tool odaemon "$copydir" & + echo $! > "$copydir/distcc-tool.pid" + fi +} + +distcc_stop() { + local copydir=$1 + local home=$LIBREHOME + $INCHROOT || home="$copydir/build" + if [[ -f "$copydir/distcc-tool.pid" ]]; then + + odaemon=$(cat "$copydir/distcc-tool.pid") + kill -- $odaemon + + rm -f -- \ + "$copydir/distcc-tool" \ + "$home/.makepkg.conf" \ + "$home/.ssh/config" \ + "$copydir/distcc-tool.pid" + fi +} + # Usage: add_to_local_repo $copydir $pkgfiles... add_to_local_repo() ( set +euE @@ -217,9 +267,18 @@ usage() { echo "Usage: $cmd [options] [-- makepkg args]" echo 'This program will build your package.' echo '' - echo 'If run from outside of a chroot, this will set PKGDEST and' - echo "SRCDEST in the chroot's \`/etc/makepkg.conf', as well as making" - echo "whataver alterations to the chroot \`librechroot' makes." + echo 'If run from outside of a chroot, command will make the following' + echo 'configuration changes in the chroot:' + echo ' - whatever changes `librechroot` makes.' + echo ' - set `PKGDEST` and `SRCDEST` in `/etc/makepkg.conf`' + echo ' - (maybe) delete `/build/.makepkg.conf`' + echo ' - (maybe) delete `/build/.ssh/config`' + echo 'If run from inside of a chroot, this command will:' + echo ' - (maybe) delete `~/.makepkg.conf`' + echo ' - (maybe) delete `~/.ssh/config`' + echo "The above 'maybe's happen as part of the workarounds to make" + echo 'distcc work in a network-less environment. They will happen if' + echo 'both `socat` and `distcc` are installed in the chroot.' echo '' echo "The \`-n' and \`-l' options behave identically to librechroot," echo 'see the documentation there.' -- cgit v1.2.2