From b56f8820ec949ce9d46aabaedff83e50ab593247 Mon Sep 17 00:00:00 2001 From: Vitaliy Filippov Date: Mon, 9 Nov 2020 22:55:06 +0300 Subject: [PATCH] Container packaging for Debian 11 Bullseye, CentOS 7 and CentOS 8 --- debian/vitastor-bullseye.Dockerfile | 77 +++++++++++++++++++++++++++++ debian/vitastor-buster.Dockerfile | 2 +- rpm/build-tarball.sh | 4 +- rpm/prepare-env.sh | 8 +-- rpm/vitastor-el7.Dockerfile | 44 +++++++++++++++++ rpm/vitastor-el8.Dockerfile | 61 +++++++++++++++++++++++ 6 files changed, 189 insertions(+), 7 deletions(-) create mode 100644 debian/vitastor-bullseye.Dockerfile create mode 100644 rpm/vitastor-el7.Dockerfile create mode 100644 rpm/vitastor-el8.Dockerfile diff --git a/debian/vitastor-bullseye.Dockerfile b/debian/vitastor-bullseye.Dockerfile new file mode 100644 index 00000000..e28ef8a0 --- /dev/null +++ b/debian/vitastor-bullseye.Dockerfile @@ -0,0 +1,77 @@ +# Build packages for Debian Bullseye/Sid inside a container +# cd ..; podman build -t vitastor-bullseye -v `pwd`/build:/root/build -f debian/vitastor-bullseye.Dockerfile . + +ARG REL=bullseye + +FROM debian:$REL + +# again, it doesn't work otherwise +ARG REL=bullseye + +WORKDIR /root + +RUN grep '^deb ' /etc/apt/sources.list | perl -pe 's/^deb/deb-src/' >> /etc/apt/sources.list; \ + echo 'APT::Install-Recommends false;' > /etc/apt/apt.conf + +RUN apt-get update +RUN apt-get -y install qemu fio liburing1 liburing-dev libgoogle-perftools-dev devscripts +RUN apt-get -y build-dep qemu +RUN apt-get -y build-dep fio +RUN apt-get --download-only source qemu +RUN apt-get --download-only source fio + +ADD qemu-5.0-vitastor.patch qemu-5.1-vitastor.patch /root/vitastor/ +RUN set -e; \ + mkdir -p /root/build/qemu-$REL; \ + rm -rf /root/build/qemu-$REL/*; \ + cd /root/build/qemu-$REL; \ + dpkg-source -x /root/qemu*.dsc; \ + if [ -d /root/build/qemu-$REL/qemu-5.0 ]; then \ + cp /root/vitastor/qemu-5.0-vitastor.patch /root/build/qemu-$REL/qemu-5.0/debian/patches; \ + echo qemu-5.0-vitastor.patch >> /root/build/qemu-$REL/qemu-5.0/debian/patches/series; \ + else \ + cp /root/vitastor/qemu-5.1-vitastor.patch /root/build/qemu-$REL/qemu-*/debian/patches; \ + P=`ls -d /root/build/qemu-$REL/qemu-*/debian/patches`; \ + echo qemu-5.1-vitastor.patch >> $P/series; \ + fi; \ + cd /root/build/qemu-$REL/qemu-*/; \ + V=$(head -n1 debian/changelog | perl -pe 's/^.*\((.*?)(~bpo[\d\+]*)?\).*$/$1/')+vitastor1; \ + echo ">>> VERSION: $V"; \ + DEBFULLNAME="Vitaliy Filippov " dch -D $REL -v $V 'Plug Vitastor block driver'; \ + DEB_BUILD_OPTIONS=nocheck dpkg-buildpackage --jobs=auto; \ + rm -rf /root/build/qemu-$REL/qemu-*/ + +RUN cd /root/build/qemu-$REL && apt-get -y install ./qemu-system-data*.deb ./qemu-system-common_*.deb ./qemu-system-x86_*.deb ./qemu_*.deb + +ADD . /root/vitastor +RUN set -e; \ + mkdir -p /root/fio-build/; \ + cd /root/fio-build/; \ + rm -rf /root/fio-build/*; \ + dpkg-source -x /root/fio*.dsc; \ + cd /root/build/qemu-$REL/; \ + rm -rf qemu*/; \ + dpkg-source -x qemu*.dsc; \ + cd /root/build/qemu-$REL/qemu*/; \ + debian/rules b/configure-stamp; \ + cd b/qemu; \ + make -j8 qapi; \ + mkdir -p /root/build/vitastor-$REL; \ + rm -rf /root/build/vitastor-$REL/*; \ + cd /root/build/vitastor-$REL; \ + cp -r /root/vitastor vitastor-0.5; \ + ln -s /root/build/qemu-$REL/qemu-*/ vitastor-0.5/qemu; \ + ln -s /root/fio-build/fio-*/ vitastor-0.5/fio; \ + cd vitastor-0.5; \ + sh copy-qemu-includes.sh; \ + sh copy-fio-includes.sh; \ + rm qemu fio; \ + mv qemu-copy qemu; \ + mv fio-copy fio; \ + rm -rf /root/build/qemu-$REL/qemu*/; \ + cd /root/build/vitastor-$REL; \ + tar -czf vitastor_0.5.orig.tar.gz vitastor-0.5; \ + cd vitastor-0.5; \ + ls -l; \ + DEB_BUILD_OPTIONS=nocheck dpkg-buildpackage --jobs=auto; \ + rm -rf /root/build/vitastor-$REL/vitastor-*/ diff --git a/debian/vitastor-buster.Dockerfile b/debian/vitastor-buster.Dockerfile index f892cbbf..d69e9364 100644 --- a/debian/vitastor-buster.Dockerfile +++ b/debian/vitastor-buster.Dockerfile @@ -30,7 +30,7 @@ RUN set -e; \ echo qemu-5.1-vitastor.patch >> /root/build/qemu-buster/qemu-*/debian/patches/series; \ fi; \ cd /root/build/qemu-buster/qemu-*/; \ - V=$(head -n1 debian/changelog | perl -pe 's/^.*\((.*?)(~bpo[\d\+]*)\).*$/$1/')~vitastor1; \ + V=$(head -n1 debian/changelog | perl -pe 's/^.*\((.*?)(~bpo[\d\+]*)\).*$/$1/')+vitastor1; \ DEBFULLNAME="Vitaliy Filippov " dch -D buster -v $V 'Plug Vitastor block driver'; \ DEB_BUILD_OPTIONS=nocheck dpkg-buildpackage --jobs=auto; \ rm -rf /root/build/qemu-buster/qemu-*/ diff --git a/rpm/build-tarball.sh b/rpm/build-tarball.sh index cb605991..aa50861f 100755 --- a/rpm/build-tarball.sh +++ b/rpm/build-tarball.sh @@ -44,8 +44,8 @@ ln -s ~/rpmbuild/BUILD/fio*/ fio sh copy-fio-includes.sh rm fio mv fio-copy fio -FIO=`rpm -qa fio | perl -pe 's/^fio-(.*)\.[^\.]+$/$1/'` -QEMU=`rpm -qa qemu qemu-kvm | perl -pe 's/^qemu-(?:kvm-)?(.*)\.[^\.]+$/$1/'` +FIO=`rpm -qa fio | perl -pe 's/^fio-(.*)$/$1/'` +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 ee6d8db7..843d1fd1 100755 --- a/rpm/prepare-env.sh +++ b/rpm/prepare-env.sh @@ -6,8 +6,8 @@ set -e DIST=`rpm --eval '%dist'` rm -f /etc/yum.repos.d/CentOS-Media.repo 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 -y install centos-release-advanced-virtualization epel-release + dnf --enablerepo='*' -y install gcc-toolset-9 gcc-toolset-9-gcc-c++ gperftools-devel qemu-kvm fio nodejs rpm-build dnf download --disablerepo='*' --enablerepo='centos-advanced-virtualization-source' --source qemu-kvm dnf download --source fio rpm --nomd5 -i qemu*.src.rpm @@ -16,8 +16,8 @@ if [ "$DIST" = ".el8" ]; then 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 + yum -y --enablerepo=extras install centos-release-scl epel-release yum-utils rpm-build + yum -y install devtoolset-9-gcc-c++ devtoolset-9-libatomic-devel gperftools-devel qemu fio rh-nodejs12 yumdownloader --source qemu yumdownloader --source fio rpm --nomd5 -i qemu*.src.rpm diff --git a/rpm/vitastor-el7.Dockerfile b/rpm/vitastor-el7.Dockerfile new file mode 100644 index 00000000..d98c9b98 --- /dev/null +++ b/rpm/vitastor-el7.Dockerfile @@ -0,0 +1,44 @@ +# Build packages for CentOS 7 inside a container +# cd ..; podman build -t vitastor-el7 -v `pwd`/build:/root/build -f rpm/vitastor-el7.Dockerfile . + +FROM centos:7 + +WORKDIR /root + +RUN yum -y --enablerepo=extras install centos-release-scl epel-release yum-utils rpm-build +RUN yum -y install devtoolset-9-gcc-c++ devtoolset-9-libatomic-devel gperftools-devel qemu fio rh-nodejs12 +RUN yumdownloader --source qemu +RUN yumdownloader --source fio +RUN rpm --nomd5 -i qemu*.src.rpm +RUN rpm --nomd5 -i fio*.src.rpm +RUN rm -f /etc/yum.repos.d/CentOS-Media.repo +RUN cd ~/rpmbuild/SPECS && yum-builddep -y --enablerepo='*' qemu.spec +RUN cd ~/rpmbuild/SPECS && yum-builddep -y --enablerepo='*' fio.spec + +ADD https://vitastor.io/rpms/liburing-el7/liburing-0.7-2.el7.src.rpm /root + +RUN set -e; \ + rpm -i liburing*.src.rpm; \ + cd ~/rpmbuild/SPECS/; \ + . /opt/rh/devtoolset-9/enable; \ + rpmbuild -ba liburing.spec; \ + mkdir -p /root/build/liburing-el7; \ + rm -rf /root/build/liburing-el7/*; \ + cp ~/rpmbuild/RPMS/*/liburing* /root/build/liburing-el7/; \ + cp ~/rpmbuild/SRPMS/liburing* /root/build/liburing-el7/ + +RUN rpm -i `ls /root/build/liburing-el7/liburing-*.x86_64.rpm | grep -v debug` + +ADD . /root/vitastor + +RUN set -e; \ + cd /root/vitastor/rpm; \ + sh build-tarball.sh; \ + cp /root/vitastor-0.5.el7.tar.gz ~/rpmbuild/SOURCES; \ + cp vitastor-el7.spec ~/rpmbuild/SPECS/vitastor.spec; \ + cd ~/rpmbuild/SPECS/; \ + rpmbuild -ba vitastor.spec; \ + mkdir -p /root/build/vitastor-el7; \ + rm -rf /root/build/vitastor-el7/*; \ + cp ~/rpmbuild/RPMS/*/vitastor* /root/build/vitastor-el7/; \ + cp ~/rpmbuild/SRPMS/vitastor* /root/build/vitastor-el7/ diff --git a/rpm/vitastor-el8.Dockerfile b/rpm/vitastor-el8.Dockerfile new file mode 100644 index 00000000..fd835c00 --- /dev/null +++ b/rpm/vitastor-el8.Dockerfile @@ -0,0 +1,61 @@ +# Build packages for CentOS 8 inside a container +# cd ..; podman build -t vitastor-el8 -v `pwd`/build:/root/build -f rpm/vitastor-el8.Dockerfile . + +FROM centos:8 + +WORKDIR /root + +RUN rm -f /etc/yum.repos.d/CentOS-Media.repo +RUN dnf -y install centos-release-advanced-virtualization epel-release dnf-plugins-core +RUN dnf --enablerepo='centos-advanced-virtualization' -y install gcc-toolset-9 gcc-toolset-9-gcc-c++ gperftools-devel qemu-kvm fio nodejs rpm-build +RUN rm -rf /var/lib/dnf/*; dnf download --disablerepo='*' --enablerepo='centos-advanced-virtualization-source' --source qemu-kvm +RUN dnf download --source fio +RUN rpm --nomd5 -i qemu*.src.rpm +RUN rpm --nomd5 -i fio*.src.rpm +RUN cd ~/rpmbuild/SPECS && dnf builddep -y --enablerepo='*' --spec qemu-kvm.spec +RUN cd ~/rpmbuild/SPECS && dnf builddep -y --enablerepo='*' --spec fio.spec + +ADD https://vitastor.io/rpms/liburing-el7/liburing-0.7-2.el7.src.rpm /root + +RUN set -e; \ + rpm -i liburing*.src.rpm; \ + cd ~/rpmbuild/SPECS/; \ + . /opt/rh/gcc-toolset-9/enable; \ + rpmbuild -ba liburing.spec; \ + mkdir -p /root/build/liburing-el8; \ + rm -rf /root/build/liburing-el8/*; \ + cp ~/rpmbuild/RPMS/*/liburing* /root/build/liburing-el8/; \ + cp ~/rpmbuild/SRPMS/liburing* /root/build/liburing-el8/ + +RUN rpm -i `ls /root/build/liburing-el7/liburing-*.x86_64.rpm | grep -v debug` + +ADD . /root/vitastor + +RUN set -e; \ + mkdir -p /root/build/qemu-el8; \ + rm -rf /root/build/qemu-el8/*; \ + rpm --nomd5 -i /root/qemu*.src.rpm; \ + cd ~/rpmbuild/SPECS; \ + PN=$(grep ^Patch qemu-kvm.spec | tail -n1 | perl -pe 's/Patch(\d+).*/$1/'); \ + csplit qemu-kvm.spec "/^Patch$PN/"; \ + cat xx00 > qemu-kvm.spec; \ + head -n 1 xx01 >> qemu-kvm.spec; \ + echo "Patch$((PN+1)): qemu-4.2-vitastor.patch" >> qemu-kvm.spec; \ + tail -n +2 xx01 >> qemu-kvm.spec; \ + perl -i -pe 's/(^Release:\s*\d+)/$1.vitastor/' qemu-kvm.spec; \ + cp /root/vitastor/qemu-4.2-vitastor.patch ~/rpmbuild/SOURCES; \ + rpmbuild --nocheck -ba qemu-kvm.spec; \ + cp ~/rpmbuild/RPMS/*/*qemu* /root/build/qemu-el8/; \ + cp ~/rpmbuild/SRPMS/*qemu* /root/build/qemu-el8/ + +RUN set -e; \ + cd /root/vitastor/rpm; \ + sh build-tarball.sh; \ + cp /root/vitastor-0.5.el8.tar.gz ~/rpmbuild/SOURCES; \ + cp vitastor-el8.spec ~/rpmbuild/SPECS/vitastor.spec; \ + cd ~/rpmbuild/SPECS/; \ + rpmbuild -ba vitastor.spec; \ + mkdir -p /root/build/vitastor-el8; \ + rm -rf /root/build/vitastor-el8/*; \ + cp ~/rpmbuild/RPMS/*/vitastor* /root/build/vitastor-el8/; \ + cp ~/rpmbuild/SRPMS/vitastor* /root/build/vitastor-el8/