diff --git a/packaging/README.md b/packaging/README.md index 3a6aadf..d393fff 100644 --- a/packaging/README.md +++ b/packaging/README.md @@ -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 diff --git a/packaging/docker/build_env.sh b/packaging/docker/build_env.sh deleted file mode 100644 index debab0b..0000000 --- a/packaging/docker/build_env.sh +++ /dev/null @@ -1 +0,0 @@ -PKG_VERSION=1.0.1 diff --git a/packaging/docker/centos7/Dockerfile b/packaging/docker/centos7/Dockerfile index 14dee62..f8cdedc 100644 --- a/packaging/docker/centos7/Dockerfile +++ b/packaging/docker/centos7/Dockerfile @@ -1,6 +1,6 @@ FROM centos:7 MAINTAINER Vincent Llorens -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 \ diff --git a/packaging/docker/centos7/build.sh b/packaging/docker/centos7/build.sh index f85d9d4..94f4ed8 100644 --- a/packaging/docker/centos7/build.sh +++ b/packaging/docker/centos7/build.sh @@ -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 diff --git a/packaging/docker/ubuntu-14.04/build.sh b/packaging/docker/ubuntu-14.04/build.sh index df1b17b..eaf590d 100644 --- a/packaging/docker/ubuntu-14.04/build.sh +++ b/packaging/docker/ubuntu-14.04/build.sh @@ -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