Browse code

Make release scripts architecture-agnostic and add ARM support

This patch allows to only release the packages that were built and are
present under the bundles/ directory instead of assuming packages exist
for all distros enumerated in the contrib/builder/ directory.

It also now adds support for armhf architecture for apt repositories.

Signed-off-by: Tibor Vass <tibor@docker.com>

Tibor Vass authored on 2016/08/11 06:05:04
Showing 2 changed files
... ...
@@ -14,9 +14,6 @@ set -e
14 14
 #
15 15
 # ... and so on and so forth for the builds created by hack/make/build-deb
16 16
 
17
-source "$(dirname "$BASH_SOURCE")/.integration-daemon-start"
18
-source "$(dirname "$BASH_SOURCE")/.detect-daemon-osarch"
19
-
20 17
 : ${DOCKER_RELEASE_DIR:=$DEST}
21 18
 : ${GPG_KEYID:=releasedocker}
22 19
 APTDIR=$DOCKER_RELEASE_DIR/apt/repo
... ...
@@ -25,7 +22,7 @@ APTDIR=$DOCKER_RELEASE_DIR/apt/repo
25 25
 mkdir -p "$APTDIR/conf" "$APTDIR/db" "$APTDIR/dists"
26 26
 
27 27
 # supported arches/sections
28
-arches=( amd64 i386 )
28
+arches=( amd64 i386 armhf )
29 29
 
30 30
 # Preserve existing components but don't add any non-existing ones
31 31
 for component in main testing experimental ; do
... ...
@@ -77,7 +74,7 @@ TreeDefault {
77 77
 };
78 78
 EOF
79 79
 
80
-for dir in contrib/builder/deb/${PACKAGE_ARCH}/*/; do
80
+for dir in bundles/$VERSION/build-deb/*/; do
81 81
 	version="$(basename "$dir")"
82 82
 	suite="${version//debootstrap-}"
83 83
 
... ...
@@ -98,12 +95,12 @@ APT::FTPArchive::Release::Architectures "${arches[*]}";
98 98
 EOF
99 99
 
100 100
 # release the debs
101
-for dir in contrib/builder/deb/${PACKAGE_ARCH}/*/; do
101
+for dir in bundles/$VERSION/build-deb/*/; do
102 102
 	version="$(basename "$dir")"
103 103
 	codename="${version//debootstrap-}"
104 104
 
105 105
 	tempdir="$(mktemp -d /tmp/tmp-docker-release-deb.XXXXXXXX)"
106
-	DEBFILE=( "bundles/$VERSION/build-deb/$version/docker-engine"*.deb )
106
+	DEBFILE=( "$dir/docker-engine"*.deb )
107 107
 
108 108
 	# add the deb for each component for the distro version into the
109 109
 	# pool (if it is not there already)
... ...
@@ -128,7 +125,9 @@ for dir in contrib/builder/deb/${PACKAGE_ARCH}/*/; do
128 128
 
129 129
 	# build the right directory structure, needed for apt-ftparchive
130 130
 	for arch in "${arches[@]}"; do
131
-		mkdir -p "$APTDIR/dists/$codename/$component/binary-$arch"
131
+		for c in "${components[@]}"; do
132
+			mkdir -p "$APTDIR/dists/$codename/$c/binary-$arch"
133
+		done
132 134
 	done
133 135
 
134 136
 	# update the filelist for this codename/component
... ...
@@ -139,7 +138,7 @@ done
139 139
 # run the apt-ftparchive commands so we can have pinning
140 140
 apt-ftparchive generate "$APTDIR/conf/apt-ftparchive.conf"
141 141
 
142
-for dir in contrib/builder/deb/${PACKAGE_ARCH}/*/; do
142
+for dir in bundles/$VERSION/build-deb/*/; do
143 143
 	version="$(basename "$dir")"
144 144
 	codename="${version//debootstrap-}"
145 145
 
... ...
@@ -14,16 +14,10 @@ set -e
14 14
 #
15 15
 # ... and so on and so forth for the builds created by hack/make/build-rpm
16 16
 
17
-source "$(dirname "$BASH_SOURCE")/.integration-daemon-start"
18
-source "$(dirname "$BASH_SOURCE")/.detect-daemon-osarch"
19
-
20 17
 : ${DOCKER_RELEASE_DIR:=$DEST}
21 18
 YUMDIR=$DOCKER_RELEASE_DIR/yum/repo
22 19
 : ${GPG_KEYID:=releasedocker}
23 20
 
24
-# manage the repos for each distribution separately
25
-distros=( fedora centos opensuse oraclelinux )
26
-
27 21
 # get the release
28 22
 release="main"
29 23
 
... ...
@@ -35,44 +29,42 @@ if [ $DOCKER_EXPERIMENTAL ] || [[ "$VERSION" == *-dev ]] || [ -n "$(git status -
35 35
 	release="experimental"
36 36
 fi
37 37
 
38
-for distro in "${distros[@]}"; do
39
-	# Setup the yum repo
40
-	REPO=$YUMDIR/$release/$distro
38
+# Setup the yum repo
39
+for dir in bundles/$VERSION/build-rpm/*/; do
40
+	version="$(basename "$dir")"
41
+	suite="${version##*-}"
41 42
 
42
-	for dir in contrib/builder/rpm/${PACKAGE_ARCH}/$distro-*/; do
43
-		version="$(basename "$dir")"
44
-		suite="${version##*-}"
43
+	REPO=$YUMDIR/$release/$suite
45 44
 
46
-		# if the directory does not exist, initialize the yum repo
47
-		if [[ ! -d $REPO/$suite/Packages ]]; then
48
-			mkdir -p "$REPO/$suite/Packages"
45
+	# if the directory does not exist, initialize the yum repo
46
+	if [[ ! -d $REPO/$suite/Packages ]]; then
47
+		mkdir -p "$REPO/$suite/Packages"
49 48
 
50
-			createrepo --pretty "$REPO/$suite"
51
-		fi
49
+		createrepo --pretty "$REPO/$suite"
50
+	fi
52 51
 
53
-		# path to rpms
54
-		RPMFILE=( "bundles/$VERSION/build-rpm/$version/RPMS/"*"/docker-engine"*.rpm "bundles/$VERSION/build-rpm/$version/SRPMS/docker-engine"*.rpm )
52
+	# path to rpms
53
+	RPMFILE=( "bundles/$VERSION/build-rpm/$version/RPMS/"*"/docker-engine"*.rpm "bundles/$VERSION/build-rpm/$version/SRPMS/docker-engine"*.rpm )
55 54
 
56
-		# if we have a $GPG_PASSPHRASE we may as well
57
-		# sign the rpms before adding to repo
58
-		if [ ! -z $GPG_PASSPHRASE ]; then
59
-			# export our key to rpm import
60
-			gpg --armor --export "$GPG_KEYID" > /tmp/gpg
61
-			rpm --import /tmp/gpg
55
+	# if we have a $GPG_PASSPHRASE we may as well
56
+	# sign the rpms before adding to repo
57
+	if [ ! -z $GPG_PASSPHRASE ]; then
58
+		# export our key to rpm import
59
+		gpg --armor --export "$GPG_KEYID" > /tmp/gpg
60
+		rpm --import /tmp/gpg
62 61
 
63
-			# sign the rpms
64
-			echo "yes" | setsid rpm \
65
-				--define "_gpg_name $GPG_KEYID" \
66
-				--define "_signature gpg" \
67
-				--define "__gpg_check_password_cmd /bin/true" \
68
-				--define "__gpg_sign_cmd %{__gpg} gpg --batch --no-armor --passphrase '$GPG_PASSPHRASE' --no-secmem-warning -u '%{_gpg_name}' --sign --detach-sign --output %{__signature_filename} %{__plaintext_filename}" \
69
-				--resign "${RPMFILE[@]}"
70
-		fi
62
+		# sign the rpms
63
+		echo "yes" | setsid rpm \
64
+			--define "_gpg_name $GPG_KEYID" \
65
+			--define "_signature gpg" \
66
+			--define "__gpg_check_password_cmd /bin/true" \
67
+			--define "__gpg_sign_cmd %{__gpg} gpg --batch --no-armor --passphrase '$GPG_PASSPHRASE' --no-secmem-warning -u '%{_gpg_name}' --sign --detach-sign --output %{__signature_filename} %{__plaintext_filename}" \
68
+			--resign "${RPMFILE[@]}"
69
+	fi
71 70
 
72
-		# copy the rpms to the packages folder
73
-		cp "${RPMFILE[@]}" "$REPO/$suite/Packages"
71
+	# copy the rpms to the packages folder
72
+	cp "${RPMFILE[@]}" "$REPO/$suite/Packages"
74 73
 
75
-		# update the repo
76
-		createrepo --pretty --update "$REPO/$suite"
77
-	done
74
+	# update the repo
75
+	createrepo --pretty --update "$REPO/$suite"
78 76
 done