Skip to content
Snippets Groups Projects
Unverified Commit f89d706d authored by aviau's avatar aviau
Browse files

Add Debian and Ubuntu packaging

This moves the official Debian packaging into ring-project. Jenkins
should now be able to run packaging jobs and publish packages. It
should also make it easy to add a `verify` check on Jenkins to test
packaging patches.

This will make it much easier to work on packaging issues because the
build environment is now reproductible on any machine.

The patch adds Makefile targets to create packages such as:
 - package-all
 - package-<DISTRO>

Builds are all done inside Docker containers and it is possible to
build many at a time with the `package-all` target.

To debug a build, use `package-<DISTRO>-interactive` to obtain a shell
inside a container, ready to launch a build.

Tuleap: #781
Change-Id: Id87a74a6c412ffc5bf82b9562639ce5a9424b06a
parent 81e420a4
No related branches found
No related tags found
No related merge requests found
Showing with 1155 additions and 0 deletions
Source: ring
Section: comm
Priority: extra
Maintainer: Alexandre Viau <aviau@debian.org>
Build-Depends: debhelper (>= 9),
autoconf,
automake,
cmake,
libtool,
# gnome client
libebook1.2-dev,
libclutter-gtk-1.0-dev,
libclutter-1.0-dev,
libglib2.0-dev,
libgtk-3-dev,
libnotify-dev,
qtbase5-dev,
qttools5-dev,
qttools5-dev-tools,
unbound-anchor,
git-core,
gnome-icon-theme-symbolic,
gettext,
libqrencode-dev,
libappindicator-dev,
# ring-daemon
libdbus-1-dev,
libdbus-c++-dev,
libupnp-dev,
libgnutls28-dev,
yasm,
autotools-dev,
libpulse-dev,
libasound2-dev,
libexpat1-dev,
libpcre3-dev,
libyaml-cpp-dev,
libboost-dev,
libsndfile1-dev,
libsrtp-dev,
libxext-dev,
libxfixes-dev,
autopoint,
libspeex-dev,
libspeexdsp-dev,
chrpath,
uuid-dev,
libavcodec-dev,
libavutil-dev,
libavformat-dev,
libswscale-dev,
libavdevice-dev,
libopus-dev,
libudev-dev,
libticonv-dev,
libgsm1-dev,
libjsoncpp-dev,
libnatpmp-dev
Standards-Version: 3.9.8
Homepage: https://ring.cx
Vcs-Git: https://anonscm.debian.org/git/pkg-voip/ring.git
Vcs-Browser: https://anonscm.debian.org/cgit/pkg-voip/ring.git
Package: ring
Architecture: any
Depends: ${shlibs:Depends},
${misc:Depends},
ring-daemon (=${binary:Version})
Description: Secure and distributed voice, video and chat platform - desktop client
Ring (ring.cx) is a secure and distributed voice, video and chat communication
platform that requires no centralized server and leaves the power of privacy
in the hands of the user.
.
This package contains the desktop client: gnome-ring.
Package: ring-daemon
Architecture: any
Depends: ${shlibs:Depends},
${misc:Depends}
Description: Secure and distributed voice, video and chat platform - daemon
Ring (ring.cx) is a secure and distributed voice, video and chat communication
platform that requires no centralized server and leaves the power of privacy
in the hands of the user.
.
This package contains the Ring daemon: dring.
This diff is collapsed.
[DEFAULT]
pristine-tar = True
Description: Assume gsm is installed to avoid internet access
Origin: vendor
Author: Alexandre Viau <aviau@debian.org>
Reviewed-by: Alexandre Viau <aviau@debian.org>
Last-Update: 2016-04-22
--- a/daemon/contrib/src/gsm/rules.mak
+++ b/daemon/contrib/src/gsm/rules.mak
@@ -4,6 +4,8 @@
PKGS += gsm
+PKGS_FOUND += gsm
+
$(TARBALLS)/libgsm_$(GSM_VERSION).tar.gz:
$(call download,$(GSM_URL))
check-for-gsm.patch
daemon/dring.1
# We are shipping a .so, but this isn't a library package
package-name-doesnt-match-sonames
no-symbols-control-file
client-gnome/doc/gnome-ring.1
activate-noawait ldconfig
#!/usr/bin/make -f
# -*- makefile -*-
# Hardening
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk
# Number of CPUS
NO_CPUS=$(shell nproc)
ifeq ($(NO_CPUS),0)
NO_CPUS=1
endif
%:
dh $@
override_dh_auto_configure:
###############################################
## Re-create tarballs from tarballs-unpacked ##
###############################################
mkdir -p daemon/contrib/tarballs
# Create tarballs
for i in $(CURDIR)/daemon/contrib/tarballs-unpacked/*; do \
projectname=`basename $$i` && \
cd $$i && tar -caf ../../tarballs/$$projectname * && \
echo "Repacked $$projectname"; \
done
# Prevent bootstrap script from verifying checksums
mkdir -p daemon/contrib/native
touch daemon/contrib/native/.sum-msgpack
touch daemon/contrib/native/.sum-opendht
touch daemon/contrib/native/.sum-pjproject
###########################
## Ring Daemon configure ##
###########################
mkdir -p daemon/contrib/native
cd daemon/contrib/native && \
../bootstrap \
--disable-ogg \
--disable-flac \
--disable-vorbis \
--disable-vorbisenc \
--disable-speex \
--disable-sndfile \
--disable-speexdsp && \
make list && \
make -j1
cd daemon && \
./autogen.sh && \
./configure \
--prefix=/usr \
--without-iax
#############################
## libringclient configure ##
#############################
cd lrc && \
mkdir build && \
cd build && \
cmake \
-DRING_BUILD_DIR=$(CURDIR)/daemon/src \
-DCMAKE_INSTALL_PREFIX=/usr \
-DENABLE_VIDEO=true \
..
############################
## gnome client configure ##
############################
cd client-gnome && \
mkdir build && \
cd build && \
cmake \
-DCMAKE_INSTALL_PREFIX=/usr \
-DLibRingClient_PROJECT_DIR=/$(CURDIR)/lrc \
..
dh_auto_configure
override_dh_auto_build:
#######################
## Ring Daemon build ##
#######################
cd daemon && make -j$(NO_CPUS)
pod2man daemon/man/dring.pod > daemon/dring.1
#########################
## libringclient build ##
#########################
cd lrc/build && make -j$(NO_CPUS)
########################
## gnome client build ##
########################
cd client-gnome/build && make LDFLAGS="-lpthread" -j$(NO_CPUS)
override_dh_auto_clean:
################################
## Generated contrib tarballs ##
################################
rm -rfv daemon/contrib/tarballs
#######################
## Ring Daemon clean ##
#######################
if [ -d daemon/contrib/native ]; then cd daemon/contrib/native && make distclean; fi
rm -rfv daemon/contrib/native
rm -rfv daemon/dring.1
#########################
## libringclient clean ##
#########################
if [ -d lrc/build ]; then cd lrc/build && make distclean; fi
rm -rfv lrc/build
########################
## gnome client clean ##
########################
if [ -d client-gnome/build ]; then cd client-gnome/build && make distclean; fi
rm -rfv client-gnome/build
override_dh_auto_install:
#########################
## Ring Daemon install ##
#########################
cd daemon && make DESTDIR=$(CURDIR)/debian/ring-daemon install
rm -rfv $(CURDIR)/debian/ring-daemon/usr/include
rm -rfv $(CURDIR)/debian/ring-daemon/usr/lib
###########################
## libringclient install ##
###########################
cd lrc/build && make DESTDIR=$(CURDIR)/debian/ring install
rm -rfv $(CURDIR)/debian/ring/usr/include
# This is a symlink, should be in -dev package
rm -v $(CURDIR)/debian/ring/usr/lib/libringclient.so
# cmake files
rm -rfv $(CURDIR)/debian/ring/usr/lib/cmake
##########################
## gnome client install ##
##########################
cd client-gnome/build && make DESTDIR=$(CURDIR)/debian/ring install
# Remove ring binary: it is not needed for now
rm $(CURDIR)/debian/ring/usr/bin/ring.cx
tmpdir:= $(shell mktemp -d)
workdir:= $(shell pwd)
PKD := $(abspath $(dir $(MAKEFILE_LIST)))
version_to_download := $(shell dpkg-parsechangelog -ldebian/changelog | perl -ne 'print $$1 if m{^Version:\s+(?:\d+:)?(\d.*)(?:\~dfsg.+)(?:\-\d+.*)};')
# Repacks the tarball with contrib tarballs unpacked.
get-orig-source:
# Download ring tarball
if [ -n "$$GET_ORIG_SOURCE_OVERRIDE_USCAN_TARBALL" ]; then \
mv $$GET_ORIG_SOURCE_OVERRIDE_USCAN_TARBALL ${tmpdir}; \
else \
uscan --rename --destdir=${tmpdir} --download-version ${version_to_download} ;\
fi
# Unpack ring tarball
tar -C ${tmpdir} -xf ${tmpdir}/*.tar.gz
# Remove original tarball
rm ${tmpdir}/*.tar.gz
# Unpack all of the orig tarballs into tarballs-unpacked
mkdir ${tmpdir}/ring-project/daemon/contrib/tarballs-unpacked
for i in `find ${tmpdir}/ring-project/daemon/contrib/tarballs/ -name "*.tar.*"`; do \
projectname=`basename $$i` && \
mkdir ${tmpdir}/ring-project/daemon/contrib/tarballs-unpacked/$$projectname && \
tar -C ${tmpdir}/ring-project/daemon/contrib/tarballs-unpacked/$$projectname -xf $$i && \
echo "Unpacked $$projectname"; \
done
###################
## Exclude files ##
###################
# This does not exclude everything that we need to exclude.
# debian/copyright's File-Excluded section also excludes files.
## pjproject
rm -rf ${tmpdir}/ring-project/daemon/contrib/tarballs-unpacked/pjproject-*/pjproject-*/third_party/g7221 # non-distributable (requires a license from Polycom)
rm -rf ${tmpdir}/ring-project/daemon/contrib/tarballs-unpacked/pjproject-*/pjproject-*/third_party/ilbc # non distributable (the version included with pjproject)
rm -rf ${tmpdir}/ring-project/daemon/contrib/tarballs-unpacked/pjproject-*/pjproject-*/third_party/milenage # non distributable
rm -rf ${tmpdir}/ring-project/daemon/contrib/tarballs-unpacked/pjproject-*/pjproject-*/third_party/BaseClasses # non distributable (?)
rm -rf ${tmpdir}/ring-project/daemon/contrib/tarballs-unpacked/pjproject-*/pjproject-*/third_party/portaudio # not needed
rm -rf ${tmpdir}/ring-project/daemon/contrib/tarballs-unpacked/pjproject-*/pjproject-*/third_party/speex # not needed
rm -rf ${tmpdir}/ring-project/daemon/contrib/tarballs-unpacked/pjproject-*/pjproject-*/third_party/mp3 # not needed
rm -rf ${tmpdir}/ring-project/daemon/contrib/tarballs-unpacked/pjproject-*/pjproject-*/third_party/gsm # not needed
rm -rf ${tmpdir}/ring-project/daemon/contrib/tarballs-unpacked/pjproject-*/pjproject-*/third_party/bdsound # not needed
#rm -rf ${tmpdir}/ring-project/daemon/contrib/tarballs-unpacked/pjproject-*/pjproject-*/third_party/srtp # not needed
rm -f ${tmpdir}/ring-project/daemon/contrib/tarballs-unpacked/pjproject-*/pjproject-*/pjmedia/src/pjmedia-audiodev/s60_g729_bitstream.h # non distributable
rm -rf ${tmpdir}/ring-project/daemon/contrib/tarballs-unpacked/pjproject-*/pjproject-*/build/vs # not needed, VisualStudio files.
# Remove all contrib tarballs
rm -rf ${tmpdir}/ring-project/daemon/contrib/tarballs
# Create the new tarball
cd ${tmpdir} && tar -czf ${workdir}/ring_${version_to_download}~dfsg1.orig.tar.gz ring-project
# Clear the temp dir
rm -rf ${tmpdir}
3.0 (quilt)
version=3
opts=dversionmangle=s/\~dfsg\d*$// \
https://dl.ring.cx/ring-release/tarballs/ ring_(\d\S*)\.tar\.gz
#!/usr/bin/env bash
#
# Copyright (C) 2016 Savoir-faire Linux Inc.
#
# Author: Alexandre Viau <alexandre.viau@savoirfairelinux.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# This script is used in the packaging containers to build packages on
# debian-based distros.
#
set -e
cp -r /opt/ring-project-ro /opt/ring-project
cd /opt/ring-project
# import the debian folder and override files if needed
cp -r packaging/rules/debian .
if [ -z "${DEBIAN_PACKAGING_OVERRIDE}" ]; then
echo "DEBIAN_PACKAGING_OVERRIDE not set."
else
cp -r ${DEBIAN_PACKAGING_OVERRIDE}/* debian/
fi
# install build deps
apt-get update
apt-get upgrade -y
mk-build-deps --remove --install debian/control -t "apt-get -y --no-install-recommends"
# create changelog file
dch --create --package ring --newversion ${DEBIAN_VERSION} "Automatic nightly release"
dch --release --distribution "unstable" debian/changelog
# create orig tarball
mk-origtargz ${RELEASE_TARBALL_FILENAME}
rm --verbose ${RELEASE_TARBALL_FILENAME}
GET_ORIG_SOURCE_OVERRIDE_USCAN_TARBALL=$(realpath ../ring_*.orig.tar.gz) debian/rules get-orig-source
# move the tarball to the work directory
mkdir -p /opt/ring-packaging
mv ring_*.orig.tar.gz /opt/ring-packaging
# move to work directory
cd /opt/ring-packaging
# unpack the orig tarball
tar -xvf /opt/ring-packaging/ring_*.orig.tar.gz
# move to ring-project dir
cd ring-project
# import debian folder into ring-packaging directory
cp --verbose -r /opt/ring-project/debian .
# create the package
dpkg-buildpackage -uc -us
# move the artifacts to output
cd ..
mv *.orig.tar* *.debian.tar* *deb *changes *dsc /opt/output
chown -R ${CURRENT_UID}:${CURRENT_UID} /opt/output
#!/usr/bin/env python3
#
# Copyright (C) 2016 Savoir-faire Linux Inc.
#
# Author: Alexandre Viau <alexandre.viau@savoirfairelinux.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Creates packaging targets for a distribution and architecture.
# This helps reduce the lenght of the top Makefile.
#
import argparse
target_template = """\
##
## Distro: %(distribution)s
##
PACKAGE_%(distribution)s_DOCKER_RUN_COMMAND:= docker run \\
--rm \\
-e RELEASE_VERSION=$(RELEASE_VERSION) \\
-e RELEASE_TARBALL_FILENAME=$(RELEASE_TARBALL_FILENAME) \\
-e DEBIAN_VERSION=$(DEBIAN_VERSION) \\
-e DEBIAN_PACKAGING_OVERRIDE=%(debian_packaging_override)s \\
-e CURRENT_UID=$(CURRENT_UID) \\
-v $(CURDIR):/opt/ring-project-ro:ro \\
-v $(CURDIR)/packages/%(distribution)s:/opt/output \\
-i \\
-t ring-packaging-%(distribution)s
.docker-image-%(distribution)s: docker/Dockerfile_%(distribution)s
docker build \\
-t ring-packaging-%(distribution)s \\
-f docker/Dockerfile_%(distribution)s \\
$(CURDIR)
touch .docker-image-%(distribution)s
packages/%(distribution)s:
mkdir -p packages/%(distribution)s
packages/%(distribution)s/$(DEBIAN_DSC_FILENAME): $(RELEASE_TARBALL_FILENAME) packages/%(distribution)s .docker-image-%(distribution)s
$(PACKAGE_%(distribution)s_DOCKER_RUN_COMMAND)
touch packages/%(distribution)s/*
.PHONY: package-%(distribution)s
package-%(distribution)s: packages/%(distribution)s/$(DEBIAN_DSC_FILENAME)
.PHONY: package-%(distribution)s-interactive
package-%(distribution)s-interactive: $(RELEASE_TARBALL_FILENAME) packages/%(distribution)s .docker-image-%(distribution)s
$(PACKAGE_%(distribution)s_DOCKER_RUN_COMMAND) bash
"""
def generate_target(distribution, debian_packaging_override):
return target_template % {
"distribution": distribution,
"debian_packaging_override": debian_packaging_override,
}
def run_generate(parsed_args):
print(generate_target(parsed_args.distribution,
parsed_args.debian_packaging_override))
def run_generate_all(parsed_args):
targets = [
# Debian
{
"distribution": "debian8",
"debian_packaging_override": "",
},
{
"distribution": "debian8_i386",
"debian_packaging_override": "",
},
{
"distribution": "debian9",
"debian_packaging_override": "",
},
{
"distribution": "debian9_i386",
"debian_packaging_override": "",
},
# Ubuntu
{
"distribution": "ubuntu14.04",
"debian_packaging_override": "",
},
{
"distribution": "ubuntu14.04_i386",
"debian_packaging_override": "",
},
{
"distribution": "ubuntu15.04",
"debian_packaging_override": "",
},
{
"distribution": "ubuntu15.04_i386",
"debian_packaging_override": "",
},
{
"distribution": "ubuntu15.10",
"debian_packaging_override": "",
},
{
"distribution": "ubuntu15.10_i386",
"debian_packaging_override": "",
},
{
"distribution": "ubuntu16.04",
"debian_packaging_override": "",
},
{
"distribution": "ubuntu16.04_i386",
"debian_packaging_override": "",
},
]
for target in targets:
print(generate_target(**target))
def parse_args():
ap = argparse.ArgumentParser(
description="Packaging targets generation tool"
)
ga = ap.add_mutually_exclusive_group(required=True)
# Action arguments
ga.add_argument('--generate',
action='store_true',
help='Generate a single packaging target')
ga.add_argument('--generate-all',
action='store_true',
help='Generates all packaging targets')
# Parameters
ap.add_argument('--distribution')
ap.add_argument('--architecture')
ap.add_argument('--debian_packaging_override', default='')
parsed_args = ap.parse_args()
return parsed_args
def main():
parsed_args = parse_args()
if parsed_args.generate:
run_generate(parsed_args)
elif parsed_args.generate_all:
run_generate_all(parsed_args)
if __name__ == "__main__":
main()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment