desktop/ceph/PKGBUILD
2018-02-10 17:18:24 +01:00

155 lines
5.2 KiB
Bash

# Contributions from ArchLinux: https://git.archlinux.org/svntogit/packages.git/tree/trunk?h=packages/ceph
pkgname=ceph
pkgver=12.2.1
pkgrel=1
pkgdesc='Distributed, fault-tolerant storage platform delivering object, block, and file system'
arch=('x86_64')
url='http://ceph.com/'
license=('GPL')
makedepends=('boost' 'xfsprogs' 'python2-sphinx' 'cmake' 'gcc-libs' 'gperf' 'gperftools')
depends=('boost-libs' 'curl' 'expat' 'fcgi' 'fuse2' 'gperftools' 'keyutils' 'leveldb' 'libaio' 'libatomic_ops'
'libedit' 'systemd' 'util-linux' 'ncurses' 'nss' 'python2' 'snappy' 'python2-cython' 'python2-prettytable'
'python2-pyopenssl' 'python2-setuptools' 'yasm' )
checkdepends=('python2-pip')
optdepends=('xfsprogs: support xfs backend' 'python2-sphinx' )
options=('emptydirs')
source=("https://download.ceph.com/tarballs/$pkgname-$pkgver.tar.gz"
'ceph.sysusers'
'fix-ceph_disk-python-interpreter.patch'
'fix-or-disable-broken-tests.patch'
'fix-python2-paths.patch'
'remove-distro-version-detection.patch')
sha256sums=('512666ee88610640d66b261f9307c96ccd70eb25cd3349acd083fb1220c8a32e'
'3540344c11dab89a5f0d1e29286d1e708c8aaa3bb26362d5e3c1bcca0781162a'
'e811012d3a0acd05742288074cb6709377c9240041cd4f7f6988ca280e1529df'
'afb2bb37e0e2e918b14b51021b42ec2b11b46ffbc579e3d5ad4718cc141c0839'
'5f4702ef4b46b269129cb849f93439bc0dc2a26ef046bf6eef9c9369c42addf1'
'a105b5f6b66115d4b105231eb43408bf51a86e78b809d2de3d00820078206531')
prepare() {
cd "${srcdir}/${pkgbase}-${pkgver}"
# apply patch from the source array (should be a pacman feature)
local filename
for filename in "${source[@]}"; do
if [[ "$filename" =~ \.patch$ ]]; then
msg2 "Applying patch ${filename##*/}"
patch -p1 -N -i "$srcdir/${filename##*/}"
fi
done
# remove tests that require root privileges
rm src/test/cli/ceph-authtool/cap*.t
# remove broken tests
rm src/test/cli/crushtool/build.t
rm -rf qa/btrfs
rm src/btrfs_ioc_test.c
# this test will try to perform btrfs operations when a btrfs mount
# is active on the build host, which will fail
if mount | grep 'type btrfs' &>/dev/null; then
sed -i '/run-tox-ceph-disk/d' src/test/CMakeLists.txt
fi
# fix python interpreter -> python2
for file in \
src/ceph-create-keys \
src/ceph-rest-api \
src/mount.fuse.ceph \
src/brag/client/ceph-brag \
src/ceph-detect-init/ceph_detect_init/main.py
do
sed -i 's|#!/usr/bin/env python|#!/usr/bin/env python2|' "${file}"
done
[[ -d build ]] && rm -rfv build
mkdir build
}
build() {
cd "${srcdir}/${pkgbase}-${pkgver}"
cd build
cmake \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_INSTALL_SYSCONFDIR=/etc \
-DCMAKE_INSTALL_SBINDIR=/usr/bin \
-DCMAKE_INSTALL_LIBDIR=/usr/lib \
-DCMAKE_INSTALL_LIBEXECDIR=/usr/lib \
-DWITH_BABELTRACE=OFF \
-DWITH_CEPHFS=ON \
-DWITH_FUSE=ON \
-DWITH_LTTNG=OFF \
-DWITH_LZ4=ON \
-DWITH_MGR=ON \
-DWITH_NSS=ON \
-DPYTHON_INCLUDE_DIR=/usr/include/python2.7 \
-DWITH_RADOSGW=ON \
-DWITH_RADOSGW_BEAST_FRONTEND=OFF \
-DWITH_RDMA=OFF \
-DWITH_SSL=ON \
-DWITH_SYSTEM_BOOST=ON \
-DWITH_SYSTEMD=ON \
-DWITH_TESTS=ON \
-DWITH_XFS=ON \
-DENABLE_SHARED=ON \
..
make all
}
# ToDo to many fails
#check() {
# cd "${srcdir}/${pkgbase}-${pkgver}/build"
#
# export CTEST_PARALLEL_LEVEL="$(nproc)"
# make check
#
# # sometimes processes are not properly terminated...
# for process in ceph-mon ceph-mgr ceph-osd; do
# pkill -9 "$process" || true
# done
#}
package() {
cd "${srcdir}/${pkgbase}-${pkgver}/build"
# main install
make DESTDIR="$pkgdir" install
# install tmpfiles.d and sysusers.d stuff
install -Dm644 "${srcdir}/${pkgbase}-${pkgver}/systemd/ceph.tmpfiles.d" \
"${pkgdir}/usr/lib/tmpfiles.d/${pkgbase}.conf"
install -Dm644 "${srcdir}/ceph.sysusers" \
"${pkgdir}/usr/lib/sysusers.d/${pkgbase}.conf"
# remove debian init script
rm -rf "${pkgdir}/etc/init.d"
# fix sbin dir (cmake opt seems to have no effect)
mv "${pkgdir}"/usr/sbin/* "${pkgdir}/usr/bin/"
rm -rf "${pkgdir}/usr/sbin"
# remove drop.ceph.com ssh stuff
rm -f "${pkgdir}/usr/share/ceph/{{known_hosts,id_rsa}_drop.ceph.com,.pub}"
# fix bash completions path
install -d -m 755 "${pkgdir}/usr/share/bash-completion"
mv "$pkgdir"/{etc/bash_completion.d,usr/share/bash-completion/completions}
# fix EnvironmentFile location in systemd service files
sed -i 's|/etc/sysconfig/|/etc/conf.d/|g' "${pkgdir}"/usr/lib/systemd/system/*.service
# prepare some paths and set correct permissions
install -D -d -m750 -o 0 -g 340 "${pkgdir}/etc/ceph"
install -D -d -m750 -o 340 -g 340 "${pkgdir}/var/log/ceph"
install -D -d -m750 -o 340 -g 340 "${pkgdir}/var/lib/ceph"
install -D -d -m750 -o 340 -g 340 "${pkgdir}/var/lib/ceph/bootstrap-mds"
install -D -d -m750 -o 340 -g 340 "${pkgdir}/var/lib/ceph/bootstrap-osd"
install -D -d -m750 -o 340 -g 340 "${pkgdir}/var/lib/ceph/bootstrap-rgw"
install -D -d -m750 -o 340 -g 340 "${pkgdir}/var/lib/ceph/mon"
install -D -d -m750 -o 340 -g 340 "${pkgdir}/var/lib/ceph/mgr"
install -D -d -m750 -o 340 -g 340 "${pkgdir}/var/lib/ceph/osd"
}