From ab798568ace4066fe1783defd72f1d242576f751 Mon Sep 17 00:00:00 2001 From: Markus Unterwaditzer Date: Sat, 2 Sep 2017 18:30:49 +0200 Subject: [PATCH] Faster debian package build --- .dockerignore | 12 ------------ debian/compat | 1 - debian/control | 20 -------------------- debian/rules | 7 ------- scripts/dpkg.Dockerfile | 33 ++++++++++++++++++--------------- scripts/release-deb.sh | 11 +++++++++-- scripts/write-dpkg-changelog.py | 11 ----------- 7 files changed, 27 insertions(+), 68 deletions(-) delete mode 100644 .dockerignore delete mode 100644 debian/compat delete mode 100644 debian/control delete mode 100755 debian/rules delete mode 100644 scripts/write-dpkg-changelog.py diff --git a/.dockerignore b/.dockerignore deleted file mode 100644 index 639bf7c..0000000 --- a/.dockerignore +++ /dev/null @@ -1,12 +0,0 @@ -* -!vdirsyncer/*/* -!vdirsyncer/* -!.git/**/* -!.git/* -!debian/*/* -!debian/* -!scripts/*/* -!scripts/* -!setup.py -!Makefile -!README.rst diff --git a/debian/compat b/debian/compat deleted file mode 100644 index f599e28..0000000 --- a/debian/compat +++ /dev/null @@ -1 +0,0 @@ -10 diff --git a/debian/control b/debian/control deleted file mode 100644 index 487417a..0000000 --- a/debian/control +++ /dev/null @@ -1,20 +0,0 @@ -Source: vdirsyncer-latest -Maintainer: Markus Unterwaditzer -Section: utils -Priority: extra -Build-Depends: debhelper (>= 9), python3-all, dh-virtualenv (>= 0.8) -Standards-Version: 4.0.0 -Homepage: https://github.com/pimutils/vdirsyncer - -Package: vdirsyncer-latest -Architecture: any -Pre-Depends: dpkg (>= 1.16.1), python3, ${misc:Pre-Depends} -Depends: ${misc:Depends}, ${python3:Depends} -Suggests: python3-requests-oauthlib -Description: Synchronize calendars and contacts - Vdirsyncer synchronizes your calendars and addressbooks between two storages. - The most popular purpose is to synchronize a CalDAV/CardDAV server with a local - folder or file. The local data can then be accessed via a variety of programs, - none of which have to know or worry about syncing to a server. - . - It aims to be for CalDAV and CardDAV what OfflineIMAP is for IMAP. diff --git a/debian/rules b/debian/rules deleted file mode 100755 index bf55cde..0000000 --- a/debian/rules +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/make -f - -%: - dh $@ --with python-virtualenv - -override_dh_virtualenv: - dh_virtualenv --python /usr/bin/python3 --preinstall requests-oauthlib diff --git a/scripts/dpkg.Dockerfile b/scripts/dpkg.Dockerfile index 22076d2..0345b3c 100644 --- a/scripts/dpkg.Dockerfile +++ b/scripts/dpkg.Dockerfile @@ -6,28 +6,31 @@ FROM $distro:$distrover ARG distro ARG distrover -RUN apt-get update -RUN apt-get install -y software-properties-common -RUN if [ "$distrover" = "trusty" ]; then \ - add-apt-repository -y ppa:spotify-jyrki/dh-virtualenv; \ - fi -RUN if [ "$distro" = "debian" ]; then \ - echo "deb http://deb.debian.org/debian ${distrover}-backports main" > /etc/apt/sources.list.d/backports.list; \ - fi RUN apt-get update RUN apt-get install -y build-essential fakeroot debhelper git RUN apt-get install -y python3-all python3-pip +RUN apt-get install -y ruby ruby-dev +RUN apt-get install -y python-all python-pip -RUN apt-get install -t${distrover}-backports -y dh-virtualenv +RUN gem install fpm +RUN pip2 install virtualenv-tools RUN pip3 install virtualenv -RUN python3 -m virtualenv /vdirsyncer/env/ +RUN virtualenv -p python3 /vdirsyncer/env/ COPY . /vdirsyncer/vdirsyncer/ WORKDIR /vdirsyncer/vdirsyncer/ - -RUN . /vdirsyncer/env/bin/activate; make install-dev -RUN /vdirsyncer/env/bin/python scripts/write-dpkg-changelog.py > debian/changelog -RUN . /vdirsyncer/env/bin/activate; dpkg-buildpackage -us -uc RUN mkdir /vdirsyncer/pkgs/ -RUN mv /vdirsyncer/*.deb /vdirsyncer/pkgs/ + +RUN basename *.tar.gz .tar.gz | cut -d'-' -f2 | sed -e 's/\.dev/~/g' | tee version +RUN . /vdirsyncer/env/bin/activate; fpm -s virtualenv -t deb \ +-n "vdirsyncer-latest" \ +-v "$(cat version)" \ +--prefix /opt/venvs/vdirsyncer-latest \ +*.tar.gz + +RUN mv /vdirsyncer/vdirsyncer/*.deb /vdirsyncer/pkgs/ + +WORKDIR /vdirsyncer/pkgs/ +RUN dpkg -i *.deb +RUN LC_ALL=C.UTF-8 LANG=C.UTF-8 /opt/venvs/vdirsyncer-latest/bin/vdirsyncer --version diff --git a/scripts/release-deb.sh b/scripts/release-deb.sh index c6ec247..3b2c76f 100644 --- a/scripts/release-deb.sh +++ b/scripts/release-deb.sh @@ -3,12 +3,19 @@ set -xe distro=$1 distrover=$2 name=vdirsyncer-$distro-$distrover:latest +context="$(mktemp -d)" + +python setup.py sdist -d "$context" +cp scripts/dpkg.Dockerfile "$context/Dockerfile" docker build \ --build-arg distro=$distro \ --build-arg distrover=$distrover \ -t $name \ - -f scripts/dpkg.Dockerfile . + "$context" + rm -f dist/pkgs/*.deb +mkdir -p dist/ docker run $name tar -c -C /vdirsyncer pkgs | tar x -C dist/ -package_cloud push pimutils/vdirsyncer/$distro/$distrover --skip-errors dist/pkgs/*.deb +rm -rf "$context" +package_cloud push pimutils/vdirsyncer/$distro/$distrover dist/pkgs/*.deb diff --git a/scripts/write-dpkg-changelog.py b/scripts/write-dpkg-changelog.py deleted file mode 100644 index fdf94a6..0000000 --- a/scripts/write-dpkg-changelog.py +++ /dev/null @@ -1,11 +0,0 @@ -import pkg_resources -import datetime - -version = pkg_resources.get_distribution('vdirsyncer').version -version = version.replace('.dev', '~') -print('vdirsyncer-latest ({}) unstable; urgency=medium'.format(version)) -print(''' - * Dummy changelog - - -- Markus Unterwaditzer {} -'''.format(datetime.datetime.now().strftime('%a, %d %b %Y %H:%M:%S +0200')))