summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThanos Doukoudakis <thanos.doukoudakis@isode.com>2019-01-19 15:19:08 (GMT)
committerThanos Doukoudakis <thanos.doukoudakis@isode.com>2019-02-28 13:32:43 (GMT)
commit68c789ed93624620348b32ec92490c9bfc537a25 (patch)
tree99191bbb8ea3ee9e077f04b63d7bc250955ddf3c /Swift/Packaging
parentf11ef30f7fe576723f71c2c6a9061ec7ef9472bd (diff)
downloadswift-68c789ed93624620348b32ec92490c9bfc537a25.zip
swift-68c789ed93624620348b32ec92490c9bfc537a25.tar.bz2
Create Debian packages using Docker
This patch will setup Docker containers to build the source and Debian packages. The script will use the private key under gpg-keys folder to sign the Debian packages. If the folder is not there or doesn’t exist then the build will fail. Keys are expected to be in .asc format, unencrypted and not password protected. Added .dockerignore file to avoid copying the cache files to the container. The output is stored in out/ folder and the folder structure is ready for update_debian_repo.sh script. SWIFT_PACKAGE_PLATFORMS defines the platforms that it will be build for. Default values are: ubuntu:bionic ubuntu:cosmic debian:stretch debian:sid. DOCKERRUNEXTRAFLAGS variable can set additional flags for Docker builders. Currently is set to --privileged to avoid an issue during build with Qt5.11.1 https://bugreports.qt.io/browse/QTBUG-64490. Updated the Debian repo scripts to new distributions and Docker changes. Test-Information: Run the script and created source & binaries for all the distributions. Verified that changelog, compact, control, copyright, rules and source/format exist under the Debian folder when building the Debian package. Created tags and generated dev builds, rc builds, and release builds to test the output of the different release channels. Created a container, tested the Swift and Swiften packages, and the installations: Tested the following debs with piuparts in a docker container of the system they are build for. No errors raised and a few warnings related with chroot (which fails within a docker container) *libswiften-dev-dbgsym*.deb, *libswiften-dev_*.deb *libswiften5-dbgsym_*.deb *libswiften5_*.deb *swift-im-dbgsym_*.deb *swift-im_*.deb Installed the above packages and verified the install with swift-im –version, headers exist in /usr/include/Swiften/ and libSwiften.so under /usr/lib/. Verified the gpg signatures on the .changes and .buildinfo files. Tested the output with the update_debian_repo.sh and the import was successful. Verified the .changes and .buildinfo files with lintion which reported the following errors and warnings (there are differences between different channels release, beta, development): E: swift-im changes: bad-distribution-in-changes-file development E: swift-im changes: multiple-distributions-in-changes-file beta development W: libswiften5: new-package-should-close-itp-bug W: libswiften-dev: new-package-should-close-itp-bug W: swift-im: new-package-should-close-itp-bug Tested that the man page exists after installing in a docker container (ubuntu xenial, debian stetch, debian sid). Change-Id: Ic28d2731bbca34716645e76e7e7e7e8183dea4f8
Diffstat (limited to 'Swift/Packaging')
-rw-r--r--Swift/Packaging/Debian/.dockerignore1
-rw-r--r--Swift/Packaging/Debian/.gitignore4
-rw-r--r--Swift/Packaging/Debian/Dockerfile.package.in23
-rw-r--r--Swift/Packaging/Debian/Dockerfile.source17
-rwxr-xr-xSwift/Packaging/Debian/package_docker.sh70
-rw-r--r--Swift/Packaging/Debian/update_debian_repo.sh8
6 files changed, 119 insertions, 4 deletions
diff --git a/Swift/Packaging/Debian/.dockerignore b/Swift/Packaging/Debian/.dockerignore
new file mode 100644
index 0000000..5d238e7
--- /dev/null
+++ b/Swift/Packaging/Debian/.dockerignore
@@ -0,0 +1 @@
**/out
diff --git a/Swift/Packaging/Debian/.gitignore b/Swift/Packaging/Debian/.gitignore
index 5401ae0..9c8f275 100644
--- a/Swift/Packaging/Debian/.gitignore
+++ b/Swift/Packaging/Debian/.gitignore
@@ -1,3 +1,7 @@
1/swift-* 1/swift-*
2/swift_* 2/swift_*
3/libswiften* 3/libswiften*
4/out/
5/swift-src/
6swift-im*.orig.tar.gz
7*.tmp.package
diff --git a/Swift/Packaging/Debian/Dockerfile.package.in b/Swift/Packaging/Debian/Dockerfile.package.in
new file mode 100644
index 0000000..071e475
--- /dev/null
+++ b/Swift/Packaging/Debian/Dockerfile.package.in
@@ -0,0 +1,23 @@
1FROM __DISTRO__
2MAINTAINER packages@swift.im
3
4ENV DEBIAN_VERSION=__DEBIAN_VERSION__
5
6RUN \
7 apt-get -qq update && \
8 apt-get install -y lintian devscripts scons build-essential dh-make pkg-config libssl-dev qt5-default libqt5x11extras5-dev libqt5webkit5-dev qtmultimedia5-dev qttools5-dev-tools qt5-image-formats-plugins libqt5svg5-dev libminiupnpc-dev libnatpmp-dev libhunspell-dev libxml2-dev libxss-dev libboost-dev libboost-filesystem-dev libboost-program-options-dev libboost-regex-dev libboost-signals-dev libboost-system-dev libboost-thread-dev libboost-date-time-dev libidn11-dev docbook-xsl docbook-xml xsltproc libxml2-utils libsqlite3-dev zlib1g-dev help2man && \
9 apt-get clean
10
11RUN mkdir /swift-packages
12COPY * /swift-packages/
13
14CMD \
15 gpg --allow-secret-key-import --import /gpg-keys/*.asc && \
16 cd /swift-packages && \
17 tar xf swift-im_${DEBIAN_VERSION}*.orig.tar.gz && \
18 tar xf swift-im_${DEBIAN_VERSION}*.debian.tar.xz -C /swift-packages/swift-im-${DEBIAN_VERSION}/ && \
19 cd swift-im-${DEBIAN_VERSION} && \
20 debuild -i -I -b --lintian-opts --profile debian --pedantic && \
21 cd /swift-packages/ && \
22 rm -rf /swift-packages/swift-im-${DEBIAN_VERSION}/ && \
23 mv * /out/
diff --git a/Swift/Packaging/Debian/Dockerfile.source b/Swift/Packaging/Debian/Dockerfile.source
new file mode 100644
index 0000000..3c23b2c
--- /dev/null
+++ b/Swift/Packaging/Debian/Dockerfile.source
@@ -0,0 +1,17 @@
1FROM debian:stretch
2VOLUME ["/gpg-keys"]
3MAINTAINER packages@swift.im
4
5RUN \
6 apt-get -qq update && \
7 apt-get install -y lintian devscripts scons build-essential pkg-config libssl-dev qt5-default libqt5x11extras5-dev libqt5webkit5-dev qtmultimedia5-dev qttools5-dev-tools qt5-image-formats-plugins libqt5svg5-dev libminiupnpc-dev libnatpmp-dev libhunspell-dev libxml2-dev libxss-dev libboost-dev libboost-filesystem-dev libboost-program-options-dev libboost-regex-dev libboost-signals-dev libboost-system-dev libboost-thread-dev libboost-date-time-dev libidn11-dev docbook-xsl docbook-xml xsltproc libxml2-utils libsqlite3-dev zlib1g-dev help2man && \
8 apt-get clean
9
10COPY swift-src /swift-src
11
12CMD \
13 gpg --allow-secret-key-import --import /gpg-keys/*.asc && \
14 cd /swift-src && \
15 mv swift-im_*.orig.tar.gz ../ && \
16 debuild -i -I -S --lintian-opts --pedantic && \
17 mv /swift-im* /out/
diff --git a/Swift/Packaging/Debian/package_docker.sh b/Swift/Packaging/Debian/package_docker.sh
new file mode 100755
index 0000000..7fd1a3e
--- /dev/null
+++ b/Swift/Packaging/Debian/package_docker.sh
@@ -0,0 +1,70 @@
1#!/bin/bash
2
3set -e
4
5cd $(dirname $(readlink -f $0 || realpath $0))
6export PYTHONPATH=../../../BuildTools/SCons
7VERSION=${VERSION:=`../../../BuildTools/GetBuildVersion.py swift`}
8DEBIAN_VERSION=`../../../BuildTools/DebianizeVersion.py $VERSION`
9SWIFTEN_SOVERSION=`../../../BuildTools/GetBuildVersion.py swift --major`
10SWIFT_SOURCE_DIR=swift-im-$DEBIAN_VERSION
11TARBALLBARE="swift-im_$DEBIAN_VERSION.orig.tar.gz"
12TARBALL="${SHARED_DIR}${TARBALLBARE}"
13# DEVATTN there is an issue with some versions of Qt(5.11.1) and docker see https://bugreports.qt.io/browse/QTBUG-64490. Workaround is to add privileged flag
14if [ -z ${DOCKERRUNEXTRAFLAGS+x} ];
15then
16 DOCKERRUNEXTRAFLAGS="--privileged"
17fi
18
19rm -rf $SWIFT_SOURCE_DIR
20git clone ../../../.git $SWIFT_SOURCE_DIR
21
22rm -rf $SWIFT_SOURCE_DIR/.git
23find $SWIFT_SOURCE_DIR -name .gitignore | xargs rm -f
24find $SWIFT_SOURCE_DIR/3rdParty -type f | grep -v uuid | grep -v SConscript | grep -v miniupnp | grep -v natpmp || xargs rm -f
25find $SWIFT_SOURCE_DIR/3rdParty -depth -empty -type d -exec rmdir {} \;
26rm -rf $SWIFT_SOURCE_DIR/3rdParty/SCons
27rm -rf $SWIFT_SOURCE_DIR/Swift/Packaging/Debian
28rm -rf $SWIFT_SOURCE_DIR/BuildTools/DocBook/Fonts
29rm -rf $SWIFT_SOURCE_DIR/BuildTools/Git/Hooks/commit-msg
30echo $VERSION > $SWIFT_SOURCE_DIR/VERSION.swift
31
32tar czf $TARBALLBARE $SWIFT_SOURCE_DIR
33cp $TARBALLBARE $SWIFT_SOURCE_DIR
34
35cp -r debian $SWIFT_SOURCE_DIR/debian
36../../../BuildTools/UpdateDebianChangelog.py $SWIFT_SOURCE_DIR/debian/changelog $DEBIAN_VERSION
37
38cat $SWIFT_SOURCE_DIR/debian/control.in | sed -e "s/%SWIFTEN_SOVERSION%/$SWIFTEN_SOVERSION/g" | sed -e "s/%WEBKIT_DEPENDENCY%/$WEBKIT_DEPENDENCY/g" > $SWIFT_SOURCE_DIR/debian/control
39rm $SWIFT_SOURCE_DIR/debian/control.in
40mv $SWIFT_SOURCE_DIR/debian/libswiften.install $SWIFT_SOURCE_DIR/debian/libswiften$SWIFTEN_SOVERSION.install
41cat ../../../COPYING.thirdparty | tail -n +3 >> $SWIFT_SOURCE_DIR/debian/copyright
42
43rm -rf swift-src
44mv $SWIFT_SOURCE_DIR swift-src
45docker build -t swift/swiftsourcebuilder -f Dockerfile.source .
46mkdir -p out/source
47docker run --rm -v`pwd`/gpg-keys:/gpg-keys -v`pwd`/out/source:/out swift/swiftsourcebuilder
48
49TMP_DOCKERFILE=Dockerfile.tmp.package
50
51if [ -z ${SWIFT_PACKAGE_PLATFORMS+x} ];
52then
53 platformsarray=( ubuntu:bionic ubuntu:cosmic debian:stretch debian:sid )
54else
55 platformsarray=( $SWIFT_PACKAGE_PLATFORMS )
56fi
57
58for distro in "${platformsarray[@]}";
59do
60 if [ -f $TMP_DOCKERFILE ];
61 then
62 rm $TMP_DOCKERFILE
63 fi
64 cat Dockerfile.package.in | sed -e "s/__DISTRO__/$distro/" -e "s/__DEBIAN_VERSION__/$DEBIAN_VERSION/" > $TMP_DOCKERFILE
65 docker build -t swift/packager -f $TMP_DOCKERFILE out/source
66 OUT_DIR="out/${distro//\://}"
67 echo $OUT_DIR
68 mkdir -p $OUT_DIR
69 docker run --rm $DOCKERRUNEXTRAFLAGS -v`pwd`/gpg-keys:/gpg-keys -v`pwd`/$OUT_DIR:/out swift/packager
70done
diff --git a/Swift/Packaging/Debian/update_debian_repo.sh b/Swift/Packaging/Debian/update_debian_repo.sh
index b057103..fc736ed 100644
--- a/Swift/Packaging/Debian/update_debian_repo.sh
+++ b/Swift/Packaging/Debian/update_debian_repo.sh
@@ -74,7 +74,7 @@ command -v reprepro >/dev/null 2>&1 || { echo >&2 "This script requires aptly bu
74mkdir -p $APT_REPO_ROOT 74mkdir -p $APT_REPO_ROOT
75 75
76if [ -z ${SWIFT_PACKAGE_PLATFORMS+x} ]; then 76if [ -z ${SWIFT_PACKAGE_PLATFORMS+x} ]; then
77 platformsarray=( xenial artful jessie stretch sid ) 77 platformsarray=( bionic cosmic stretch sid )
78else 78else
79 platformsarray=( $SWIFT_PACKAGE_PLATFORMS ) 79 platformsarray=( $SWIFT_PACKAGE_PLATFORMS )
80fi 80fi
@@ -85,13 +85,13 @@ for full_distribution_path in $INCOMING_FOLDER/{debian,ubuntu}/*; do
85 distro_name=$(basename `dirname $full_distribution_path`) 85 distro_name=$(basename `dirname $full_distribution_path`)
86 distro_reprepro_root=${APT_REPO_ROOT}/${distro_name}/${distro_version} 86 distro_reprepro_root=${APT_REPO_ROOT}/${distro_name}/${distro_version}
87 87
88 if ! [[ $SWIFT_PACKAGE_PLATFORMS == *"$distro_version"* ]]; then 88 if ! [[ ${platformsarray[@]} == *"$distro_version"* ]]; then
89 echo "$distro_version was not found in SWIFT_PACKAGE_PLATFORMS. Skipping..." 89 echo "$distro_version was not found in SWIFT_PACKAGE_PLATFORMS. Skipping..."
90 continue 90 continue
91 fi 91 fi
92 92
93 # ensure reprepro diretctory for this distribution version is present 93 # ensure reprepro directory for this distribution version is present
94 if [ ! -d "$distro_preprepro_root" ]; then 94 if [ ! -d "$distro_reprepro_root" ]; then
95 echo "Create distribution repository for $distro_name/$distro_version" 95 echo "Create distribution repository for $distro_name/$distro_version"
96 mkdir -p $distro_reprepro_root 96 mkdir -p $distro_reprepro_root
97 mkdir -p ${distro_reprepro_root}/conf 97 mkdir -p ${distro_reprepro_root}/conf