Streamline packaging with docker

We get rid of the build_env.sh script that need to be changed after
each release.

This commit also:
- remove unecessary files when packaging (.tox etc...)
- fix CentOS Dockerfile to get the OpenStack repo

Change-Id: Idd8c4004e2ddca33fb779c13a895e2e0afdb9651
This commit is contained in:
Vincent Llorens 2016-09-08 15:01:45 +02:00
parent 4771a6e490
commit 0e70c4636e
5 changed files with 26 additions and 16 deletions

View File

@ -31,17 +31,13 @@ inside the synergy-service directory.
docker build -t synergy-centos7-builder .
- edit the file `synergy-service/packaging/docker/build_env.sh` to define environment variables.
- launch the container
docker run -i -v /path/to/synergy-service:/tmp/synergy-service \
--env-file=/path/to/synergy-service/packaging/docker/build_env.sh \
synergy-centos7-builder
This actually mount the synergy-service directory to `/tmp/synergy-service` on
the guest.
It also loads environment variables from the `build_env.sh` file.
- the resulting rpm should be in the build directory if successful
@ -56,12 +52,10 @@ inside the synergy-service directory.
docker build -t synergy-ubuntu14.04-builder .
- edit the file `synergy-service/packaging/docker/build_env.sh` to define environment variables.
- launch the container
docker run -i -v /path/to/synergy-service:/tmp/synergy-service \
--env-file=/path/to/synergy-service/packaging/docker/build_env.sh \
synergy-ubuntu14.04-builder
- the resulting deb should be in the build directory if successful

View File

@ -1 +0,0 @@
PKG_VERSION=1.0.1

View File

@ -1,6 +1,6 @@
FROM centos:7
MAINTAINER Vincent Llorens <vincent.llorens@cc.in2p3.fr>
RUN yum install -y https://repos.fedorapeople.org/repos/openstack/openstack-liberty/rdo-release-liberty-3.noarch.rpm \
RUN yum install -y centos-release-openstack-liberty \
rpm-build \
python-devel \
python-setuptools \

View File

@ -4,11 +4,16 @@ set -e -x
RPMBUILD=/home/pkger/rpmbuild
PKG_DIR=/tmp/synergy-service
function get_version() {
local file=$PKG_DIR/setup.cfg
export PKG_VERSION=$(grep -e "version = " $file | sed -r "s/version = ()/\1/")
}
function setup() {
mkdir -p /home/pkger/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
cd $RPMBUILD/SOURCES/
cp -r $PKG_DIR python-synergy-service-$PKG_VERSION
rm -r python-synergy-service-$PKG_VERSION/build || true
rm -r python-synergy-service-$PKG_VERSION/{.tox,.testrepository,build,dist} || true
tar cjf python-synergy-service-${PKG_VERSION}.tar.bz2 python-synergy-service-$PKG_VERSION
cp $PKG_DIR/packaging/rpm/python-synergy.spec $RPMBUILD/SPECS/python-synergy.spec
}
@ -25,6 +30,7 @@ function clean() {
rm -rf $RPMBUILD
}
clean
clean || true
get_version
setup
build

View File

@ -3,12 +3,21 @@ set -e -x
PKG_DIR=/tmp/synergy-service
function copy_source() {
cd /home/pkger
cp -r $PKG_DIR python-synergy-service
rm -r python-synergy-service/{.tox,.testrepository,build,dist} || true
}
function get_version() {
local file=/home/pkger/python-synergy-service/setup.cfg
export PKG_VERSION=$(grep -e "version = " $file | sed -r "s/version = ()/\1/")
}
function setup() {
cd /home/pkger
cp -r $PKG_DIR synergy-service
tar cfz python-synergy-service_${PKG_VERSION}.orig.tar.gz synergy-service
mv synergy-service python-synergy-service
cp -r python-synergy-service/packaging/debian python-synergy-service/debian
tar cjf python-synergy-service_${PKG_VERSION}.orig.tar.bz2 python-synergy-service
mv python-synergy-service/packaging/debian python-synergy-service/debian
}
function build() {
@ -19,9 +28,11 @@ function build() {
}
function clean() {
rm -r /home/pkger/python-synergy-service*
rm -r /home/pkger/python-synergy-service{,_${PKG_VERSION}.orig.tar.bz2}
}
clean || true
copy_source
get_version
setup
build
clean