Version bump from Pavel, this time with an init script that can start drizzled.
authorDiego Elio Pettenò <flameeyes@gentoo.org>
Thu, 18 Mar 2010 13:04:24 +0000 (13:04 +0000)
committerDiego Elio Pettenò <flameeyes@gentoo.org>
Thu, 18 Mar 2010 13:04:24 +0000 (13:04 +0000)
Package-Manager: portage-2.2_rc67/cvs/Linux x86_64

dev-db/drizzle/ChangeLog
dev-db/drizzle/Manifest
dev-db/drizzle/drizzle-2010.03.1317.ebuild [new file with mode: 0644]
dev-db/drizzle/files/drizzle.conf.d [new file with mode: 0644]
dev-db/drizzle/files/drizzle.init.d [new file with mode: 0644]

index bfe9b6e3d6f3b41cad26c144660de211ea95ac1f..bebed0007195f66da3939790be4fb4db15d5c075 100644 (file)
@@ -1,6 +1,14 @@
 # ChangeLog for dev-db/drizzle
 # Copyright 1999-2010 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/dev-db/drizzle/ChangeLog,v 1.4 2010/02/19 14:25:48 flameeyes Exp $
+# $Header: /var/cvsroot/gentoo-x86/dev-db/drizzle/ChangeLog,v 1.5 2010/03/18 13:04:23 flameeyes Exp $
+
+*drizzle-2010.03.1317 (18 Mar 2010)
+
+  18 Mar 2010; Diego E. Pettenò <flameeyes@gentoo.org>
+  +drizzle-2010.03.1317.ebuild, +files/drizzle.conf.d,
+  +files/drizzle.init.d:
+  Version bump from Pavel, this time with an init script that can start
+  drizzled.
 
   19 Feb 2010; Diego E. Pettenò <flameeyes@gentoo.org>
   -files/drizzle-2009.12.1240-asneeded.patch, -drizzle-2009.12.1251.ebuild,
index 66cd15bb64a4273519f1d75c707f9223439a9ad3..7c5cbfe35e2ebab50f7d42f2d2858937d8bbabac 100644 (file)
@@ -2,14 +2,18 @@
 Hash: SHA1
 
 AUX drizzle-2009.12.1240-nolint.patch 366 RMD160 5edac5d0f35b6a7830ba4c5d4cc9fa78f30c29bc SHA1 29f2257773552dabc40424ac068ca4ef32425d01 SHA256 612ffed94aebcce0aeef56a4fabfe35a5bb01f6c85a4c00757bef59f0cd75312
+AUX drizzle.conf.d 17 RMD160 04ac72be16bab0e6a590a19d2d663baa6741e743 SHA1 0337f18c03bbfbf1203a6391f8d7076a4d36a155 SHA256 5739bf0120eb4ef9dfed0b5307332d10c728ab9d204411d37fec85393e6db630
+AUX drizzle.init.d 4247 RMD160 6208fe8ad2a1fc3480f835d101799412b73ef208 SHA1 b0a288670de9a37f54f75b773aadbd56d737af64 SHA256 9b33960f1a203265f13bdd4c1a444cfa9c96e06529b45432d3e8e820a6e4d266
 DIST drizzle-2010.01.1273.tar.gz 7407764 RMD160 ca4cdba20265f8b42f4a3b79a29c6bb18256dee4 SHA1 6f5211cbfb7e1365e40ff200edef190100de3e4c SHA256 96f6426d66cbcde422d9eab3b985f75fe461b071baf05bd161a41ba51b7be8fa
+DIST drizzle-2010.03.1317.tar.gz 7161657 RMD160 08b655751925192f6d61faa55cc568e9bd2fc49b SHA1 50c334d7c664844f2b66ecf929ed9bf0298fa351 SHA256 7faeff4bb473a880a268e04e6e25ea05d93c68f632aed6a0b6e99af80b12659a
 EBUILD drizzle-2010.01.1273.ebuild 3054 RMD160 a849567f02972f19c817fdcfbdba114948800e55 SHA1 89b0831352a3112fa03cb6c319ff835291597d1e SHA256 872b789bd9d238a1c1ab0c701823021811b6e4f66b41a1c38a228dfc2c585035
-MISC ChangeLog 1209 RMD160 0a0e8b944ee7d25b388bead6ed5b1fb3153077ea SHA1 dab3a62142c7154f3dbb994f5f229fbdad74544e SHA256 e87c368e132d6571e7e6681da10e42642eb4f98646792839004405b8c102f491
+EBUILD drizzle-2010.03.1317.ebuild 3778 RMD160 31d67171db9e70ef58b6939e26bf075e6c72f6aa SHA1 01bfdc99a945dd2c2417c3343ecfa3c604793682 SHA256 8b766fd393cd7891c21a7b0a6948e587237f2d520238a5ee5fc1bd99908a9c8a
+MISC ChangeLog 1467 RMD160 2918d0faec7389e1f70faa3ca37f7ff9516d1320 SHA1 05b7c5f00c09e3169bf6ec3952a45b3209ba9a44 SHA256 2e49268b5836ddfe04c3cffeb878ee6bc79a40e1cff73d8dea661212a5c65d86
 MISC metadata.xml 2263 RMD160 160a507de863707c2d258cb29b787437b8787398 SHA1 62839e65f03b5261e2df6acbee1fce6240a3e1ed SHA256 ec06196287c8cf1b2369fb687435fdf3e5e392e9778b71366c4e44148289d4d6
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.14 (GNU/Linux)
 
-iEYEARECAAYFAkt+nyAACgkQAiZjviIA2XgYwACg8jCdt+lg3ii2vGa6ghnXaDrY
-PqwAoMwVcXaPmOtdWctJTMxXYxQhMN8n
-=gUJU
+iEYEARECAAYFAkuiJMYACgkQAiZjviIA2Xir+gCg1SYD40w84OdSuR+PU2271TBE
+mWkAn1U/n4HCbr/DICu68r/kCwj8WM8e
+=fMJj
 -----END PGP SIGNATURE-----
diff --git a/dev-db/drizzle/drizzle-2010.03.1317.ebuild b/dev-db/drizzle/drizzle-2010.03.1317.ebuild
new file mode 100644 (file)
index 0000000..30fff3c
--- /dev/null
@@ -0,0 +1,153 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $
+
+EAPI=2
+
+inherit flag-o-matic libtool autotools eutils
+
+DESCRIPTION="Database optimized for Cloud and Net applications"
+HOMEPAGE="http://drizzle.org"
+SRC_URI="http://launchpad.net/drizzle/cherry/2010-03-01/+download/${P}.tar.gz"
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64"
+
+# don't add an ssl USE flag here, since it's not ssl support that
+# we're to use, but rather MD5 support
+IUSE="debug tcmalloc doc memcache curl pam gearman gnutls openssl"
+
+# upstream bug #499911
+RESTRICT="memcache? ( test ) !curl? ( test )"
+
+RDEPEND="tcmalloc? ( dev-util/google-perftools )
+               dev-db/libdrizzle
+               sys-libs/readline
+               sys-apps/util-linux
+               dev-libs/libpcre
+               dev-libs/libevent
+               dev-libs/protobuf
+               gearman? ( sys-cluster/gearmand )
+               pam? ( sys-libs/pam )
+               curl? ( net-misc/curl )
+               gnutls? ( net-libs/gnutls )
+               memcache? ( dev-libs/libmemcached )"
+DEPEND="${RDEPEND}
+               dev-util/gperf
+               doc? ( app-doc/doxygen )"
+RDEPEND="${RDEPEND}
+               curl? (
+                       gnutls? ( net-misc/curl[-openssl,-nss] )
+                       openssl? ( net-misc/curl[-gnutls,-nss] )
+               )"
+
+pkg_setup() {
+       elog "This is a work-in-progress ebuild, some features will require"
+       elog "manual configuration and others aren't fleshed out just yet."
+       elog "Use it at your risk."
+
+       if use gnutls && use openssl; then
+               eerror "You cannot use both GnuTLS and OpenSSL at the same time"
+               eerror "to provide the MD5 plugin. Please choose only one USE flag"
+               eerror "between gnutls and openssl."
+               die "Both gnutls and openssl USE flags enabled."
+       fi
+
+       enewuser drizzle -1 -1 /dev/null nogroup
+}
+
+src_prepare() {
+       epatch "${FILESDIR}/${PN}-2009.12.1240-nolint.patch"
+       AT_M4DIR="m4" eautoreconf
+       elibtoolize
+}
+
+src_configure() {
+       local myconf=
+
+       if use debug; then
+               append-flags -DDEBUG
+       fi
+
+       if use gnutls; then
+               myconf="${myconf} --with-md5-plugin"
+               export ac_cv_libcrypto=no
+       elif use openssl; then
+               myconf="${myconf} --with-md5-plugin"
+               export ac_cv_libgnutls_openssl=no
+       else
+               myconf="${myconf} --without-md5-plugin"
+       fi
+
+       econf \
+               --disable-static \
+               --disable-dependency-tracking \
+               --disable-mtmalloc \
+               $(use_enable tcmalloc) \
+               $(use_enable memcache libmemcached) \
+               $(use_enable gearman libgearman) \
+               $(use_with curl auth-http-plugin) \
+               $(use_with pam auth-pam-plugin) \
+               --without-hello-world-plugin \
+               ${myconf}
+}
+
+src_compile() {
+       emake || die "build failed"
+
+       if use doc; then
+               emake doxygen || die "doxygen failed"
+       fi
+}
+
+src_test() {
+       # Explicitly allow parallel make check
+       emake check || die "tests failed"
+}
+
+src_install() {
+       emake DESTDIR="${D}" install || die "install failed"
+       dodoc AUTHORS NEWS README || die
+
+       find "${D}" -name '*.la' -delete || die
+
+       if use doc; then
+               docinto apidoc
+               pushd docs/html
+               dohtml -r .
+               popd
+       fi
+
+       newinitd "${FILESDIR}"/drizzle.init.d drizzled || die
+       newconfd "${FILESDIR}"/drizzle.conf.d drizzled || die
+
+       if ! use gearman; then
+               sed -i -e '/need gearmand/d' "${D}"/etc/init.d/drizzled \
+                       || die "unable to sed init script (gearman)"
+       fi
+
+       if ! use memcache; then
+               sed -i -e '/need memcached/d' "${D}"/etc/init.d/drizzled \
+                       || die "unable to sed init script (memcache)"
+       fi
+
+       keepdir /var/run/drizzle || die
+       keepdir /var/log/drizzle || die
+       keepdir /var/lib/drizzle/drizzled || die
+       keepdir /etc/drizzle || die
+
+       fperms 0755 /var/run/drizzle || die
+       fperms 0755 /var/log/drizzle || die
+       fperms -R 0700 /var/lib/drizzle || die
+
+       fowners drizzle:nogroup /var/run/drizzle || die
+       fowners drizzle:nogroup /var/log/drizzle || die
+       fowners -R drizzle:nogroup /var/lib/drizzle || die
+}
+
+pkg_postinst() {
+       if use pam; then
+               ewarn "Be warned that we're still lacking a pam configuration"
+               ewarn "file so the PAM authentication will not work by default"
+       fi
+}
diff --git a/dev-db/drizzle/files/drizzle.conf.d b/dev-db/drizzle/files/drizzle.conf.d
new file mode 100644 (file)
index 0000000..c8a7978
--- /dev/null
@@ -0,0 +1 @@
+DRIZZLE_EXTRA=""
diff --git a/dev-db/drizzle/files/drizzle.init.d b/dev-db/drizzle/files/drizzle.init.d
new file mode 100644 (file)
index 0000000..7b004dc
--- /dev/null
@@ -0,0 +1,163 @@
+#!/sbin/runscript
+# Copyright 2010 Pavel Stratil, senbonzakura.eu
+# Some functions were taken from debian init script. Licensed under GPL-2
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/dev-db/drizzle/files/drizzle.init.d,v 1.1 2010/03/18 13:04:24 flameeyes Exp $
+
+
+#########################
+### Construct vars ######
+#########################
+
+
+SUFIX=".${SVCNAME#*.}"
+[ "${SUFIX}" == ".drizzle" ] && SUFIX=''
+
+BASE_CONFD="/etc/conf.d/drizzle"
+BASE_CNF="/etc/drizzle/drizzled"
+BASE_PID="/var/run/drizzle/drizzled"
+BASE_LOG="/var/log/drizzle/drizzled"
+BASE_DIR="/var/lib/drizzle/drizzled"
+
+PIDFILE="${BASE_PID}${SUFIX}.pid"
+CNFFILE="${BASE_CNF}${SUFIX}.cnf"
+LOGFILE="${BASE_LOG}${SUFIX}.log"
+DATADIR="${BASE_DIR}${SUFIX}"
+CONFSRC="${BASE_CONFD}${SUFIX}"
+DRIZZLE="/usr/bin/drizzle"
+DRIZZLE_USER="drizzle"
+DRIZZLE_DAEMON="/usr/sbin/drizzled"
+DRIZZLE_EXTRA=""
+
+#########################
+### Helper functions ####
+#########################
+
+
+#
+# drizzle_get_param() fetches a particular option from drizzle's invocation.
+# Usage: void drizzle_get_param option
+# Example: /etc/init.d/drizzle drizzle_get_param pid-file
+# 
+drizzle_get_param() {
+       ${DRIZZLE_DAEMON} --print-defaults \
+               | tr " " "\n" \
+               | grep -- "--$1" \
+               | tail -n 1 \
+               | cut -d= -f2
+}
+
+
+#
+# drizzle_status() checks if there is a server running and if it is accessible.
+# "check_alive" insists on a pingable server, "check_dead" also fails
+# if there is a lost drizzled in the process list
+# Usage: boolean drizzle_status [check_alive|check_dead] [warn|nowarn]
+#
+drizzle_status() {
+    ping_output=`$DRIZZLE --ping 2>&1`; ping_alive=$(( ! $? ))
+    ps_alive=0
+    if [ -f "$PIDFILE" ] && ps `cat $PIDFILE` >/dev/null 2>&1; then ps_alive=1; fi
+
+    if [ "$1" = "check_alive"  -a  $ping_alive = 1 ] ||
+       [ "$1" = "check_dead"   -a  $ping_alive = 0  -a  $ps_alive = 0 ]; then
+       return 0 # EXIT_SUCCESS
+    else
+       if [ "$2" = "warn" ]; then
+           echo -e "$ps_alive processes alive and '$DRIZZLE --ping' resulted in\n$ping_output\n"
+       fi
+       return 1 # EXIT_FAILURE
+    fi
+}
+
+#########################
+### Main ################
+#########################
+
+checkconfig() {
+       CNFDATADIR=`drizzle_get_param datadir`
+        if [ -z "${CNFDATADIR}" ] ; then
+          ewarn "Datadir not set in ${CNFFILE}."
+          ewarn "Trying to use ${DATADIR}"
+       else
+          DATADIR="${CNFDATADIR}"
+       fi
+
+       if [[ ! -d "${DATADIR}" ]] ; then
+               eerror "Drizzle datadir is empty or invalid."
+               eerror "Please check your configuration ${CNFFILE} and DRIZZLE_EXTRA"
+               return 1
+       fi
+
+        if [ -f "${CONFSRC}" ]; then
+         source "${CONFSRC}"
+        else
+         eerror "The configuration file $CONFSRC was not found!"
+        fi
+
+        if [ ! -f "${CNFFILE}" ]; then
+         eerror "The configuration file $CNFFILE was not found!"
+        fi
+
+
+}
+
+depend() {
+       use localmount
+        need gearmand
+        need memcached
+        
+        # TODO use drizzle_get_param() to decide if gearmand and memcached
+        #      are needed. Then the useflag based sed-ing of this script
+        #      can be removed from the ebuild.
+}
+
+
+stop() {
+       ebegin "Stopping ${SVCNAME}"
+       start-stop-daemon --pidfile ${PIDFILE} --stop \
+               --exec ${DRIZZLE_DAEMON}
+       eend $?
+       drizzle_status check_dead warn
+       
+}
+
+
+start() {
+       checkconfig
+       ebegin "Starting ${SVCNAME}"
+        start-stop-daemon --background --pidfile ${PIDFILE} --stderr ${LOGFILE} \
+        --user ${DRIZZLE_USER} --start --exec ${DRIZZLE_DAEMON} -- \
+        --datadir=${DATADIR} --pid-file=${PIDFILE} --user=${DRIZZLE_USER} \
+        ${DRIZZLE_EXTRA} 
+       eend $?
+       
+        # TODO in order to have replication always working we should add the
+        #      --server-id=# option. AFAIK only integers are allowed, though
+        #      ${HOSTNAME}${SVCNAME}${SUFIX} whould be much easier to handle.
+
+       for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14; do
+         sleep 1
+         if drizzle_status check_alive nowarn ; then break ; fi
+       done
+       if drizzle_status check_alive warn ; then
+           einfo "${SVCNAME} is alive!"
+       else 
+           eerror "${SVCNAME} died!"
+       fi
+}
+
+restart() {
+       stop
+       sleep 1
+       start
+}
+
+status() {
+    if drizzle_status check_alive nowarn; then
+      einfo "status: started"
+    else
+      einfo "status: stopped"
+    fi
+}
+