diff options
author | Diego Elio Pettenò <flameeyes@gentoo.org> | 2010-03-18 13:04:24 +0000 |
---|---|---|
committer | Diego Elio Pettenò <flameeyes@gentoo.org> | 2010-03-18 13:04:24 +0000 |
commit | f98cfd779c4468f6e4f4dd7dab2386fe854d913a (patch) | |
tree | 59c7b8fc3a146006fecab7a23417a8ee36258362 /dev-db | |
parent | Add doc USE flag, fix html documentation installation (path moved), install m... (diff) | |
download | gentoo-2-f98cfd779c4468f6e4f4dd7dab2386fe854d913a.tar.gz gentoo-2-f98cfd779c4468f6e4f4dd7dab2386fe854d913a.tar.bz2 gentoo-2-f98cfd779c4468f6e4f4dd7dab2386fe854d913a.zip |
Version bump from Pavel, this time with an init script that can start drizzled.
(Portage version: 2.2_rc67/cvs/Linux x86_64)
Diffstat (limited to 'dev-db')
-rw-r--r-- | dev-db/drizzle/ChangeLog | 10 | ||||
-rw-r--r-- | dev-db/drizzle/drizzle-2010.03.1317.ebuild | 153 | ||||
-rw-r--r-- | dev-db/drizzle/files/drizzle.conf.d | 1 | ||||
-rw-r--r-- | dev-db/drizzle/files/drizzle.init.d | 163 |
4 files changed, 326 insertions, 1 deletions
diff --git a/dev-db/drizzle/ChangeLog b/dev-db/drizzle/ChangeLog index bfe9b6e3d6f3..bebed0007195 100644 --- a/dev-db/drizzle/ChangeLog +++ b/dev-db/drizzle/ChangeLog @@ -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, diff --git a/dev-db/drizzle/drizzle-2010.03.1317.ebuild b/dev-db/drizzle/drizzle-2010.03.1317.ebuild new file mode 100644 index 000000000000..30fff3caafef --- /dev/null +++ b/dev-db/drizzle/drizzle-2010.03.1317.ebuild @@ -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 index 000000000000..c8a797897a56 --- /dev/null +++ b/dev-db/drizzle/files/drizzle.conf.d @@ -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 index 000000000000..7b004dcd76c5 --- /dev/null +++ b/dev-db/drizzle/files/drizzle.init.d @@ -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 +} + |