Browse code

Do not overwrite already published deb files when releasing

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>

Kenfe-Mickael Laventure authored on 2016/06/03 12:55:53
Showing 1 changed files
... ...
@@ -102,18 +102,29 @@ for dir in contrib/builder/deb/${PACKAGE_ARCH}/*/; do
102 102
 	version="$(basename "$dir")"
103 103
 	codename="${version//debootstrap-}"
104 104
 
105
+	tempdir="$(mktemp -d /tmp/tmp-docker-release-deb.XXXXXXXX)"
105 106
 	DEBFILE=( "bundles/$VERSION/build-deb/$version/docker-engine"*.deb )
106 107
 
107
-	# if we have a $GPG_PASSPHRASE we may as well
108
-	# dpkg-sign before copying the deb into the pool
109
-	if [ ! -z "$GPG_PASSPHRASE" ]; then
110
-		dpkg-sig -g "--no-tty --passphrase '$GPG_PASSPHRASE'" \
111
-			-k "$GPG_KEYID" --sign builder "${DEBFILE[@]}"
112
-	fi
113
-
114
-	# add the deb for each component for the distro version into the pool
108
+	# add the deb for each component for the distro version into the
109
+	# pool (if it is not there already)
115 110
 	mkdir -p "$APTDIR/pool/$component/d/docker-engine/"
116
-	cp "${DEBFILE[@]}" "$APTDIR/pool/$component/d/docker-engine/"
111
+ 	for deb in ${DEBFILE[@]}; do
112
+		d=$(basename "$deb")
113
+		# We do not want to generate a new deb if it has already been
114
+		# copied into the APTDIR
115
+		if [ ! -f "$APTDIR/pool/$component/d/docker-engine/$d" ]; then
116
+			cp "$deb" "$tempdir/"
117
+			# if we have a $GPG_PASSPHRASE we may as well
118
+			# dpkg-sign before copying the deb into the pool
119
+			if [ ! -z "$GPG_PASSPHRASE" ]; then
120
+				dpkg-sig -g "--no-tty --passphrase '$GPG_PASSPHRASE'" \
121
+					-k "$GPG_KEYID" --sign builder "$tempdir/$d"
122
+			fi
123
+			mv "$tempdir/$d" "$APTDIR/pool/$component/d/docker-engine/"
124
+		fi
125
+	done
126
+
127
+	rm -rf "$tempdir"
117 128
 
118 129
 	# build the right directory structure, needed for apt-ftparchive
119 130
 	for arch in "${arches[@]}"; do