Add RPM build scripts for CentOS 7

Vitaliy Filippov 2020-11-07 01:51:14 +03:00
parent 3be7bc29d8
commit 2e0f223ddb
3 changed files with 115 additions and 0 deletions

rpm/ Executable file
View File

@ -0,0 +1,43 @@
# Vitastor depends on QEMU and FIO headers, but QEMU and FIO don't have -devel packages
# So we have to copy their headers into the source tarball
set -e
VITASTOR=$(dirname $0)
VITASTOR=$(realpath "$VITASTOR/..")
. /opt/rh/devtoolset-9/enable
cd ~/rpmbuild/SPECS
rpmbuild -bp fio.spec
perl -i -pe 's/^make V=1/exit 0; make V=1/' qemu.spec
rpmbuild -bc qemu.spec
perl -i -pe 's/^exit 0; make V=1/make V=1/' qemu.spec
cd ~/rpmbuild/BUILD/qemu*/
rm -rf $VITASTOR/qemu $VITASTOR/fio
mkdir -p $VITASTOR/qemu/b/qemu
make config-host.h
cp config-host.h $VITASTOR/qemu/b/qemu
cp -r include $VITASTOR/qemu
if [ -f qapi-schema.json ]; then
# QEMU 2.0
make qapi-types.h
cp qapi-types.h $VITASTOR/qemu/b/qemu
# QEMU 3.0+
make qapi
cp -r qapi $VITASTOR/qemu/b/qemu
rm -rf qemu
mv qemu-copy qemu
ln -s ~/rpmbuild/BUILD/fio*/ fio
rm fio
mv fio-copy fio
FIO=`rpm -qa fio | perl -pe 's/^fio-(.*)\.[^\.]+$/$1/'`
QEMU=`rpm -qa qemu | perl -pe 's/^qemu-(.*)\.[^\.]+$/$1/'`
perl -i -pe 's/(Requires:\s*fio)([^\n]+)?/$1 = '$FIO'/' $VITASTOR/rpm/vitastor.spec
perl -i -pe 's/(Requires:\s*qemu)([^\n]+)?/$1 = '$QEMU'/' $VITASTOR/rpm/vitastor.spec
tar --transform 's#^#vitastor-0.5/#' --exclude 'rpm/*.rpm' -czf $VITASTOR/../vitastor-0.5$(rpm --eval '%dist').tar.gz *

rpm/ Executable file
View File

@ -0,0 +1,15 @@
# Install/get required packages on CentOS 7
set -e
rm -f /etc/yum.repos.d/CentOS-Media.repo
yum -y --enablerepo=extras install centos-release-scl epel-release yum-utils rpm-build qemu fio
yum -y --enablerepo='*' install devtoolset-9-gcc-c++ devtoolset-9-libatomic-devel gperftools-devel
yumdownloader --source qemu
yumdownloader --source fio
rpm --nomd5 -i qemu*.src.rpm
rpm --nomd5 -i fio*.src.rpm
cd ~/rpmbuild/SPECS
yum-builddep -y --enablerepo='*' qemu.spec
yum-builddep -y --enablerepo='*' fio.spec

rpm/vitastor.spec Normal file
View File

@ -0,0 +1,57 @@
Name: vitastor
Version: 0.5
Release: 1%{?dist}
Summary: Vitastor, a fast software-defined clustered block storage
License: Vitastor Network Public License 1.0
Source0: vitastor-0.5.el7.tar.gz
BuildRequires: liburing-devel >= 0.6
BuildRequires: gperftools-devel
BuildRequires: devtoolset-9-gcc-c++
BuildRequires: rh-nodejs12
BuildRequires: rh-nodejs12-npm
Requires: fio = 3.7-1.el7
Requires: qemu = 2.0.0-1.el7.6
Requires: rh-nodejs12
Requires: rh-nodejs12-npm
Requires: liburing >= 0.6
Vitastor is a small, simple and fast clustered block storage (storage for VM drives),
architecturally similar to Ceph which means strong consistency, primary-replication,
symmetric clustering and automatic data distribution over any number of drives of any
size with configurable redundancy (replication or erasure codes/XOR).
%setup -q
. /opt/rh/devtoolset-9/enable
make %{?_smp_mflags}
%make_install BINDIR=%_bindir LIBDIR=%_libdir QEMU_PLUGINDIR=%_libdir/qemu-kvm
. /opt/rh/rh-nodejs12/enable
cd mon
npm install
cd ..
cp -r mon %buildroot%_libdir/vitastor/mon