diff --git a/tools/build-system/build_tarball.sh b/tools/build-system/build_tarball.sh
index 43ca2bf5cb60119ee592dd9613a2952e26575a3d..535a186ce51307a5608444290df97f813a814e13 100755
--- a/tools/build-system/build_tarball.sh
+++ b/tools/build-system/build_tarball.sh
@@ -4,6 +4,10 @@
 #
 # Author: Francois Marier <francois@debian.org>
 
+
+# Exit on error
+set -o errexit
+
 # This is an environment variable provided by Jenkins. It points to the repository's root
 cd ${WORKSPACE}
 
@@ -12,8 +16,8 @@ if [ ! -e daemon/configure.ac ] ; then
     exit 1
 fi
 
-if [ "z$1" = "z" ] ; then
-    echo "Usage: $0 SOFTWARE_VERSION_NUMBER"
+if [ $# -ne 1 ] ; then
+    echo "Usage: $(basename $0) SOFTWARE_VERSION_NUMBER"
     exit 2
 fi
 
@@ -26,39 +30,41 @@ if [ -e $BUILDDIR ] ; then
     exit 3
 fi
 
+# Populate the tarball directory
 mkdir $BUILDDIR
-cp -r * $BUILDDIR/
+SRCITEMS=$(echo *)
+# Exclude existing tarballs from the created tarball
+SRCITEMS=${SRCITEMS//*.tar.gz}
+# ${SRCITEMS//$BUILDDIR} is used to remove $BUILDDIR from $SRCITEMS
+# See bash parameter expansion
+cp -r ${SRCITEMS//$BUILDDIR} $BUILDDIR/
 
 pushd $BUILDDIR
-rm -rf $BUILDDIR
-rm -f *.tar.gz
-
-rm -rf lang/
 # No dash in Version:
 sed /^Version/s/[0-9].*/${SOFTWARE_VERSION%%-*}/ tools/build-system/rpm/sflphone.spec > sflphone.spec
-rm -rf tools/
-#rm -rf kde/
 
+# Remove unwanted files
+rm -rf lang/
+rm -rf tools/
 rm -rf .git/
-rm -f .gitignore
-
-find -name .project -type f -exec rm {} \;
-find -name .cproject -type f -exec rm {} \;
-find -name .settings -type d -exec rm -rf {} \;
+find -name .gitignore -delete
+find -name .project -type f -delete
+find -name .cproject -type f -delete
+find -name .settings -type d -exec rm -rf {} +
 
+# Generate the configure files
 pushd daemon
 ./autogen.sh
 find -name \*.spec -delete
 popd
 
 pushd gnome
-./autogen.sh
+NOCONFIGURE=1 ./autogen.sh
 popd
 
-find -name autom4te.cache -type d -exec rm -rf {} \;
-find -name *.in~ -type f -exec rm {} \;
+find -name autom4te.cache -type d -exec rm -rf {} +
+find -name *.in~ -type f -delete
 popd # builddir
 
-rm -f sflphone-*.tar.gz
-tar zcf sflphone-$SOFTWARE_VERSION.tar.gz sflphone-$SOFTWARE_VERSION
+tar zcf sflphone-${SOFTWARE_VERSION}.tar.gz sflphone-${SOFTWARE_VERSION}
 rm -rf $BUILDDIR
diff --git a/tools/build-system/launch-build-machine-jenkins.sh b/tools/build-system/launch-build-machine-jenkins.sh
index 36fed5e82ff4340ac6cae90d1e732661a24c022c..054b4d6f2b0db655cf32c82fa4af18d331b9e038 100755
--- a/tools/build-system/launch-build-machine-jenkins.sh
+++ b/tools/build-system/launch-build-machine-jenkins.sh
@@ -298,7 +298,8 @@ END
 done
 
 # Archive source tarball for Debian maintainer
-. ${WORKING_DIR}/build_tarball.sh ${SOFTWARE_VERSION}
+# and for RPM package building
+./${WORKING_DIR}/build_tarball.sh ${SOFTWARE_VERSION}
 
 # Undo any modifications caused by temporary patches
 if [ "$REQUIRE_RESET" == "1" ]; then