packaging: debian: Do not alter the source tarball.

AFAICT, this was made to clear some supposedly non-redistributable
files in the sources according to Debian policy.  If there's some
cleanup to do, we should do so at the level of the common source
tarball, not in a Debian-specific way.

* packaging/rules/debian/rules (override_dh_auto_configure): Remove
code repacking tarballs.
(override_dh_clean, get-orig-source): Remove.
* packaging/rules/debian/copyright (Files-Excluded): Remove.  Also
streamline the listing of copyrights to the files part of our tree,
not in bundled libraries.  Debian-specific requirements can stay in
the Debian-maintained corresponding packages.
* scripts/build-package-debian.sh: Streamline, making the release
tarball the sole input of the process.  Do not build source packages,
for simplicity (dpkg-source doesn't like our source tarball as-is).

Change-Id: I78a482ab3362e9bba8ffdc0ab60324f94715bfb8
diff --git a/packaging/rules/debian/copyright b/packaging/rules/debian/copyright
index 2a82b17..094997c 100644
--- a/packaging/rules/debian/copyright
+++ b/packaging/rules/debian/copyright
@@ -2,23 +2,8 @@
 Upstream-Name: jami
 Upstream-Contact: Alexandre Viau <alexandre.viau@savoirfairelinux.net>
 Source: https://dl.jami.net/release/tarballs/
-Files-Excluded: client-electron/*
-                client-uwp/*
-                client-android/*
-                client-macosx/*
-                client-ios/*
-                client-gnome/libqrencode/*
-
 Files: *
-Copyright: 2004-2019 Savoir-faire Linux Inc.
-           1999 Tom Tromey
-           1994-2009 Red Hat, Inc.
-           2010 Michael Kerrisk
-           2007-2009 Rémi Denis-Courmont
-           2002 Fabrice Bellard
-           2012 VLC authors and VideoLAN
-           2012-2013 LOTES TM LLC
-           2011-2014 lolilolicon <lolilolicon@gmail.com>
+Copyright: 2004-2021 Savoir-faire Linux Inc.
 License: GPL-3+
 Comment: Upstream embeds everything that is needed to build Jami inside the release tarball.
  Everything that is already in Debian has been removed.
@@ -125,343 +110,6 @@
 ## End of gnome client ##
 #########################
 
-######################
-## Start of msgpack ##
-######################
-
-Files: daemon/contrib/tarballs-unpacked/msgpack-c-*
-Copyright: 2008-2016 FURUHASHI Sadayuki
-           2008-2016 KONDO Takatoshi
-           2013 Vladimir Volodko
-           2015 MIZUKI Hirata
-           2005-2014 Rene Rivera
-           2014 Franz Detro
-           2014 Microsoft Corporation
-           2014 Jessica Hamilton
-           2001 Housemarque Oy
-           2011-2014 Edward Diener
-           2001-2011 Paul Mensonides
-License: Boost-1.0
-
-Files: daemon/contrib/tarballs-unpacked/msgpack-c*/msgpack-c*/bootstrap
-Copyright: 2002 Anthony Ventimiglia
-License: GPL-2+
-
-License: Boost-1.0
- Permission is hereby granted, free of charge, to any person or organization
- obtaining a copy of the software and accompanying documentation covered by
- this license (the "Software") to use, reproduce, display, distribute,
- execute, and transmit the Software, and to prepare derivative works of the
- Software, and to permit third-parties to whom the Software is furnished to
- do so, all subject to the following:
- .
- The copyright notices in the Software and this entire statement, including
- the above license grant, this restriction and the following disclaimer,
- must be included in all copies of the Software, in whole or in part, and
- all derivative works of the Software, unless such copies or derivative
- works are solely in the form of machine-executable object code generated by
- a source language processor.
- .
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
- SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
- FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
- ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- DEALINGS IN THE SOFTWARE.
-
-####################
-## End of msgpack ##
-####################
-
-######################
-## Start of opendht ##
-######################
-
-Files: daemon/contrib/tarballs-unpacked/opendht*/opendht*/include/opendht/securedht.h
-Copyright: 2014-2019 Savoir-faire Linux Inc.
-License: GPL-3-with-openssl-exception
- 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, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
- .
- Additional permission under GNU GPL version 3 section 7:
- .
- If you modify this program, or any covered work, by linking or
- combining it with the OpenSSL project's OpenSSL library (or a
- modified version of that library), containing parts covered by the
- terms of the OpenSSL or SSLeay licenses, Savoir-faire Linux Inc.
- grants you additional permission to convey the resulting work.
- Corresponding Source for a non-source form of such a combination
- shall include the source code for the parts of OpenSSL used as well
- as that of the covered work.
-
-Files: daemon/contrib/tarballs-unpacked/opendht-*/opendht-*/include/opendht/dht.h
-       daemon/contrib/tarballs-unpacked/opendht-*/opendht-*/src/dht.cpp
-Copyright: 2009-2014 Juliusz Chroboczek
-           2014-2019 Savoir-faire Linux Inc
-License: Expat
-
-Files: daemon/contrib/tarballs-unpacked/opendht-*/opendht-*/m4/ax_cxx_compile_stdcxx.m4
-Copyright: 2008 Benjamin Kosnik <bkoz@redhat.com>
-           2012 Zack Weinberg <zackw@panix.com>
-           2013 Roy Stogner <roystgnr@ices.utexas.edu>
-           2014-2015 Google Inc.
-           2015 Paul Norman <penorman@mac.com>
-           2015 Moritz Klammler <moritz@klammler.eu>
-License: GNUAllPermissive
-
-Files: daemon/contrib/tarballs-unpacked/opendht-*/opendht-*/argon2/*
-Copyright: 2015 Daniel Dinu
-           2015 Dmitry Khovratovich
-           2015 Jean-Philippe Aumasson
-           2015 Samuel Neves
-           2013-2015 Samuel Neves
-           2015 Thomas Pornin
-License: CC0
-
-Files: daemon/src/ringdht/eth/*
-Copyright: Ethereum Contributors
-License: GPL-3+
-
-License: CC0
- /Statement of Purpose/
- .
- The laws of most jurisdictions throughout the world automatically confer
- exclusive Copyright and Related Rights (defined below) upon the creator
- and subsequent owner(s) (each and all, an "owner") of an original work
- of authorship and/or a database (each, a "Work").
- .
- Certain owners wish to permanently relinquish those rights to a Work for
- the purpose of contributing to a commons of creative, cultural and
- scientific works ("Commons") that the public can reliably and without
- fear of later claims of infringement build upon, modify, incorporate in
- other works, reuse and redistribute as freely as possible in any form
- whatsoever and for any purposes, including without limitation commercial
- purposes. These owners may contribute to the Commons to promote the
- ideal of a free culture and the further production of creative, cultural
- and scientific works, or to gain reputation or greater distribution for
- their Work in part through the use and efforts of others.
- .
- For these and/or other purposes and motivations, and without any
- expectation of additional consideration or compensation, the person
- associating CC0 with a Work (the "Affirmer"), to the extent that he or
- she is an owner of Copyright and Related Rights in the Work, voluntarily
- elects to apply CC0 to the Work and publicly distribute the Work under
- its terms, with knowledge of his or her Copyright and Related Rights in
- the Work and the meaning and intended legal effect of CC0 on those rights.
- .
- *1. Copyright and Related Rights.* A Work made available under CC0 may
- be protected by copyright and related or neighboring rights ("Copyright
- and Related Rights"). Copyright and Related Rights include, but are not
- limited to, the following:
- .
-  1. the right to reproduce, adapt, distribute, perform, display,
-     communicate, and translate a Work;
-  2. moral rights retained by the original author(s) and/or performer(s);
-  3. publicity and privacy rights pertaining to a person's image or
-     likeness depicted in a Work;
-  4. rights protecting against unfair competition in regards to a Work,
-     subject to the limitations in paragraph 4(a), below;
-  5. rights protecting the extraction, dissemination, use and reuse of
-     data in a Work;
-  6. database rights (such as those arising under Directive 96/9/EC of
-     the European Parliament and of the Council of 11 March 1996 on the
-     legal protection of databases, and under any national implementation
-     thereof, including any amended or successor version of such
-     directive); and
-  7. other similar, equivalent or corresponding rights throughout the
-     world based on applicable law or treaty, and any national
-     implementations thereof.
- .
- *2. Waiver.* To the greatest extent permitted by, but not in
- contravention of, applicable law, Affirmer hereby overtly, fully,
- permanently, irrevocably and unconditionally waives, abandons, and
- surrenders all of Affirmer's Copyright and Related Rights and associated
- claims and causes of action, whether now known or unknown (including
- existing as well as future claims and causes of action), in the Work (i)
- in all territories worldwide, (ii) for the maximum duration provided by
- applicable law or treaty (including future time extensions), (iii) in
- any current or future medium and for any number of copies, and (iv) for
- any purpose whatsoever, including without limitation commercial,
- advertising or promotional purposes (the "Waiver"). Affirmer makes the
- Waiver for the benefit of each member of the public at large and to the
- detriment of Affirmer's heirs and successors, fully intending that such
- Waiver shall not be subject to revocation, rescission, cancellation,
- termination, or any other legal or equitable action to disrupt the quiet
- enjoyment of the Work by the public as contemplated by Affirmer's
- express Statement of Purpose.
- .
- *3. Public License Fallback.* Should any part of the Waiver for any
- reason be judged legally invalid or ineffective under applicable law,
- then the Waiver shall be preserved to the maximum extent permitted
- taking into account Affirmer's express Statement of Purpose. In
- addition, to the extent the Waiver is so judged Affirmer hereby grants
- to each affected person a royalty-free, non transferable, non
- sublicensable, non exclusive, irrevocable and unconditional license to
- exercise Affirmer's Copyright and Related Rights in the Work (i) in all
- territories worldwide, (ii) for the maximum duration provided by
- applicable law or treaty (including future time extensions), (iii) in
- any current or future medium and for any number of copies, and (iv) for
- any purpose whatsoever, including without limitation commercial,
- advertising or promotional purposes (the "License"). The License shall
- be deemed effective as of the date CC0 was applied by Affirmer to the
- Work. Should any part of the License for any reason be judged legally
- invalid or ineffective under applicable law, such partial invalidity or
- ineffectiveness shall not invalidate the remainder of the License, and
- in such case Affirmer hereby affirms that he or she will not (i)
- exercise any of his or her remaining Copyright and Related Rights in the
- Work or (ii) assert any associated claims and causes of action with
- respect to the Work, in either case contrary to Affirmer's express
- Statement of Purpose.
- .
- *4. Limitations and Disclaimers.*
- .
-  1. No trademark or patent rights held by Affirmer are waived,
-     abandoned, surrendered, licensed or otherwise affected by this document.
-  2. Affirmer offers the Work as-is and makes no representations or
-     warranties of any kind concerning the Work, express, implied,
-     statutory or otherwise, including without limitation warranties of
-     title, merchantability, fitness for a particular purpose, non
-     infringement, or the absence of latent or other defects, accuracy,
-     or the present or absence of errors, whether or not discoverable,
-     all to the greatest extent permissible under applicable law.
-  3. Affirmer disclaims responsibility for clearing rights of other
-     persons that may apply to the Work or any use thereof, including
-     without limitation any person's Copyright and Related Rights in the
-     Work. Further, Affirmer disclaims responsibility for obtaining any
-     necessary consents, permissions or other rights required for any use
-     of the Work.
-  4. Affirmer understands and acknowledges that Creative Commons is not a
-     party to this document and has no duty or obligation with respect to
-     this CC0 or use of the Work.
-
-####################
-## End of opendht ##
-####################
-
-########################
-## Start of pjproject ##
-########################
-
-Files: daemon/contrib/tarballs-unpacked/pjproject-*
-Copyright: 2008-2011 Teluu Inc.
-           2003-2008 Benny Prijono <benny@prijono.org>
-           1987-1998 Free Software Foundation Inc
-           1993-2006 Douglas C. Schmidt <d.schmidt@vanderbilt.edu>
-           2011 Dan Arrhenius <dan@keystream.se>
-           2010-2012 Regis Montoya
-           2015 bdSound s.r.l.
-           2007-2009 Keystream AB and Konftel AB
-           1992-2001 Microsoft Corporation
-           1991 Massachusetts Institute of Technology
-License: GPL-2+
-
-Files: daemon/contrib/tarballs-unpacked/pjproject-*/pjproject-*/pjlib/src/pj/compat/longjmp_i386.S
-       daemon/contrib/tarballs-unpacked/pjproject-*/pjproject-*/pjlib-util/include/pjlib-util/getopt.h
-       daemon/contrib/tarballs-unpacked/pjproject-*/pjproject-*/pjlib-util/src/pjlib-util/getopt.c
-Copyright: 1989-1998 Free Software Foundation, Inc.
-License: LGPL-2+
-
-Files: daemon/contrib/tarballs-unpacked/pjproject-*/pjproject-*/pjlib/src/pj/compat/setjmp_i386.S
-Copyright: 1995-2001 Free Software Foundation, Inc.
-License: LGPL-2.1+
-
-Files: daemon/contrib/tarballs-unpacked/pjproject-*/pjproject-*/pjlib-util/src/pjlib-util/crc32.c
-Copyright: -
-License: public-domain
- This file is partly taken from Crypto++ library (http://www.cryptopp.com)
- and http://www.di-mgt.com.au/crypto.html#CRC.
- .
- Since the original version of the code is put in public domain,
- this file is put on public domain as well.
-
-Files: daemon/contrib/tarballs-unpacked/pjproject-*/pjproject-*/pjlib-util/src/pjlib-util/md5.c
-Copyright: -
-License: public-domain
- This is the implementation of MD5 algorithm, based on the code
- written by Colin Plumb. This file is put in public domain.
-
-Files: daemon/contrib/tarballs-unpacked/pjproject-*/pjproject-*/pjlib-util/src/pjlib-util/sha1.c
-Copyright: Steve Reid <sreid@sea-to-sky.net>
-License: public-domain
- No license nor text except for the following mention: "100% Public Domain"
-
-Files: daemon/contrib/tarballs-unpacked/pjproject-*/pjproject-*/pjmedia/src/pjmedia/alaw_ulaw.c
-Copyright: Sun Microsystems, Inc.
-License: sun-license
- This source code is a product of Sun Microsystems, Inc. and is provided
- for unrestricted use.  Users may copy or modify this source code without
- charge.
- .
- SUN SOURCE CODE IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING
- THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- .
- Sun source code is provided with no support and without any obligation on
- the part of Sun Microsystems, Inc. to assist in its use, correction,
- modification or enhancement.
- .
- SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY THIS SOFTWARE
- OR ANY PART THEREOF.
- .
- In no event will Sun Microsystems, Inc. be liable for any lost revenue
- or profits or other special, indirect and consequential damages, even if
- Sun has been advised of the possibility of such damages.
-
-Files: daemon/contrib/tarballs-unpacked/pjproject-*/pjproject-*/pjsip-apps/src/pjsua/bb10/bar-descriptor.xml
-Copyright: 2011-2013 Research In Motion Limited.
-License: Apache-2.0
-
-Files: daemon/contrib/tarballs-unpacked/pjproject-*/pjproject-*/aconfigure
-       daemon/contrib/tarballs-unpacked/pjproject-*/pjproject-*/third_party/srtp/configure
-Copyright: 1992-2012 Free Software Foundation, Inc.
-License: configure-fsf-permissive
- This configure script is free software; the Free Software Foundation
- gives unlimited permission to copy, distribute and modify it.
-
-Files: daemon/contrib/tarballs-unpacked/pjproject-*/pjproject-*/install-sh
-       daemon/contrib/tarballs-unpacked/pjproject-*/pjproject-*/third_party/srtp/install-sh
-Copyright: 1991 Massachusetts Institute of Technology
-License: mit-permissive
- Permission to use, copy, modify, distribute, and sell this software and its
- documentation for any purpose is hereby granted without fee, provided that
- the above copyright notice appear in all copies and that both that
- copyright notice and this permission notice appear in supporting
- documentation, and that the name of M.I.T. not be used in advertising or
- publicity pertaining to distribution of the software without specific,
- written prior permission.  M.I.T. makes no representations about the
- suitability of this software for any purpose.  It is provided "as is"
- without express or implied warranty.
-
-Files: daemon/contrib/tarballs-unpacked/pjproject-*/pjproject-*/third_party/resample/*
-Copyright: 1994-2006 Julius O. Smith III <jos@ccrma.stanford.edu>
-License: LGPL-2.1+
-
-Files: daemon/contrib/tarballs-unpacked/pjproject-*/pjproject-*/third_party/srtp/*
-Copyright: 2001-2006 Cisco Systems, Inc.
-           2005 Ingate Systems AB
-License: BSD-3-Clause
-
-Files: daemon/contrib/tarballs-unpacked/pjproject-*/pjproject-*/third_party/srtp/pjlib/*
-Copyright: 2003-2007 Benny Prijono <benny@prijono.org>
-License: GPL-2+
-
-######################
-## End of pjproject ##
-######################
-
 License: GPL-3+
  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
diff --git a/packaging/rules/debian/rules b/packaging/rules/debian/rules
index 23f8672..b0b9921 100755
--- a/packaging/rules/debian/rules
+++ b/packaging/rules/debian/rules
@@ -50,18 +50,6 @@
 	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
-
 	###########################
 	## Daemon configure      ##
 	###########################
@@ -155,11 +143,6 @@
 	make -C client-qt/build -j$(NO_CPUS) V=1
 
 override_dh_auto_clean:
-	################################
-	## Generated contrib tarballs ##
-	################################
-	rm -rfv daemon/contrib/tarballs
-
 	#######################
 	## Daemon clean      ##
 	#######################
@@ -188,12 +171,6 @@
 	if [ -f client-qt/build/Makefile ]; then make -C client-qt/build clean; fi
 	rm -rfv client-qt/build
 
-override_dh_clean:
-	# GNUTLS contains:
-	# ring-project/daemon/contrib/tarballs-unpacked/gnutls-3.5.10.tar.xz/gnutls-3.5.10/src/certtool-args.c.bak
-	# ring-project/daemon/contrib/tarballs-unpacked/gnutls-3.5.10.tar.xz/gnutls-3.5.10/doc/doxygen/Doxyfile.orig
-	dh_clean -X.bak -X.orig
-
 override_dh_auto_install:
 	#########################
 	## Daemon install      ##
@@ -270,59 +247,3 @@
 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 jami 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 jami tarball
-	tar -C ${tmpdir} -xf ${tmpdir}/*.tar.gz
-
-	# Remove original tarball
-	rm ${tmpdir}/*.tar.gz
-
-	# Unpack all of the orig tarballs into tarballs-unpacked
-	if [ -d "${tmpdir}/jami/" ]; then \
-		mv ${tmpdir}/jami/ ${tmpdir}/ring-project/; \
-	fi
-	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}/jami_${version_to_download}~dfsg1.orig.tar.gz ring-project
-
-	# Clear the temp dir
-	rm -rf ${tmpdir}
diff --git a/scripts/build-package-debian.sh b/scripts/build-package-debian.sh
index 0df0d24..71d6fb8 100755
--- a/scripts/build-package-debian.sh
+++ b/scripts/build-package-debian.sh
@@ -1,6 +1,6 @@
 #!/usr/bin/env bash
 #
-# Copyright (C) 2016-2019 Savoir-faire Linux Inc.
+# Copyright (C) 2016-2021 Savoir-faire Linux Inc.
 #
 # Author: Alexandre Viau <alexandre.viau@savoirfairelinux.com>
 #
@@ -20,17 +20,8 @@
 # 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
-
-PKG_DIR="packaging/rules/debian"
-
-# import the debian folder and override files if needed
-cp -r ${PKG_DIR} debian
-
 DPKG_BUILD_OPTIONS=""
 # Set the host architecture as armhf and add some specific architecture
 # options to the package builder.
@@ -40,36 +31,27 @@
     DPKG_BUILD_OPTIONS="${DPKG_BUILD_OPTIONS} -a armhf"
 fi
 
-# create changelog file
-DEBEMAIL="The Jami project <jami@gnu.org>" dch --create --package jami --newversion ${DEBIAN_VERSION} "Automatic nightly release"
-DEBEMAIL="The Jami project <jami@gnu.org>" dch --release --distribution "unstable" debian/changelog
+# Setup work directory.
+mkdir -p /jami/work && cd /jami/work
 
-# create orig tarball
-mk-origtargz --compression gzip ${RELEASE_TARBALL_FILENAME}
-rm --verbose ${RELEASE_TARBALL_FILENAME}
+# Create a changelog file, required by dpkg-buildpackage.
+mkdir debian
+DEBEMAIL="The Jami project <jami@gnu.org>" dch --create --package jami \
+        --newversion ${DEBIAN_VERSION} "Automatic nightly release"
+DEBEMAIL="The Jami project <jami@gnu.org>" dch --release \
+        --distribution "unstable" debian/changelog
 
-GET_ORIG_SOURCE_OVERRIDE_USCAN_TARBALL=$(readlink -f ../jami_*.orig.tar.gz) debian/rules get-orig-source
+# Unpack the source tarball.
+tar -xvf /src/"$RELEASE_TARBALL_FILENAME" --strip-components=1
 
-# move the tarball to the work directory
-mkdir -p /opt/jami-packaging
-mv jami_*.orig.tar.gz /opt/jami-packaging
+# Expose the debian directory from here, augmented with the changelog.
+cp debian/changelog packaging/rules/debian
+rm -r debian
+ln -s packaging/rules/debian .
 
-# move to work directory
-cd /opt/jami-packaging
+# Create the binary packages.
+dpkg-buildpackage -b -uc -us ${DPKG_BUILD_OPTIONS}
 
-# unpack the orig tarball
-tar -xvf /opt/jami-packaging/jami_*.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 ${DPKG_BUILD_OPTIONS}
-
-# move the artifacts to output
-cd ..
-mv *.orig.tar* *.debian.tar* *deb *changes *dsc /opt/output
+# Move the artifacts to the output.
+mv ../*.deb /opt/output
 chown -R ${CURRENT_UID}:${CURRENT_UID} /opt/output
diff --git a/scripts/make-packaging-target.py b/scripts/make-packaging-target.py
index b820902..506770e 100755
--- a/scripts/make-packaging-target.py
+++ b/scripts/make-packaging-target.py
@@ -54,6 +54,7 @@
     -e CURRENT_UID=$(CURRENT_UID) \\
     -e CURRENT_GID=$(CURRENT_GID) \\
     -e DISTRIBUTION=%(distribution)s \\
+    -v $(CURDIR)/$(RELEASE_TARBALL_FILENAME):/src/$(RELEASE_TARBALL_FILENAME) \\
     -v $(CURDIR):/opt/ring-project-ro:ro \\
     -v $(CURDIR)/packages/%(distribution)s:/opt/output \\
     -v /opt/cache-packaging:/opt/cache-packaging \\