tarballs: git archive: put files in directory

Make the releases created from the "git archive" code path more similar
to the autotools releases, by having all files in a subdirectory with
the project name and tag name instead of having them directly in the
root of the tarball.

  $ tree osmo_dia2gsup-0.1.1 | head
  osmo_dia2gsup-0.1.1
  ├── build_dep.tar.gz
  ├── contrib
  │   ├── generate_build_dep.sh
  │   ├── jenkins.sh
  │   └── systemd
  │       └── osmo_dia2gsup.service
  ├── debian
  │   ├── changelog
  │   ├── compat

Change-Id: If37dcdc04278de0d4479cf72e0ca33c90b7deea8
diff --git a/scripts/tarballs/publish-tarballs-for-tags.sh b/scripts/tarballs/publish-tarballs-for-tags.sh
index 4ef3b5f..05d9f30 100755
--- a/scripts/tarballs/publish-tarballs-for-tags.sh
+++ b/scripts/tarballs/publish-tarballs-for-tags.sh
@@ -220,6 +220,7 @@
 	local project_path="$2"
 	local tag="$3"
 	local tarball_name="$(get_tarball_name "$project_path" "$tag")"
+	local prefix="$(echo "$tarball_name" | sed s/\.tar\.bz2//)"
 	local uid_user="$(id -u)"
 	echo "$LOG_PREFIX Building release tarball: $tarball_name"
 
@@ -259,12 +260,14 @@
 				esac
 				su build -c \"make dist-bzip2\"
 			else
-				su build -c \"git archive -o $tarball_name $tag\"
+				su build -c \"git archive --prefix=$prefix/ -o $tarball_name $tag\"
 			fi
 
 			# Erlang projects: add build depends to release tarball
 			if [ -e build_dep.tar.gz ]; then
-				su build -c \"tar -rf $tarball_name build_dep.tar.gz\"
+				su build -c \"mkdir $prefix\"
+				su build -c \"mv build_dep.tar.gz $prefix\"
+				su build -c \"tar -rf $tarball_name $prefix/build_dep.tar.gz\"
 			fi
 	"; then
 		echo "$LOG_PREFIX Building tarball failed!"