Commit 31b3b3af authored by Natanael Copa's avatar Natanael Copa
Browse files

main/libvirt: refactor subpackages

- be more specific on what tools are needed by daemon/client packages
- introduce py-libvirt subpackage for python modules
- introduce libvirt-common-drivers subpackage for network drivers etc
- move api files to -dev subpackage
- move client libraries to client subpackage
- move driver specific configs to driver subpackages
parent 7196b789
......@@ -2,20 +2,24 @@
pkgname=libvirt
pkgver=1.1.0
_ver="${pkgver/_rc/-rc}"
pkgrel=0
pkgrel=1
pkgdesc="A virtualization API for several hypervisor and container systems"
url="http://libvirt.org/"
arch="all"
license="LGPL"
depends="bridge-utils dmidecode iptables netcat-openbsd pm-utils python"
makedepends="augeas-dev bridge-utils cyrus-sasl-dev device-mapper
e2fsprogs-dev gnutls-dev libcap-ng-dev libgpg-error-dev
netcf-dev libnl-dev libxml2-dev libxslt-dev libtasn1-dev
lvm2-dev lxc-dev gnutls-dev libgcrypt-dev parted-dev perl pkgconfig
udev-dev zlib-dev yajl-dev libpcap-dev curl-dev libpciaccess-dev"
_daemon_deps="bridge-utils dmidecode iptables"
_client_deps="pm-utils gnutls-utils netcat-openbsd"
depends=""
makedepends="augeas-dev bridge-utils cyrus-sasl-dev device-mapper
e2fsprogs-dev gnutls-dev libcap-ng-dev libgpg-error-dev
netcf-dev libnl-dev libxml2-dev libxslt-dev libtasn1-dev
lvm2-dev lxc-dev gnutls-dev libgcrypt-dev parted-dev perl pkgconfig
udev-dev zlib-dev yajl-dev libpcap-dev curl-dev libpciaccess-dev
$_daemon_deps $_client_deps
"
install="$pkgname.post-install"
subpackages="$pkgname-client $pkgname-daemon $pkgname-dev $pkgname-doc
$pkgname-lang
subpackages="$pkgname-dev $pkgname-doc $pkgname-client $pkgname-daemon
$pkgname-lang py-$pkgname:_py
$pkgname-lxc $pkgname-qemu $pkgname-uml $pkgname-vbox"
source="http://libvirt.org/sources/$pkgname-$pkgver.tar.gz
libvirt.confd
......@@ -27,6 +31,7 @@ if [ "$ALPINE_LIBC" != "eglibc" ]; then
subpackages="$subpackages $pkgname-xen"
makedepends="$makedepends xen-dev"
fi
subpackages="$subpackages $pkgname-common-drivers:_common_drivers"
_builddir="$srcdir"/$pkgname-$pkgver
......@@ -71,38 +76,52 @@ package() {
install -D -m755 $srcdir/$pkgname.confd $pkgdir/etc/conf.d/libvirtd
}
dev() {
default_dev
mkdir -p "$subpkgdir"/usr/share/libvirt
mv "$pkgdir"/usr/share/libvirt/api \
"$subpkgdir"/usr/share/libvirt/
}
daemon() {
cd "$_builddir"
pkgdesc="libvirt daemon package"
depends="libvirt-client"
daemon="libvirtd"
depends="libvirt-client $_daemon_deps"
replaces="libvirt"
mkdir -p "$subpkgdir"/etc/$pkgname \
"$subpkgdir"/etc/logrotate.d \
"$subpkgdir"/usr/sbin
# mkdir -p "$subpkgdir"/usr/sbin
mv "$pkgdir"/etc/init.d "$subpkgdir"/etc
mv "$pkgdir"/etc/conf.d "$subpkgdir"/etc
mv "$pkgdir"/etc/$pkgname/$daemon.conf "$subpkgdir"/etc/libvirt/
mv "$pkgdir"/usr/sbin/$daemon "$subpkgdir"/usr/sbin/
mv "$pkgdir"/etc/$pkgname/libvirtd.conf "$subpkgdir"/etc/libvirt/
mv "$pkgdir"/usr/sbin/libvirtd "$subpkgdir"/usr/sbin/
mv "$pkgdir"/etc/logrotate.d/libvirtd "$subpkgdir"/etc/logrotate.d/
}
client() {
cd "$_builddir"
pkgdesc="libvirt client package"
depends="libvirt"
depends="libvirt $_client_deps"
replaces="libvirt"
mkdir -p "$subpkgdir"/etc/$pkgname "$subpkgdir"/usr/bin
# mkdir -p "$subpkgdir"/usr/bin
mkdir -p "$subpkgdir"/etc/$pkgname "$subpkgdir"/usr/bin \
"$subpkgdir"/usr/lib
mv "$pkgdir"/etc/$pkgname/$pkgname.conf "$subpkgdir"/etc/libvirt/
mv "$pkgdir"/usr/bin/* "$subpkgdir"/usr/bin/
mv "$pkgdir"/usr/lib/lib*.so.* "$subpkgdir"/usr/lib/ || return 1
}
_py() {
pkgdesc="Python bindings to libvirt"
replaces="libvirt"
mkdir -p "$subpkgdir"/usr/lib
mv "$pkgdir"/usr/lib/python* "$subpkgdir"/usr/lib/
}
_mv_driver() {
local _name="$1" _drivers="$2" _pkg="$3"
pkgdesc="$_name driver for libvirt"
depends="libvirt-daemon"
depends="$pkgname-daemon=$pkgver-r$pkgrel
$pkgname-common-drivers=$pkgver-r$pkgrel"
replaces="libvirt"
if [ -n "$_pkg" ]; then
install_if="$pkgname-daemon=$pkgver-r$pkgrel $_pkg"
......@@ -114,36 +133,30 @@ _mv_driver() {
"$subpkgdir"/etc/libvirt \
"$subpkgdir"/etc/logrotate.d
local _d
cd "$pkgdir"
for _d in $_drivers; do
mv "$pkgdir"/$_dir/libvirt_driver_$_d.so \
"$subpkgdir"/$_dir/ || return 1
find * -name "*$_d[.-]*" -o -name "*$_d" | while read _f; do
mkdir -p "$subpkgdir"/${_f%/*}
mv "$pkgdir"/$_f "$subpkgdir"/$_f || return 1
done
done
if [ -e "$pkgdir"/etc/logrotate.d/libvirtd.$_driver ]; then
mv "$pkgdir"/etc/logrotate.d/libvirtd.$_driver \
"$subpkgdir"/etc/logrotate.d/
fi
}
qemu() {
_mv_driver "QEMU" qemu qemu
mv "$pkgdir"/etc/libvirt/qemu.conf "$subpkgdir"/etc/libvirt/
}
xen() {
_mv_driver "XEN" "libxl xen" xen
}
lxc() {
_mv_driver "LXC" lxc lxc
}
uml() {
_mv_driver "UML" uml
}
qemu() { _mv_driver "QEMU" qemu qemu; }
xen() { _mv_driver "XEN" "libxl xen" xen; }
lxc() { _mv_driver "LXC" lxc lxc; }
uml() { _mv_driver "UML" uml; }
vbox() { _mv_driver "VirtualBox" vbox; }
vbox() {
_mv_driver "VirtualBox" vbox
_common_drivers() {
pkgdesc="Common libvirt daemon drivers"
replaces="libvirt"
mkdir -p "$subpkgdir"/usr/lib/libvirt \
"$subpkgdir"/etc/libvirt/nwfilter
mv "$pkgdir"/usr/lib/libvirt/connection-driver \
"$subpkgdir"/usr/lib/libvirt/
mv "$pkgdir"/etc/libvirt/nwfilter \
"$subpkgdir"/etc/libvirt/
}
md5sums="f980a84719033e9efca01048da505dfb libvirt-1.1.0.tar.gz
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment