[Swan-dev] redirection in swan-install

D. Hugh Redelmeier hugh at mimosa.com
Sun Mar 9 05:00:07 EET 2014


| From: Antony Antony <antony at phenome.org>

| Watch out there is another one called swan-build too with same redirection.

| The build and install are separate because if you are using OBJDIR on a 
| p9 fs "make programs module" once and install install_module multiple 
| times.

The way it came to my system, OBJDIR is on /tmp (tmpfs) for speed.

The documented procedure was:

on one machine: swan-update
on each other machine: swan-install

That didn't work.  I made it work by taring OBJDIR at the end of the
first step, into a tar file on /source (the shared Plan 9 filesystem),
and untaring it back into /tmp on each other machine at the start of
the swan-install.

I had tried cp -a but the P9 filesystem prevented chowning and so
the copy lacked fidelity.

| An advantage of using OBJDIR on p9 fs is you could ssh into the guest vm 
| and run gdb. OBJDIR will be there even after a reboot.

The tar file manages persistence, albeit in a hackier way.

Here are my "improvements" to /testing/guestbin/swan-build and
testing/guestbin/swan-install

I don't feel I know the (unwritten) specifications well enough to tell
if others would consider these changes to be improvements.  They
certainly were improvements for me.

- all output goes to compile-log.txt, including stderr

- the exit code of the make commands is reported (not logged) if not
  zero

- the log is started with a marker that shows the command, the host,
  and the date

- the tar file is created and used as described above

Should I check these in?

diff --git a/testing/guestbin/swan-build b/testing/guestbin/swan-build
index e63c2e0..23845df 100755
--- a/testing/guestbin/swan-build
+++ b/testing/guestbin/swan-build
@@ -8,4 +8,15 @@ rm -rf /tmp/lsw_build modobj*
 
 # we use /tmp because it is on tmpfs and compiles much faster, even faster
 # than using ccache on the regular disk image files.
-make OBJDIR=/tmp/lsw_build programs module 2>&1 > compile-log.txt
+
+>compile-log.txt
+
+echo ">>> $0 on `hostname` at `date`" >>compile-log.txt
+
+if ! make OBJDIR=/tmp/lsw_build programs module >>compile-log.txt 2>&1
+then
+	echo '"make programs module"'" failed: $?; see compile-log.txt"
+fi
+
+# save ephemeral build results (for sharing with other machines)
+tar czf lsw_build.tgz --absolute-names /tmp/lsw_build
diff --git a/testing/guestbin/swan-install b/testing/guestbin/swan-install
index 852bd95..9d9e30b 100755
--- a/testing/guestbin/swan-install
+++ b/testing/guestbin/swan-install
@@ -4,11 +4,24 @@ pidof pluto >/dev/null && ipsec setup stop 2> /dev/null
 
 cd /source
 
+# grab ephemeral build results
+rm -rf /tmp/lsw_build
+tar xzf lsw_build.tgz --absolute-names
+
 # we use /tmp because it is on tmpfs and compiles much faster, even faster
 # than using ccache on the regular disk image files.
-make OBJDIR=/tmp/lsw_build install 2>&1 >> compile-log.txt
 
-make module_install 2>&1 >> compile-log.txt
+echo ">>> $0 on `hostname` at `date`" >>compile-log.txt
+
+if ! make OBJDIR=/tmp/lsw_build install >>compile-log.txt 2>&1
+then
+	echo '"make install"'" failed: $?; see compile-log.txt"
+fi
+
+if ! make module_install >>compile-log.txt 2>&1
+then
+	echo '"make module_install"'" failed: $?; see compile-log.txt"
+fi
 
 # ensure selinux bits
 restorecon /usr/local/sbin -Rv


More information about the Swan-dev mailing list