Skip to content

Commit

Permalink
initial crack at git-based ebuild. Still needs a lot of work
Browse files Browse the repository at this point in the history
  • Loading branch information
ramereth committed Apr 22, 2011
1 parent 18aa6c3 commit 609085a
Show file tree
Hide file tree
Showing 5 changed files with 188 additions and 5 deletions.
9 changes: 4 additions & 5 deletions app-emulation/ganeti/Manifest
@@ -1,7 +1,6 @@
AUX ganeti-2.1.initd 2014 RMD160 44996bf7d50b8ac70df572daafa5f5d04be021a8 SHA1 ceda61da3b3099292f4cd5ab41b5e02f2666dc6b SHA256 37fd18b914846e5fb8d984db7162b230ac3488ec530aaddda7b63bd72cc70117
AUX ganeti-2.2-kvm-over-http.patch 3149 RMD160 73a65ba711822e86d800667535559649b565d980 SHA1 a4cfa54d4c60c9819c7ec156137f727e9e22eace SHA256 9ee54a8ba2bcbc2843936d2acbf24b13f169324c3e8cdbe43610da7e3d05dcc1
AUX ganeti-2.2-random-vnc-password.patch 7222 RMD160 40039c8d3041bcf19ad9edbc358a77256d8cc205 SHA1 4448f4e876aec4b21b5bb9a96adc75eb72f95dbe SHA256 0d4e61a3ee3bff6b06dd87f26055ca0c8bc588fca9563be6173642d69d0437e0
AUX ganeti-kvm-poweroff.confd 186 RMD160 87242c3c785e012b2ec7534836dabd8017a25893 SHA1 955bdc02481591c06d8e00f1b6e04c55830e1150 SHA256 d811f1825351b03653aed4b6827b2b0c9dd1dc3340c980862c0758b3bf5ad21e
AUX ganeti-kvm-poweroff.initd 1621 RMD160 2d8d59ac9bf25ff6efa74a3277f4d295c05d4282 SHA1 7e3cbfb9f6ed988393522af6569a96c66cb4feb0 SHA256 bb7b6ab5ac2899969bab52d9c5e1c5d9fd9629d247563ff74e8b9f64a4478e28
AUX ganeti.confd 248 RMD160 18662964365f102e77f593429bb0772d94c65267 SHA1 337999b3fbeb64518f3d39c41634e3f414aedb25 SHA256 7efc3a5052ad5c2085605a8c0bf9e9bb9cf20c0623263b7abcd0b7a0cb9a895b
DIST ganeti-2.2.0~rc1.tar.gz 1531181 RMD160 b1fa31f6ca2cfac2fb9c4449ef1840fae826faad SHA1 24565affabacf5fa245c63666339603fe704c60c SHA256 8cf9640668d70f04da42b6078df7655f08ee6d1a6983d59813d5f26b1e3103af
EBUILD ganeti-2.2.0_rc1.ebuild 2253 RMD160 5d31ab9437b91c8df16322b7c7ab2058ad3d4a77 SHA1 77910cfe1147cb02e5767b8d5fd5f17c396259bb SHA256 d14474e4fcb6755cfe28f18ac986810b5b5259950cc36fe47ceba6bc615f8acb
MISC metadata.xml 1241 RMD160 efeb38484aca2c00aed39b5baaa0a6b3be8aa3fd SHA1 572c2325f73be081e85a7b6dd8356e778b92ae8c SHA256 d3c4195c8a273087826535dbf371bd7c7c5f129a8fc5bb247fa52bbc39fd570c
EBUILD ganeti-9999.ebuild 3033 RMD160 5aa1eb441939ccb269c568d2cc224cfc15a08a76 SHA1 17855550e894bcd5c8e8fb4d3121122692de9789 SHA256 3471f196ab2222748069e2a90dcfdc23a86a0bd048052e1da126900ae24a87bb
MISC metadata.xml 1358 RMD160 de8bee91dc78ae852b91c222c33dbd99a39a2aea SHA1 0deb8c56fbc86e544ed75208628f35b8b01ff84b SHA256 618c02b7f5deeb9c1d15c261eaffcf62d295fe5d192731045f007fa7b65fcc36
4 changes: 4 additions & 0 deletions app-emulation/ganeti/files/ganeti-kvm-poweroff.confd
@@ -0,0 +1,4 @@
# /etc/conf.d/ganeti-kvm-poweroff: config file for /etc/init.d/ganeti-kvm-poweroff

# Maximum time in seconds to wait until KVM VMs shutdown before giving up.
# GANETI_KVM_TIMEOUT="60"
58 changes: 58 additions & 0 deletions app-emulation/ganeti/files/ganeti-kvm-poweroff.initd
@@ -0,0 +1,58 @@
#!/sbin/runscript
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/app-emulation/ganeti/files/ganeti-kvm-poweroff.initd,v 1.1 2011/01/22 02:07:43 ramereth Exp $

depend() {
after ganeti
after bootmisc
}

CONTROL_PATH="/var/run/ganeti/kvm-hypervisor/ctrl"
GANETI_KVM_TIMEOUT=${GANETI_KVM_TIMEOUT:-60}

start() {
return 0
}

# Taken from doc/examples/ganeti-kvm-poweroff.initd.in in ganeti package
stop() {
ebegin "Stopping Ganeti KVM VMs"
# shutdown VMs and remove sockets of those not running
for vm_monitor in $(find $CONTROL_PATH -type s -name '*.monitor') ; do
if ! echo system_powerdown | \
socat -U UNIX:$vm_monitor STDIO > /dev/null 2>&1; then
# remove disconnected socket
rm -f $vm_monitor
fi
done

einfo " Waiting for VMs to poweroff"
waiting=true
remaining=$GANETI_KVM_TIMEOUT
while $waiting && [ $remaining -ne 0 ]; do
if [ -z "$(find $CONTROL_PATH -type s -name '*.monitor')" ] ; then
break
fi

echo -n "."
for vm_monitor in $(find $CONTROL_PATH -type s -name '*.monitor') ; do
if ! echo | socat -U UNIX:$vm_monitor STDIO > /dev/null 2>&1; then
rm -rf $vm_monitor
fi
done

sleep 5
let remaining-=5 1
done

if [ -n "$(find $CONTROL_PATH -type s -name '*.monitor')" ] ; then
eerror " Some ganeti VMs did not shutdown"
fi
echo
eend $?
}

restart() {
eerror "restart not supported"
}
120 changes: 120 additions & 0 deletions app-emulation/ganeti/ganeti-9999.ebuild
@@ -0,0 +1,120 @@
# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/app-emulation/ganeti/ganeti-2.4.1.ebuild,v 1.1 2011/03/09 18:20:00 ramereth Exp $

EAPI="3"

inherit eutils confutils bash-completion

if [[ ${PV} == "9999" ]] ; then
EGIT_REPO_URI="git://git.ganeti.org/ganeti.git"
inherit git
KEYWORDS=""
else
SRC_URI="http://ganeti.googlecode.com/files/${MY_P}.tar.gz"
KEYWORDS="~amd64 ~x86"
fi

MY_PV="${PV/_rc/~rc}"
#MY_PV="${PV/_beta/~beta}"
MY_P="${PN}-${MY_PV}"
DESCRIPTION="Ganeti is a virtual server management software tool"
HOMEPAGE="http://code.google.com/p/ganeti/"

LICENSE="GPL-2"
SLOT="0"
IUSE="kvm xen drbd +filestorage sharedstorage htools syslog ipv6"

S="${WORKDIR}/${MY_P}"

DEPEND="xen? ( >=app-emulation/xen-3.0 )
kvm? ( app-emulation/qemu-kvm )
drbd? ( >=sys-cluster/drbd-8.3 )
ipv6? ( net-misc/ndisc6 )
htools? (
dev-lang/ghc
dev-haskell/json
dev-haskell/curl
dev-haskell/network
dev-haskell/parallel )
dev-libs/openssl
dev-python/paramiko
dev-python/pyopenssl
dev-python/pyparsing
dev-python/pycurl
dev-python/pyinotify
dev-python/simplejson
net-analyzer/arping
net-misc/bridge-utils
net-misc/curl[ssl]
net-misc/openssh
net-misc/socat
sys-apps/iproute2
sys-fs/lvm2"
RDEPEND="${DEPEND}
!app-emulation/ganeti-htools"

pkg_setup () {
confutils_require_any kvm xen
}

src_unpack() {
if [[ ${PV} == "9999" ]] ; then
git_src_unpack
else
unpack ${A}
fi
}

src_prepare() {
if [[ ${PV} == "9999" ]] ; then
./autogen.sh
fi
}

src_configure () {
local myconf
if use filestorage ; then
myconf="--with-file-storage-dir=/var/lib/ganeti-storage/file"
else
myconf="--with-file-storage-dir=no"
fi
if use sharedstorage ; then
myconf="--with-shared-file-storage-dir=/var/lib/ganeti-storage/shared"
else
myconf="--with-shared-file-storage-dir=no"
fi
econf --localstatedir=/var \
--docdir=/usr/share/doc/${P} \
--with-ssh-initscript=/etc/init.d/sshd \
--with-export-dir=/var/lib/ganeti-storage/export \
--with-os-search-path=/usr/share/ganeti/os \
$(use_enable syslog) \
$(use_enable htools) \
$(use_enable htools htools-rapi) \
${myconf}
}

src_install () {
emake DESTDIR="${D}" install || die "emake install failed"
newinitd "${FILESDIR}"/ganeti-2.1.initd ganeti
newconfd "${FILESDIR}"/ganeti.confd ganeti
use kvm && newinitd "${FILESDIR}"/ganeti-kvm-poweroff.initd ganeti-kvm-poweroff
use kvm && newconfd "${FILESDIR}"/ganeti-kvm-poweroff.confd ganeti-kvm-poweroff
dobashcompletion doc/examples/bash_completion ganeti
dodoc INSTALL UPGRADE NEWS README doc/*.rst
rm -rf "${D}"/usr/share/doc/ganeti
docinto examples
#dodoc doc/examples/{basic-oob,ganeti.cron,gnt-config-backup}
dodoc doc/examples/{ganeti.cron,gnt-config-backup}
docinto examples/hooks
dodoc doc/examples/hooks/{ipsec,ethers}

keepdir /var/{lib,log,run}/ganeti/
keepdir /usr/share/ganeti/os/
keepdir /var/lib/ganeti-storage/{export,file}/
}

pkg_postinst () {
bash-completion_pkg_postinst
}
2 changes: 2 additions & 0 deletions app-emulation/ganeti/metadata.xml
Expand Up @@ -25,6 +25,8 @@
<flag name='xen'>Enable Xen support</flag>
<flag name='drbd'>Enable DRBD support</flag>
<flag name='filestorage'>Enable File Storage</flag>
<flag name='sharedstorage'>Enable Shared Storage support</flag>
<flag name='htools'>Enable htools support</flag>
</use>
</pkgmetadata>

0 comments on commit 609085a

Please sign in to comment.