Skip to content

Commit 9513ee7

Browse files
author
Hugo Osvaldo Barrera
committed
Update build script for Debian/Ubuntu
1 parent a68121e commit 9513ee7

File tree

2 files changed

+38
-26
lines changed

2 files changed

+38
-26
lines changed

scripts/dpkg.Dockerfile

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,35 +3,40 @@ ARG distrover
33

44
FROM $distro:$distrover
55

6-
ARG distro
7-
ARG distrover
8-
96
RUN apt-get update
107
RUN apt-get install -y build-essential fakeroot debhelper git
11-
RUN apt-get install -y python3-all python3-pip
8+
RUN apt-get install -y python3-all python3-pip python3-venv
129
RUN apt-get install -y ruby ruby-dev
13-
RUN apt-get install -y python-all python-pip
1410

15-
RUN gem install fpm
11+
RUN gem install fpm package_cloud
1612

17-
RUN pip2 install virtualenv-tools
18-
RUN pip3 install virtualenv
13+
RUN pip3 install virtualenv virtualenv-tools3
1914
RUN virtualenv -p python3 /vdirsyncer/env/
2015

16+
# See https://github.com/jordansissel/fpm/issues/1106#issuecomment-461678970
17+
RUN pip3 uninstall -y virtualenv
18+
RUN echo 'python3 -m venv "$@"' > /usr/local/bin/virtualenv
19+
RUN chmod +x /usr/local/bin/virtualenv
20+
2121
COPY . /vdirsyncer/vdirsyncer/
2222
WORKDIR /vdirsyncer/vdirsyncer/
2323
RUN mkdir /vdirsyncer/pkgs/
2424

2525
RUN basename *.tar.gz .tar.gz | cut -d'-' -f2 | sed -e 's/\.dev/~/g' | tee version
2626
RUN (echo -n *.tar.gz; echo '[google]') | tee requirements.txt
27-
RUN . /vdirsyncer/env/bin/activate; fpm -s virtualenv -t deb \
28-
-n "vdirsyncer-latest" \
29-
-v "$(cat version)" \
30-
--prefix /opt/venvs/vdirsyncer-latest \
31-
requirements.txt
27+
RUN fpm --verbose \
28+
--input-type virtualenv \
29+
--output-type deb \
30+
--name "vdirsyncer-latest" \
31+
--version "$(cat version)" \
32+
--prefix /opt/venvs/vdirsyncer-latest \
33+
--depends python3 \
34+
requirements.txt
3235

3336
RUN mv /vdirsyncer/vdirsyncer/*.deb /vdirsyncer/pkgs/
3437

3538
WORKDIR /vdirsyncer/pkgs/
3639
RUN dpkg -i *.deb
40+
41+
# Check that it works:
3742
RUN LC_ALL=C.UTF-8 LANG=C.UTF-8 /opt/venvs/vdirsyncer-latest/bin/vdirsyncer --version

scripts/release-deb.sh

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,26 @@
11
#!/bin/sh
2+
23
set -xe
3-
distro=$1
4-
distrover=$2
5-
name=vdirsyncer-$distro-$distrover:latest
6-
context="$(mktemp -d)"
74

8-
python setup.py sdist -d "$context"
9-
cp scripts/dpkg.Dockerfile "$context/Dockerfile"
5+
DISTRO=$1
6+
DISTROVER=$2
7+
8+
NAME="vdirsyncer-${DISTRO}-${DISTROVER}:latest"
9+
CONTEXT="$(mktemp -d)"
1010

11+
python setup.py sdist -d "$CONTEXT"
12+
13+
# Build the package in a container with the right distro version.
1114
docker build \
12-
--build-arg distro=$distro \
13-
--build-arg distrover=$distrover \
14-
-t $name \
15-
"$context"
15+
--build-arg distro=$DISTRO \
16+
--build-arg distrover=$DISTROVER \
17+
-t $NAME \
18+
-f scripts/dpkg.Dockerfile \
19+
"$CONTEXT"
20+
21+
# Push the package to packagecloud.
22+
# TODO: Use ~/.packagecloud for CI.
23+
docker run -e PACKAGECLOUD_TOKEN=$PACKAGECLOUD_TOKEN $NAME \
24+
bash -xec "package_cloud push pimutils/vdirsyncer/$DISTRO/$DISTROVER *.deb"
1625

17-
docker run $name tar -c -C /vdirsyncer pkgs | tar x -C "$context"
18-
package_cloud push pimutils/vdirsyncer/$distro/$distrover $context/pkgs/*.deb
19-
rm -rf "$context"
26+
rm -rf "$CONTEXT"

0 commit comments

Comments
 (0)