PKGBUILD 5.15 KB
Newer Older
1
# Contributions from ArchLinux: https://git.archlinux.org/svntogit/packages.git/tree/trunk?h=packages/ceph
Xuetian Weng's avatar
Xuetian Weng committed
2 3

pkgname=ceph
AlmAck's avatar
AlmAck committed
4 5
pkgver=12.2.1
pkgrel=1
Xuetian Weng's avatar
Xuetian Weng committed
6 7 8 9
pkgdesc='Distributed, fault-tolerant storage platform delivering object, block, and file system'
arch=('x86_64')
url='http://ceph.com/'
license=('GPL')
AlmAck's avatar
AlmAck committed
10 11 12 13 14 15
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' )
Xuetian Weng's avatar
Xuetian Weng committed
16
options=('emptydirs')
AlmAck's avatar
AlmAck committed
17 18 19 20 21 22 23 24 25 26 27 28
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')
Xuetian Weng's avatar
Xuetian Weng committed
29

Chaoting Liu's avatar
Chaoting Liu committed
30
prepare() {
AlmAck's avatar
AlmAck committed
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
  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
  
Chaoting Liu's avatar
Chaoting Liu committed
66 67 68
  [[ -d build ]] && rm -rfv build
  mkdir build
}
Xuetian Weng's avatar
Xuetian Weng committed
69 70

build() {
AlmAck's avatar
AlmAck committed
71
  cd "${srcdir}/${pkgbase}-${pkgver}"
Xuetian Weng's avatar
Xuetian Weng committed
72

Chaoting Liu's avatar
Chaoting Liu committed
73
  cd build
AlmAck's avatar
AlmAck committed
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
  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
Chaoting Liu's avatar
Chaoting Liu committed
100 101
}

AlmAck's avatar
AlmAck committed
102 103 104 105 106 107 108 109 110 111 112 113 114
# 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
#}

Xuetian Weng's avatar
Xuetian Weng committed
115
package() {
AlmAck's avatar
AlmAck committed
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132
  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"
Xuetian Weng's avatar
Xuetian Weng committed
133

AlmAck's avatar
AlmAck committed
134 135
  # remove drop.ceph.com ssh stuff
  rm -f "${pkgdir}/usr/share/ceph/{{known_hosts,id_rsa}_drop.ceph.com,.pub}"
Xuetian Weng's avatar
Xuetian Weng committed
136

AlmAck's avatar
AlmAck committed
137 138 139
  # fix bash completions path
  install -d -m 755 "${pkgdir}/usr/share/bash-completion"
  mv "$pkgdir"/{etc/bash_completion.d,usr/share/bash-completion/completions}
Xuetian Weng's avatar
Xuetian Weng committed
140

AlmAck's avatar
AlmAck committed
141 142
  # fix EnvironmentFile location in systemd service files
  sed -i 's|/etc/sysconfig/|/etc/conf.d/|g' "${pkgdir}"/usr/lib/systemd/system/*.service
Chaoting Liu's avatar
Chaoting Liu committed
143

AlmAck's avatar
AlmAck committed
144 145 146 147 148 149 150 151 152 153
  # 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"
Xuetian Weng's avatar
Xuetian Weng committed
154
}