diff --git a/rpm/build-tarball.sh b/rpm/build-tarball.sh index 6f0e072d..cb605991 100755 --- a/rpm/build-tarball.sh +++ b/rpm/build-tarball.sh @@ -7,16 +7,24 @@ set -e VITASTOR=$(dirname $0) VITASTOR=$(realpath "$VITASTOR/..") -. /opt/rh/devtoolset-9/enable +if [ -d /opt/rh/gcc-toolset-9 ]; then + # CentOS 8 + EL=8 + . /opt/rh/gcc-toolset-9/enable +else + # CentOS 7 + EL=7 + . /opt/rh/devtoolset-9/enable +fi 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 +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 +make -j8 config-host.h cp config-host.h $VITASTOR/qemu/b/qemu cp -r include $VITASTOR/qemu if [ -f qapi-schema.json ]; then @@ -37,7 +45,7 @@ sh copy-fio-includes.sh 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 +QEMU=`rpm -qa qemu qemu-kvm | perl -pe 's/^qemu-(?:kvm-)?(.*)\.[^\.]+$/$1/'` +perl -i -pe 's/(Requires:\s*fio)([^\n]+)?/$1 = '$FIO'/' $VITASTOR/rpm/vitastor-el$EL.spec +perl -i -pe 's/(Requires:\s*qemu)([^\n]+)?/$1 = '$QEMU'/' $VITASTOR/rpm/vitastor-el$EL.spec tar --transform 's#^#vitastor-0.5/#' --exclude 'rpm/*.rpm' -czf $VITASTOR/../vitastor-0.5$(rpm --eval '%dist').tar.gz * diff --git a/rpm/prepare-env.sh b/rpm/prepare-env.sh index f4808833..ee6d8db7 100755 --- a/rpm/prepare-env.sh +++ b/rpm/prepare-env.sh @@ -1,15 +1,28 @@ #!/bin/bash -# Install/get required packages on CentOS 7 +# Install/get required packages on CentOS 7 and 8 set -e +DIST=`rpm --eval '%dist'` 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 +if [ "$DIST" = ".el8" ]; then + dnf -y install centos-release-advanced-virtualization rpm-build + dnf -y install gcc-toolset-9 gcc-toolset-9-gcc-c++ gperftools-devel qemu fio + dnf download --disablerepo='*' --enablerepo='centos-advanced-virtualization-source' --source qemu-kvm + dnf download --source fio + rpm --nomd5 -i qemu*.src.rpm + rpm --nomd5 -i fio*.src.rpm + cd ~/rpmbuild/SPECS + dnf builddep -y --enablerepo='*' --spec qemu-kvm.spec + dnf builddep -y --enablerepo='*' --spec fio.spec +else + 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 +fi diff --git a/rpm/vitastor.spec b/rpm/vitastor-el7.spec similarity index 100% rename from rpm/vitastor.spec rename to rpm/vitastor-el7.spec diff --git a/rpm/vitastor-el8.spec b/rpm/vitastor-el8.spec new file mode 100644 index 00000000..d5ed9567 --- /dev/null +++ b/rpm/vitastor-el8.spec @@ -0,0 +1,54 @@ +Name: vitastor +Version: 0.5 +Release: 1%{?dist} +Summary: Vitastor, a fast software-defined clustered block storage + +License: Vitastor Network Public License 1.0 +URL: https://vitastor.io/ +Source0: vitastor-0.5.el8.tar.gz + +BuildRequires: liburing-devel >= 0.6 +BuildRequires: gperftools-devel +BuildRequires: gcc-toolset-9-gcc-c++ +BuildRequires: nodejs >= 10 +Requires: fio = 3.7-3.el8 +Requires: qemu = 4.2.0-29.el8.6 +Requires: nodejs >= 10 +Requires: liburing >= 0.6 + +%description +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). + + +%prep +%setup -q + + +%build +. /opt/rh/gcc-toolset-9/enable +make %{?_smp_mflags} + + +%install +rm -rf $RPM_BUILD_ROOT +%make_install BINDIR=%_bindir LIBDIR=%_libdir QEMU_PLUGINDIR=%_libdir/qemu-kvm +cd mon +npm install +cd .. +cp -r mon %buildroot%_libdir/vitastor/mon + + +%files +%doc +%_bindir/vitastor-dump-journal +%_bindir/vitastor-nbd +%_bindir/vitastor-osd +%_bindir/vitastor-rm +%_libdir/qemu-kvm/block-vitastor.so +%_libdir/vitastor + + +%changelog