Skip to content

Commit 2ff2e9a

Browse files
author
Tibor Vass
committed
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 <[email protected]>
1 parent 92b10b4 commit 2ff2e9a

File tree

2 files changed

+38
-47
lines changed

2 files changed

+38
-47
lines changed

hack/make/release-deb

+8-9
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@ set -e
1414
#
1515
# ... and so on and so forth for the builds created by hack/make/build-deb
1616

17-
source "$(dirname "$BASH_SOURCE")/.integration-daemon-start"
18-
source "$(dirname "$BASH_SOURCE")/.detect-daemon-osarch"
19-
2017
: ${DOCKER_RELEASE_DIR:=$DEST}
2118
: ${GPG_KEYID:=releasedocker}
2219
APTDIR=$DOCKER_RELEASE_DIR/apt/repo
@@ -25,7 +22,7 @@ APTDIR=$DOCKER_RELEASE_DIR/apt/repo
2522
mkdir -p "$APTDIR/conf" "$APTDIR/db" "$APTDIR/dists"
2623

2724
# supported arches/sections
28-
arches=( amd64 i386 )
25+
arches=( amd64 i386 armhf )
2926

3027
# Preserve existing components but don't add any non-existing ones
3128
for component in main testing experimental ; do
@@ -77,7 +74,7 @@ TreeDefault {
7774
};
7875
EOF
7976

80-
for dir in contrib/builder/deb/${PACKAGE_ARCH}/*/; do
77+
for dir in bundles/$VERSION/build-deb/*/; do
8178
version="$(basename "$dir")"
8279
suite="${version//debootstrap-}"
8380

@@ -98,12 +95,12 @@ APT::FTPArchive::Release::Architectures "${arches[*]}";
9895
EOF
9996

10097
# release the debs
101-
for dir in contrib/builder/deb/${PACKAGE_ARCH}/*/; do
98+
for dir in bundles/$VERSION/build-deb/*/; do
10299
version="$(basename "$dir")"
103100
codename="${version//debootstrap-}"
104101

105102
tempdir="$(mktemp -d /tmp/tmp-docker-release-deb.XXXXXXXX)"
106-
DEBFILE=( "bundles/$VERSION/build-deb/$version/docker-engine"*.deb )
103+
DEBFILE=( "$dir/docker-engine"*.deb )
107104

108105
# add the deb for each component for the distro version into the
109106
# pool (if it is not there already)
@@ -128,7 +125,9 @@ for dir in contrib/builder/deb/${PACKAGE_ARCH}/*/; do
128125

129126
# build the right directory structure, needed for apt-ftparchive
130127
for arch in "${arches[@]}"; do
131-
mkdir -p "$APTDIR/dists/$codename/$component/binary-$arch"
128+
for c in "${components[@]}"; do
129+
mkdir -p "$APTDIR/dists/$codename/$c/binary-$arch"
130+
done
132131
done
133132

134133
# update the filelist for this codename/component
@@ -139,7 +138,7 @@ done
139138
# run the apt-ftparchive commands so we can have pinning
140139
apt-ftparchive generate "$APTDIR/conf/apt-ftparchive.conf"
141140

142-
for dir in contrib/builder/deb/${PACKAGE_ARCH}/*/; do
141+
for dir in bundles/$VERSION/build-deb/*/; do
143142
version="$(basename "$dir")"
144143
codename="${version//debootstrap-}"
145144

hack/make/release-rpm

+30-38
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,10 @@ set -e
1414
#
1515
# ... and so on and so forth for the builds created by hack/make/build-rpm
1616

17-
source "$(dirname "$BASH_SOURCE")/.integration-daemon-start"
18-
source "$(dirname "$BASH_SOURCE")/.detect-daemon-osarch"
19-
2017
: ${DOCKER_RELEASE_DIR:=$DEST}
2118
YUMDIR=$DOCKER_RELEASE_DIR/yum/repo
2219
: ${GPG_KEYID:=releasedocker}
2320

24-
# manage the repos for each distribution separately
25-
distros=( fedora centos opensuse oraclelinux )
26-
2721
# get the release
2822
release="main"
2923

@@ -35,44 +29,42 @@ if [ $DOCKER_EXPERIMENTAL ] || [[ "$VERSION" == *-dev ]] || [ -n "$(git status -
3529
release="experimental"
3630
fi
3731

38-
for distro in "${distros[@]}"; do
39-
# Setup the yum repo
40-
REPO=$YUMDIR/$release/$distro
32+
# Setup the yum repo
33+
for dir in bundles/$VERSION/build-rpm/*/; do
34+
version="$(basename "$dir")"
35+
suite="${version##*-}"
4136

42-
for dir in contrib/builder/rpm/${PACKAGE_ARCH}/$distro-*/; do
43-
version="$(basename "$dir")"
44-
suite="${version##*-}"
37+
REPO=$YUMDIR/$release/$suite
4538

46-
# if the directory does not exist, initialize the yum repo
47-
if [[ ! -d $REPO/$suite/Packages ]]; then
48-
mkdir -p "$REPO/$suite/Packages"
39+
# if the directory does not exist, initialize the yum repo
40+
if [[ ! -d $REPO/$suite/Packages ]]; then
41+
mkdir -p "$REPO/$suite/Packages"
4942

50-
createrepo --pretty "$REPO/$suite"
51-
fi
43+
createrepo --pretty "$REPO/$suite"
44+
fi
5245

53-
# path to rpms
54-
RPMFILE=( "bundles/$VERSION/build-rpm/$version/RPMS/"*"/docker-engine"*.rpm "bundles/$VERSION/build-rpm/$version/SRPMS/docker-engine"*.rpm )
46+
# path to rpms
47+
RPMFILE=( "bundles/$VERSION/build-rpm/$version/RPMS/"*"/docker-engine"*.rpm "bundles/$VERSION/build-rpm/$version/SRPMS/docker-engine"*.rpm )
5548

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
49+
# if we have a $GPG_PASSPHRASE we may as well
50+
# sign the rpms before adding to repo
51+
if [ ! -z $GPG_PASSPHRASE ]; then
52+
# export our key to rpm import
53+
gpg --armor --export "$GPG_KEYID" > /tmp/gpg
54+
rpm --import /tmp/gpg
6255

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
56+
# sign the rpms
57+
echo "yes" | setsid rpm \
58+
--define "_gpg_name $GPG_KEYID" \
59+
--define "_signature gpg" \
60+
--define "__gpg_check_password_cmd /bin/true" \
61+
--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}" \
62+
--resign "${RPMFILE[@]}"
63+
fi
7164

72-
# copy the rpms to the packages folder
73-
cp "${RPMFILE[@]}" "$REPO/$suite/Packages"
65+
# copy the rpms to the packages folder
66+
cp "${RPMFILE[@]}" "$REPO/$suite/Packages"
7467

75-
# update the repo
76-
createrepo --pretty --update "$REPO/$suite"
77-
done
68+
# update the repo
69+
createrepo --pretty --update "$REPO/$suite"
7870
done

0 commit comments

Comments
 (0)