mirror of
https://github.com/samsonjs/vdirsyncer.git
synced 2026-03-25 08:55:50 +00:00
Update build script for Debian/Ubuntu
This commit is contained in:
parent
a68121e439
commit
9513ee7f61
2 changed files with 38 additions and 26 deletions
|
|
@ -3,35 +3,40 @@ ARG distrover
|
|||
|
||||
FROM $distro:$distrover
|
||||
|
||||
ARG distro
|
||||
ARG distrover
|
||||
|
||||
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 python3-all python3-pip python3-venv
|
||||
RUN apt-get install -y ruby ruby-dev
|
||||
RUN apt-get install -y python-all python-pip
|
||||
|
||||
RUN gem install fpm
|
||||
RUN gem install fpm package_cloud
|
||||
|
||||
RUN pip2 install virtualenv-tools
|
||||
RUN pip3 install virtualenv
|
||||
RUN pip3 install virtualenv virtualenv-tools3
|
||||
RUN virtualenv -p python3 /vdirsyncer/env/
|
||||
|
||||
# See https://github.com/jordansissel/fpm/issues/1106#issuecomment-461678970
|
||||
RUN pip3 uninstall -y virtualenv
|
||||
RUN echo 'python3 -m venv "$@"' > /usr/local/bin/virtualenv
|
||||
RUN chmod +x /usr/local/bin/virtualenv
|
||||
|
||||
COPY . /vdirsyncer/vdirsyncer/
|
||||
WORKDIR /vdirsyncer/vdirsyncer/
|
||||
RUN mkdir /vdirsyncer/pkgs/
|
||||
|
||||
RUN basename *.tar.gz .tar.gz | cut -d'-' -f2 | sed -e 's/\.dev/~/g' | tee version
|
||||
RUN (echo -n *.tar.gz; echo '[google]') | tee requirements.txt
|
||||
RUN . /vdirsyncer/env/bin/activate; fpm -s virtualenv -t deb \
|
||||
-n "vdirsyncer-latest" \
|
||||
-v "$(cat version)" \
|
||||
--prefix /opt/venvs/vdirsyncer-latest \
|
||||
requirements.txt
|
||||
RUN fpm --verbose \
|
||||
--input-type virtualenv \
|
||||
--output-type deb \
|
||||
--name "vdirsyncer-latest" \
|
||||
--version "$(cat version)" \
|
||||
--prefix /opt/venvs/vdirsyncer-latest \
|
||||
--depends python3 \
|
||||
requirements.txt
|
||||
|
||||
RUN mv /vdirsyncer/vdirsyncer/*.deb /vdirsyncer/pkgs/
|
||||
|
||||
WORKDIR /vdirsyncer/pkgs/
|
||||
RUN dpkg -i *.deb
|
||||
|
||||
# Check that it works:
|
||||
RUN LC_ALL=C.UTF-8 LANG=C.UTF-8 /opt/venvs/vdirsyncer-latest/bin/vdirsyncer --version
|
||||
|
|
|
|||
|
|
@ -1,19 +1,26 @@
|
|||
#!/bin/sh
|
||||
|
||||
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"
|
||||
DISTRO=$1
|
||||
DISTROVER=$2
|
||||
|
||||
NAME="vdirsyncer-${DISTRO}-${DISTROVER}:latest"
|
||||
CONTEXT="$(mktemp -d)"
|
||||
|
||||
python setup.py sdist -d "$CONTEXT"
|
||||
|
||||
# Build the package in a container with the right distro version.
|
||||
docker build \
|
||||
--build-arg distro=$distro \
|
||||
--build-arg distrover=$distrover \
|
||||
-t $name \
|
||||
"$context"
|
||||
--build-arg distro=$DISTRO \
|
||||
--build-arg distrover=$DISTROVER \
|
||||
-t $NAME \
|
||||
-f scripts/dpkg.Dockerfile \
|
||||
"$CONTEXT"
|
||||
|
||||
docker run $name tar -c -C /vdirsyncer pkgs | tar x -C "$context"
|
||||
package_cloud push pimutils/vdirsyncer/$distro/$distrover $context/pkgs/*.deb
|
||||
rm -rf "$context"
|
||||
# Push the package to packagecloud.
|
||||
# TODO: Use ~/.packagecloud for CI.
|
||||
docker run -e PACKAGECLOUD_TOKEN=$PACKAGECLOUD_TOKEN $NAME \
|
||||
bash -xec "package_cloud push pimutils/vdirsyncer/$DISTRO/$DISTROVER *.deb"
|
||||
|
||||
rm -rf "$CONTEXT"
|
||||
|
|
|
|||
Loading…
Reference in a new issue