Faster debian package build

This commit is contained in:
Markus Unterwaditzer 2017-09-02 18:30:49 +02:00
parent cc91f334e7
commit ab798568ac
7 changed files with 27 additions and 68 deletions

View file

@ -1,12 +0,0 @@
*
!vdirsyncer/*/*
!vdirsyncer/*
!.git/**/*
!.git/*
!debian/*/*
!debian/*
!scripts/*/*
!scripts/*
!setup.py
!Makefile
!README.rst

1
debian/compat vendored
View file

@ -1 +0,0 @@
10

20
debian/control vendored
View file

@ -1,20 +0,0 @@
Source: vdirsyncer-latest
Maintainer: Markus Unterwaditzer <markus-debianpkg@unterwaditzer.net>
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.

7
debian/rules vendored
View file

@ -1,7 +0,0 @@
#!/usr/bin/make -f
%:
dh $@ --with python-virtualenv
override_dh_virtualenv:
dh_virtualenv --python /usr/bin/python3 --preinstall requests-oauthlib

View file

@ -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

View file

@ -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

View file

@ -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 <markus-debianpkg@unterwaditzer.net> {}
'''.format(datetime.datetime.now().strftime('%a, %d %b %Y %H:%M:%S +0200')))