mirror of
https://github.com/samsonjs/vdirsyncer.git
synced 2026-04-27 14:57:41 +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
|
FROM $distro:$distrover
|
||||||
|
|
||||||
ARG distro
|
|
||||||
ARG distrover
|
|
||||||
|
|
||||||
RUN apt-get update
|
RUN apt-get update
|
||||||
RUN apt-get install -y build-essential fakeroot debhelper git
|
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 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 virtualenv-tools3
|
||||||
RUN pip3 install virtualenv
|
|
||||||
RUN virtualenv -p python3 /vdirsyncer/env/
|
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/
|
COPY . /vdirsyncer/vdirsyncer/
|
||||||
WORKDIR /vdirsyncer/vdirsyncer/
|
WORKDIR /vdirsyncer/vdirsyncer/
|
||||||
RUN mkdir /vdirsyncer/pkgs/
|
RUN mkdir /vdirsyncer/pkgs/
|
||||||
|
|
||||||
RUN basename *.tar.gz .tar.gz | cut -d'-' -f2 | sed -e 's/\.dev/~/g' | tee version
|
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 (echo -n *.tar.gz; echo '[google]') | tee requirements.txt
|
||||||
RUN . /vdirsyncer/env/bin/activate; fpm -s virtualenv -t deb \
|
RUN fpm --verbose \
|
||||||
-n "vdirsyncer-latest" \
|
--input-type virtualenv \
|
||||||
-v "$(cat version)" \
|
--output-type deb \
|
||||||
|
--name "vdirsyncer-latest" \
|
||||||
|
--version "$(cat version)" \
|
||||||
--prefix /opt/venvs/vdirsyncer-latest \
|
--prefix /opt/venvs/vdirsyncer-latest \
|
||||||
|
--depends python3 \
|
||||||
requirements.txt
|
requirements.txt
|
||||||
|
|
||||||
RUN mv /vdirsyncer/vdirsyncer/*.deb /vdirsyncer/pkgs/
|
RUN mv /vdirsyncer/vdirsyncer/*.deb /vdirsyncer/pkgs/
|
||||||
|
|
||||||
WORKDIR /vdirsyncer/pkgs/
|
WORKDIR /vdirsyncer/pkgs/
|
||||||
RUN dpkg -i *.deb
|
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
|
RUN LC_ALL=C.UTF-8 LANG=C.UTF-8 /opt/venvs/vdirsyncer-latest/bin/vdirsyncer --version
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,26 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
set -xe
|
set -xe
|
||||||
distro=$1
|
|
||||||
distrover=$2
|
|
||||||
name=vdirsyncer-$distro-$distrover:latest
|
|
||||||
context="$(mktemp -d)"
|
|
||||||
|
|
||||||
python setup.py sdist -d "$context"
|
DISTRO=$1
|
||||||
cp scripts/dpkg.Dockerfile "$context/Dockerfile"
|
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 \
|
docker build \
|
||||||
--build-arg distro=$distro \
|
--build-arg distro=$DISTRO \
|
||||||
--build-arg distrover=$distrover \
|
--build-arg distrover=$DISTROVER \
|
||||||
-t $name \
|
-t $NAME \
|
||||||
"$context"
|
-f scripts/dpkg.Dockerfile \
|
||||||
|
"$CONTEXT"
|
||||||
|
|
||||||
docker run $name tar -c -C /vdirsyncer pkgs | tar x -C "$context"
|
# Push the package to packagecloud.
|
||||||
package_cloud push pimutils/vdirsyncer/$distro/$distrover $context/pkgs/*.deb
|
# TODO: Use ~/.packagecloud for CI.
|
||||||
rm -rf "$context"
|
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