From 2b185f0b25aede6e2f40a678647c78bb8e7f8638 Mon Sep 17 00:00:00 2001
From: Thanos Doukoudakis <thanos.doukoudakis@isode.com>
Date: Wed, 20 Dec 2017 13:34:19 +0000
Subject: Allow define the debian repositories to upload

This patch uses SWIFT_PACKAGE_PLATFORMS variable and only updates the
repositories that are defined there.

Test-Information
Tested the script on Ubuntu 16.04 when the variable is/not defined

Change-Id: Ie8f65441f558e3ac663eb8493cedd8c0d2630753

diff --git a/Swift/Packaging/Debian/update_debian_repo.sh b/Swift/Packaging/Debian/update_debian_repo.sh
index d62a376..26c0d5b 100644
--- a/Swift/Packaging/Debian/update_debian_repo.sh
+++ b/Swift/Packaging/Debian/update_debian_repo.sh
@@ -73,12 +73,23 @@ command -v reprepro >/dev/null 2>&1 || { echo >&2 "This script requires aptly bu
 
 mkdir -p $APT_REPO_ROOT
 
+if [ -z ${SWIFT_PACKAGE_PLATFORMS+x} ]; then
+	platformsarray=( xenial yakkety jessie sid )
+else
+	platformsarray=( $SWIFT_PACKAGE_PLATFORMS )
+fi
+
 # distros
 for full_distribution_path in $INCOMING_FOLDER/{debian,ubuntu}/*; do
 	distro_version=`basename $full_distribution_path`
 	distro_name=$(basename `dirname $full_distribution_path`)
 	distro_reprepro_root=${APT_REPO_ROOT}/${distro_name}/${distro_version}
 
+	if ! [[ $SWIFT_PACKAGE_PLATFORMS == *"$distro_name"* ]]; then
+		echo "$distro_name was not found in SWIFT_PACKAGE_PLATFORMS. Skipping..."
+		continue
+	fi
+
 	# ensure reprepro diretctory for this distribution version is present
 	if [ ! -d "$distro_preprepro_root" ]; then
 		echo "Create distribution repository for $distro_name/$distro_version"
@@ -89,7 +100,7 @@ for full_distribution_path in $INCOMING_FOLDER/{debian,ubuntu}/*; do
 		write_reprepo_conf_incoming_to_file "${distro_reprepro_root}/conf/incoming" "$full_distribution_path"
 	fi
 
-	# This is workaround for https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=808558 
+	# This is workaround for https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=808558
 	# and https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=843402
 	if [ "$distro_name/$distro_version" = "debian/sid" ]; then
 		sed -i '/dbgsym/ d' $full_distribution_path/*.changes
-- 
cgit v0.10.2-6-g49f6