← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~adconrad/launchpad-buildd/slave-prep into lp:launchpad-buildd

 

Adam Conrad has proposed merging lp:~adconrad/launchpad-buildd/slave-prep into lp:launchpad-buildd.

Requested reviews:
  William Grant (wgrant)

For more details, see:
https://code.launchpad.net/~adconrad/launchpad-buildd/slave-prep/+merge/84425

Add a slave-prep script, moving the ntpdate code into it, and outputting our version number at the top of build logs.
-- 
https://code.launchpad.net/~adconrad/launchpad-buildd/slave-prep/+merge/84425
Your team Launchpad code reviewers is subscribed to branch lp:launchpad-buildd.
=== modified file 'debian/changelog'
--- debian/changelog	2011-11-29 12:38:46 +0000
+++ debian/changelog	2011-12-05 02:42:23 +0000
@@ -1,11 +1,20 @@
 launchpad-buildd (110) UNRELEASED; urgency=low
 
+  [ Jelmer Vernooij ]
   * Use the actual target distroseries name in changelog, rather than
     the same as the last entry. LP: #855479
   * Use os.SEEK_END constant now that all build slaves run at least
     hardy. LP: #239213
 
- -- Jelmer Vernooij <jelmer@xxxxxxxxxx>  Tue, 29 Nov 2011 13:38:07 +0100
+  [ Adam Conrad ]
+  * Create a new slavebin script called 'slave-prep' to kick off builds:
+    - Move useless "echo" fork to slave-prep, and include our version
+    - Move ntpdate call from unpack-chroot to slave-prep
+    - Add preppath to the default config, and add a version 110 upgrade
+      stanza to our config file upgrading script to fix upgrades
+  * While doing the above, s/Synching/Syncing/ 'cause it drives me nuts
+
+ -- Adam Conrad <adconrad@xxxxxxxxxx>  Sun, 04 Dec 2011 19:29:48 -0700
 
 launchpad-buildd (109) hardy; urgency=low
 

=== modified file 'debian/rules'
--- debian/rules	2011-11-17 11:48:30 +0000
+++ debian/rules	2011-12-05 02:42:23 +0000
@@ -13,12 +13,13 @@
 # this directory, so that the source package is valid.
 # after that, build the source package found in the parent directory.
 
+source_version = $(shell dpkg-parsechangelog | grep ^Version: | awk '{print $$2}')
 target = debian/launchpad-buildd
 topdir = .
 
 slavebins = unpack-chroot mount-chroot update-debian-chroot sbuild-package \
     scan-for-processes umount-chroot remove-build override-sources-list \
-    buildrecipe generate-translation-templates
+    buildrecipe generate-translation-templates slave-prep
 
 BUILDDUID=65500
 BUILDDGID=65500
@@ -63,6 +64,7 @@
 
 clean:
 	dh_clean
+	rm -f slave-prep
 
 prepare:
 
@@ -71,6 +73,8 @@
 
 build:
 	@echo Mmm builders
+	sed -e 's/@@VERSION@@/$(source_version)/' slave-prep.in > slave-prep
+	chmod 755 slave-prep
 
 build-arch: build
 build-indep: build

=== modified file 'debian/upgrade-config'
--- debian/upgrade-config	2011-11-21 01:20:05 +0000
+++ debian/upgrade-config	2011-12-05 02:42:23 +0000
@@ -102,6 +102,17 @@
         if not line.startswith('ogrepath'):
             out_file.write(line)
 
+def upgrade_to_110():
+    print "Upgrading %s to version 110" % conf_file
+    subprocess.call(["mv", conf_file, conf_file+"-prev110~"])
+    in_file = open(conf_file+"-prev110~", "r")
+    out_file = open(conf_file, "w")
+    for line in in_file:
+        if line.startswith("[allmanagers]"):
+            line += "preppath = /usr/share/launchpad-buildd/slavebin/slave-prep\n"
+        out_file.write(line)
+    in_file.close()
+    out_file.close()
 
 if __name__ == "__main__":
     old_version = re.sub(r'[~-].*', '', old_version)
@@ -119,4 +130,6 @@
         upgrade_to_59()
     if int(old_version) < 63:
         upgrade_to_63()
+    if int(old_version) < 110:
+        upgrade_to_110()
 

=== modified file 'lpbuildd/slave.py'
--- lpbuildd/slave.py	2011-11-29 12:38:46 +0000
+++ lpbuildd/slave.py	2011-12-05 02:42:23 +0000
@@ -99,6 +99,7 @@
         object.__init__(self)
         self._buildid = buildid
         self._slave = slave
+        self._preppath = slave._config.get("allmanagers", "preppath")
         self._unpackpath = slave._config.get("allmanagers", "unpackpath")
         self._cleanpath = slave._config.get("allmanagers", "cleanpath")
         self._mountpath = slave._config.get("allmanagers", "mountpath")
@@ -161,8 +162,7 @@
         if extra_args.get('archive_private'):
             self.is_archive_private = True
 
-        self.runSubProcess(
-            "/bin/echo", ["echo", "Forking build subprocess..."])
+        self.runSubProcess(self._preppath, ["slave-prep"])
 
     def iterate(self, success):
         """Perform an iteration of the slave.

=== added file 'slave-prep.in'
--- slave-prep.in	1970-01-01 00:00:00 +0000
+++ slave-prep.in	2011-12-05 02:42:23 +0000
@@ -0,0 +1,23 @@
+#!/bin/sh
+#
+# Copyright 2009 Canonical Ltd.  This software is licensed under the
+# GNU Affero General Public License version 3 (see the file LICENSE).
+
+# Buildd Slave initial preparation script
+
+export PATH=/usr/bin:/bin:/usr/sbin:/sbin:${PATH}
+
+NTPDATE=ntpdate
+SUDO=sudo
+BUILDDVERSION=@@VERSION@@
+
+echo "Forking launchpad-buildd (version $BUILDDVERSION) slave process..."
+
+if [ -f /etc/launchpad-buildd/default ]; then
+  eval `grep ntphost /etc/launchpad-buildd/default | sed 's/ //g'`
+fi
+if [ -n "$ntphost" ]; then
+  echo "Syncing the system clock with the buildd NTP service..."
+  $SUDO $NTPDATE -u $ntphost
+fi
+

=== modified file 'template-buildd-slave.conf'
--- template-buildd-slave.conf	2011-11-09 07:50:56 +0000
+++ template-buildd-slave.conf	2011-12-05 02:42:23 +0000
@@ -10,6 +10,7 @@
 ntphost = ntp.buildd
 
 [allmanagers]
+preppath = /usr/share/launchpad-buildd/slavebin/slave-prep
 unpackpath = /usr/share/launchpad-buildd/slavebin/unpack-chroot
 cleanpath = /usr/share/launchpad-buildd/slavebin/remove-build
 mountpath = /usr/share/launchpad-buildd/slavebin/mount-chroot

=== modified file 'unpack-chroot'
--- unpack-chroot	2011-11-09 07:50:56 +0000
+++ unpack-chroot	2011-12-05 02:42:23 +0000
@@ -15,7 +15,6 @@
 
 export PATH=/usr/bin:/bin:/usr/sbin:/sbin:${PATH}
 
-NTPDATE=ntpdate
 TAR=tar
 SUDO=sudo
 BUNZIP2=bunzip2
@@ -37,14 +36,6 @@
   exec $0 "$@"
 fi
 
-if [ -f /etc/launchpad-buildd/default ]; then
-  eval `grep ntphost /etc/launchpad-buildd/default | sed 's/ //g'`
-fi
-if [ -n "$ntphost" ]; then
-  echo "Synching the system clock with the buildd NTP service..."
-  $SUDO $NTPDATE -u $ntphost
-fi
-
 cd $HOME
 cd "build-$BUILDID"
 


Follow ups