Mail archive
alpine-aports

[alpine-aports] [PATCH 3/5] testing/buildbot: Fix some stuff.

From: Przemyslaw Pawelczyk <przemoc_at_zoho.com>
Date: Fri, 17 Jun 2016 03:47:31 +0200

* APKBUILD: Leverage default_prepare and use builddir (no _).
* APKBUILD: Introduce some constants for better DRY-ness,
            reformat package() function, create there a workdir
            (otherwise buildbot won't start).
* buildmaster.initd: Put openrc-run in shebang.
                     Add create command, which is a wrapper around
                     `buildbot create-master -r $BASEDIR`.

It has not been truly tested, but at least it starts now if you perform
following command before starting buildmaster:

    /etc/init.d/buildmaster create
---
 testing/buildbot/APKBUILD          | 43 ++++++++++++++++++++++----------------
 testing/buildbot/buildmaster.initd | 17 ++++++++++++++-
 2 files changed, 41 insertions(+), 19 deletions(-)
diff --git a/testing/buildbot/APKBUILD b/testing/buildbot/APKBUILD
index f9d62dd10441..73ac3ddc12c8 100644
--- a/testing/buildbot/APKBUILD
+++ b/testing/buildbot/APKBUILD
_at_@ -13,42 +13,49 @@ depends="python py-twisted
 depends_dev=""
 makedepends="python-dev"
 install="${pkgname}.pre-install"
+BUILDBOT_USER=buildbot
+BUILDBOT_GROUP=buildbot
+pkgusers="$BUILDBOT_USER"
+pkggroups="$BUILDBOT_GROUP"
 subpackages=""
 source="https://pypi.python.org/packages/source/b/buildbot/buildbot-$pkgver.tar.gz
 	buildmaster.initd
 	buildmaster.confd"
 
-_builddir="$srcdir"/buildbot-$pkgver
+builddir="$srcdir"/$pkgname-$pkgver
+
 prepare() {
-	local i
-	cd "$_builddir"
-	for i in $source; do
-		case $i in
-		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
-		esac
-	done
+	default_prepare || return 1
 }
 
 build() {
-	cd "$_builddir"
+	cd "$builddir"
 	python setup.py build || return 1
 }
 
 package() {
-	cd "$_builddir"
-	python setup.py install --prefix=/usr --root="$pkgdir" || return 1
-        install -m755 -D "$srcdir"/buildmaster.initd \
-		"$pkgdir"/etc/init.d/buildmaster || return 1
-	install -m644 -D "$srcdir"/buildmaster.confd \
-		"$pkgdir"/etc/conf.d/buildmaster || return 1
+	cd "$builddir"
+	python setup.py install --prefix=/usr --root="$pkgdir" \
+		|| return 1
+	install -D -m 755 \
+	        "$srcdir"/buildmaster.initd \
+	        "$pkgdir"/etc/init.d/buildmaster \
+		|| return 1
+	install -D -m 644 \
+	        "$srcdir"/buildmaster.confd \
+	        "$pkgdir"/etc/conf.d/buildmaster \
+		|| return 1
+	install -d -o $BUILDBOT_USER -g $BUILDBOT_GROUP \
+	        "$pkgdir"/var/lib/buildmaster \
+		|| return 1
 }
 
 md5sums="b4c723d1e0324ea19511e622e420c6e7  buildbot-0.8.9.tar.gz
-8e175460da21111cb05c7c85fd8a0740  buildmaster.initd
+b8a4cd31065d2fcd305e76c9e4bd2103  buildmaster.initd
 b3cd43ecb53b66433e0384ad922ffde1  buildmaster.confd"
 sha256sums="6b9e465e6d4825fe1f09d28505318fdb1a75b283c80a140af0f2e2a5039cfa8a  buildbot-0.8.9.tar.gz
-ac3b4aeb9fc1447a53150f66d58baf3258d607577e7d34241ec1a86ff19c436e  buildmaster.initd
+ddc5b7c504702da9e7452d04070a65afb8f0ff9082b3f62e8dfcebc8c2e5256e  buildmaster.initd
 bb7f93e3867b32a25e2445a66d40573fa5073a80e73e35ae2a904db715f870c6  buildmaster.confd"
 sha512sums="5788b268689d8594592c2c5dc8c2d0178aca64c1816c7faa0181b446f8b657a4781dbb9a9d4ea0965ccfcd217dc485973fda01bf9d7cac638328dfef01959484  buildbot-0.8.9.tar.gz
-19d7c094b55c1444530b55694bbc64d5f49270df0b7a7103b67e498aa97666580fb263a488f8572d66eb83119ad3c9b1d28942d83faa874a70e032e1a50a1547  buildmaster.initd
+2e65d22f1b94433ba11839fb3434d072f9ff8132396b03fdcdb3b437778679d1699534296fbb851d2661a3a7a0bce4ef1f94c49e7910419557e4055f2ed1a4d5  buildmaster.initd
 d9339c30d3a92e92b41b0e3139ec89ecbd1460b0e4ee6c6fe2560c4307b2eb3f29b838c2f2312b9c7049bd95eaf652d09039227c691af805bc25a36999ec1840  buildmaster.confd"
diff --git a/testing/buildbot/buildmaster.initd b/testing/buildbot/buildmaster.initd
index 313365f3a676..05c1a10104e8 100644
--- a/testing/buildbot/buildmaster.initd
+++ b/testing/buildbot/buildmaster.initd
_at_@ -1,8 +1,9 @@
-#!/sbin/runscript
+#!/sbin/openrc-run
 # Copyright 1999-2013 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 extra_started_commands="reload"
+extra_stopped_commands="create"
 
 depend() {
 	need net
_at_@ -52,3 +53,17 @@ reload() {
 		"${BASEDIR}"/buildmaster.pid
 	eend $?
 }
+
+create() {
+	if [ -e "${BASEDIR}"/buildbot.tac -o -e "${BASEDIR}"/master.cfg ]; then
+		eerror "${BASEDIR} already contains buildbot.tac or master.cfg"
+		return 1
+	fi
+	ebegin "Creating buildmaster in ${BASEDIR}"
+	start-stop-daemon -u "${USERNAME}" \
+		--exec /usr/bin/buildbot \
+		-- create-master -r "${BASEDIR}"
+	mv "${BASEDIR}"/master.cfg.sample "${BASEDIR}"/master.cfg
+	ewarn "Remember to customize exemplary master.cfg in ${BASEDIR}"
+	eend $?
+}
-- 
2.6.6
---
Unsubscribe:  alpine-aports+unsubscribe_at_lists.alpinelinux.org
Help:         alpine-aports+help_at_lists.alpinelinux.org
---
Received on Fri Jun 17 2016 - 03:47:31 GMT