From 178388ac8c7f98754873e2f0897fe8df3d2ef663 Mon Sep 17 00:00:00 2001 From: Vitaliy Filippov Date: Sun, 21 Feb 2021 00:52:16 +0300 Subject: [PATCH] Use packages/ subdir instead of build/ for Docker package builds --- .dockerignore | 1 + copy-fio-includes.sh | 2 +- copy-qemu-includes.sh | 2 +- debian/build-vitastor-buster.sh | 6 ++++++ debian/patched-qemu.Dockerfile | 27 +++++++++++---------------- debian/vitastor.Dockerfile | 29 ++++++++++++----------------- 6 files changed, 32 insertions(+), 35 deletions(-) create mode 100755 debian/build-vitastor-buster.sh diff --git a/.dockerignore b/.dockerignore index 06401a9da..fd2746440 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,5 +1,6 @@ .git build +packages mon/node_modules *.o *.so diff --git a/copy-fio-includes.sh b/copy-fio-includes.sh index 5488a90c1..715d2e986 100755 --- a/copy-fio-includes.sh +++ b/copy-fio-includes.sh @@ -1,6 +1,6 @@ #!/bin/bash -gcc -E -o fio_headers.i fio_headers.h +gcc -I. -E -o fio_headers.i src/fio_headers.h rm -rf fio-copy for i in `grep -Po 'fio/[^"]+' fio_headers.i | sort | uniq`; do diff --git a/copy-qemu-includes.sh b/copy-qemu-includes.sh index 09fc44eb0..6a39e2eda 100755 --- a/copy-qemu-includes.sh +++ b/copy-qemu-includes.sh @@ -5,7 +5,7 @@ #cd b/qemu; make qapi gcc -I qemu/b/qemu `pkg-config glib-2.0 --cflags` \ - -I qemu/include -E -o qemu_driver.i qemu_driver.c + -I qemu/include -E -o qemu_driver.i src/qemu_driver.c rm -rf qemu-copy for i in `grep -Po 'qemu/[^"]+' qemu_driver.i | sort | uniq`; do diff --git a/debian/build-vitastor-buster.sh b/debian/build-vitastor-buster.sh new file mode 100755 index 000000000..4818e8844 --- /dev/null +++ b/debian/build-vitastor-buster.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +sed 's/$REL/buster/' < vitastor.Dockerfile > ../Dockerfile +cd .. +mkdir -p packages +sudo podman build -v `pwd`/packages:/root/packages -f Dockerfile . diff --git a/debian/patched-qemu.Dockerfile b/debian/patched-qemu.Dockerfile index 6cdf8b7a8..e81e7bb14 100644 --- a/debian/patched-qemu.Dockerfile +++ b/debian/patched-qemu.Dockerfile @@ -1,13 +1,8 @@ # Build patched QEMU for Debian Buster or Bullseye/Sid inside a container -# cd ..; podman build --build-arg REL=bullseye -v `pwd`/build:/root/build -f debian/patched-qemu.Dockerfile . - -ARG REL=bullseye +# cd ..; podman build --build-arg REL=bullseye -v `pwd`/packages:/root/packages -f debian/patched-qemu.Dockerfile . FROM debian:$REL -# again, it doesn't work otherwise -ARG REL=bullseye - WORKDIR /root RUN if [ "$REL" = "buster" ]; then \ @@ -30,20 +25,20 @@ 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; \ + mkdir -p /root/packages/qemu-$REL; \ + rm -rf /root/packages/qemu-$REL/*; \ + cd /root/packages/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; \ + if [ -d /root/packages/qemu-$REL/qemu-5.0 ]; then \ + cp /root/vitastor/qemu-5.0-vitastor.patch /root/packages/qemu-$REL/qemu-5.0/debian/patches; \ + echo qemu-5.0-vitastor.patch >> /root/packages/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`; \ + cp /root/vitastor/qemu-5.1-vitastor.patch /root/packages/qemu-$REL/qemu-*/debian/patches; \ + P=`ls -d /root/packages/qemu-$REL/qemu-*/debian/patches`; \ echo qemu-5.1-vitastor.patch >> $P/series; \ fi; \ - cd /root/build/qemu-$REL/qemu-*/; \ + cd /root/packages/qemu-$REL/qemu-*/; \ V=$(head -n1 debian/changelog | perl -pe 's/^.*\((.*?)(~bpo[\d\+]*)?\).*$/$1/')+vitastor1; \ DEBFULLNAME="Vitaliy Filippov " dch -D $REL -v $V 'Plug Vitastor block driver'; \ DEB_BUILD_OPTIONS=nocheck dpkg-buildpackage --jobs=auto -sa; \ - rm -rf /root/build/qemu-$REL/qemu-*/ + rm -rf /root/packages/qemu-$REL/qemu-*/ diff --git a/debian/vitastor.Dockerfile b/debian/vitastor.Dockerfile index f9dc43f1d..64ff7c4e0 100644 --- a/debian/vitastor.Dockerfile +++ b/debian/vitastor.Dockerfile @@ -1,13 +1,8 @@ # Build Vitastor packages for Debian Buster or Bullseye/Sid inside a container -# cd ..; podman build --build-arg REL=bullseye -v `pwd`/build:/root/build -f debian/vitastor.Dockerfile . - -ARG REL=bullseye +# cd ..; podman build --build-arg REL=bullseye -v `pwd`/packages:/root/packages -f debian/vitastor.Dockerfile . FROM debian:$REL -# again, it doesn't work otherwise -ARG REL=bullseye - WORKDIR /root RUN if [ "$REL" = "buster" ]; then \ @@ -27,7 +22,7 @@ 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 -RUN apt-get -y install libjerasure-dev +RUN apt-get -y install libjerasure-dev cmake ADD . /root/vitastor RUN set -e -x; \ @@ -35,18 +30,18 @@ RUN set -e -x; \ cd /root/fio-build/; \ rm -rf /root/fio-build/*; \ dpkg-source -x /root/fio*.dsc; \ - cd /root/build/qemu-$REL/; \ + cd /root/packages/qemu-$REL/; \ rm -rf qemu*/; \ dpkg-source -x qemu*.dsc; \ - cd /root/build/qemu-$REL/qemu*/; \ + cd /root/packages/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; \ + make -j8 qapi/qapi-builtin-types.h; \ + mkdir -p /root/packages/vitastor-$REL; \ + rm -rf /root/packages/vitastor-$REL/*; \ + cd /root/packages/vitastor-$REL; \ cp -r /root/vitastor vitastor-0.5.4; \ - ln -s /root/build/qemu-$REL/qemu-*/ vitastor-0.5.4/qemu; \ + ln -s /root/packages/qemu-$REL/qemu-*/ vitastor-0.5.4/qemu; \ ln -s /root/fio-build/fio-*/ vitastor-0.5.4/fio; \ cd vitastor-0.5.4; \ FIO=$(head -n1 fio/debian/changelog | perl -pe 's/^.*\((.*?)\).*$/$1/'); \ @@ -60,13 +55,13 @@ RUN set -e -x; \ diff -NaurpbB a b > debian/patches/qemu-fio-headers.patch || true; \ echo qemu-fio-headers.patch >> debian/patches/series; \ rm -rf a b; \ - rm -rf /root/build/qemu-$REL/qemu*/; \ + rm -rf /root/packages/qemu-$REL/qemu*/; \ echo "dep:fio=$FIO" > debian/substvars; \ echo "dep:qemu=$QEMU" >> debian/substvars; \ - cd /root/build/vitastor-$REL; \ + cd /root/packages/vitastor-$REL; \ tar --sort=name --mtime='2020-01-01' --owner=0 --group=0 --exclude=debian -cJf vitastor_0.5.4.orig.tar.xz vitastor-0.5.4; \ cd vitastor-0.5.4; \ V=$(head -n1 debian/changelog | perl -pe 's/^.*\((.*?)\).*$/$1/'); \ DEBFULLNAME="Vitaliy Filippov " dch -D $REL -v "$V""$REL" "Rebuild for $REL"; \ DEB_BUILD_OPTIONS=nocheck dpkg-buildpackage --jobs=auto -sa; \ - rm -rf /root/build/vitastor-$REL/vitastor-*/ + rm -rf /root/packages/vitastor-$REL/vitastor-*/