From a15b67b1affb2eac5365614e55703f43b6f73e9b Mon Sep 17 00:00:00 2001 From: Mike Dougherty Date: Wed, 4 Nov 2015 17:17:37 -0800 Subject: [PATCH] Fixes for release scripts: Add a flag to allow keeping bundles around (helps with CI) Fix several problems in repo make targets * quote DOCKER_EXPERIMENTAL variable * pass-through arguments for gpg provided to dpkg-sig are now quoted properly, so passphrases with shell-interpolated symbols can be used * when determining deb suites, don't rely on 'origin' to be github.com/docker/docker Fix some issues with deb repository creation from scratch * Don't add empty components to the repository configuration as they will cause failure when generating. Add old docker-engine-cs name to package conflicts Signed-off-by: Mike Dougherty --- contrib/reprepro/suites.sh | 2 +- hack/make.sh | 2 +- hack/make/.build-deb/control | 2 +- hack/make/.build-rpm/docker-engine.spec | 1 + hack/make/release-deb | 41 ++++++++++++++++--------- 5 files changed, 31 insertions(+), 17 deletions(-) diff --git a/contrib/reprepro/suites.sh b/contrib/reprepro/suites.sh index 8418c24bf2..25a02da947 100755 --- a/contrib/reprepro/suites.sh +++ b/contrib/reprepro/suites.sh @@ -5,7 +5,7 @@ cd "$(dirname "$BASH_SOURCE")/../.." targets_from() { git fetch -q https://github.com/docker/docker.git "$1" - git ls-tree -r --name-only origin/master contrib/builder/deb | grep '/Dockerfile$' | sed -r 's!^contrib/builder/deb/|-debootstrap|/Dockerfile$!!g' + git ls-tree -r --name-only "$(git rev-parse FETCH_HEAD)" contrib/builder/deb | grep '/Dockerfile$' | sed -r 's!^contrib/builder/deb/|-debootstrap|/Dockerfile$!!g' } release_branch=$(git ls-remote --heads https://github.com/docker/docker.git | awk -F 'refs/heads/' '$2 ~ /^release/ { print $2 }' | sort -V | tail -1) diff --git a/hack/make.sh b/hack/make.sh index 52ad07e22b..d05d22a246 100755 --- a/hack/make.sh +++ b/hack/make.sh @@ -257,7 +257,7 @@ main() { # We want this to fail if the bundles already exist and cannot be removed. # This is to avoid mixing bundles from different versions of the code. mkdir -p bundles - if [ -e "bundles/$VERSION" ]; then + if [ -e "bundles/$VERSION" ] && [ -z "$KEEPBUNDLE" ]; then echo "bundles/$VERSION already exists. Removing." rm -fr "bundles/$VERSION" && mkdir "bundles/$VERSION" || exit 1 echo diff --git a/hack/make/.build-deb/control b/hack/make/.build-deb/control index 557f6a9330..c4a63b4ff9 100644 --- a/hack/make/.build-deb/control +++ b/hack/make/.build-deb/control @@ -14,7 +14,7 @@ Recommends: aufs-tools, xz-utils, ${apparmor:Recommends}, ${yubico:Recommends} -Conflicts: docker (<< 1.5~), docker.io, lxc-docker, lxc-docker-virtual-package +Conflicts: docker (<< 1.5~), docker.io, lxc-docker, lxc-docker-virtual-package, docker-engine-cs Description: Docker: the open-source application container engine Docker is an open source project to build, ship and run any application as a lightweight container diff --git a/hack/make/.build-rpm/docker-engine.spec b/hack/make/.build-rpm/docker-engine.spec index 9fdcd8bf8f..4ef1d8db5f 100644 --- a/hack/make/.build-rpm/docker-engine.spec +++ b/hack/make/.build-rpm/docker-engine.spec @@ -91,6 +91,7 @@ Requires(pre): %{name}-selinux >= %{epoch}:%{version}-%{release} # conflicting packages Conflicts: docker Conflicts: docker-io +Conflicts: docker-engine-cs %description Docker is an open source project to build, ship and run any application as a diff --git a/hack/make/release-deb b/hack/make/release-deb index 2398cc0f9a..341bab4535 100755 --- a/hack/make/release-deb +++ b/hack/make/release-deb @@ -23,7 +23,29 @@ mkdir -p "$APTDIR/conf" "$APTDIR/db" # supported arches/sections arches=( amd64 i386 ) -components=( main testing experimental ) + +# Preserve existing components but don't add any non-existing ones +for component in main testing experimental ; do + if ls "$APTDIR/dists/*/$component" >/dev/null 2>&1 ; then + components+=( $component ) + fi +done + +# set the component for the version being released +component="main" + +if [[ "$VERSION" == *-rc* ]]; then + component="testing" +fi + +if [ "$DOCKER_EXPERIMENTAL" ] || [[ "$VERSION" == *-dev ]] || [ -n "$(git status --porcelain)" ]; then + component="experimental" +fi + +# Make sure our component is in the list of components +if [[ ! "${components[*]}" =~ $component ]] ; then + components+=( $component ) +fi # create/update apt-ftparchive file if [ ! -f "$APTDIR/conf/apt-ftparchive.conf" ]; then @@ -53,7 +75,7 @@ if [ ! -f "$APTDIR/conf/apt-ftparchive.conf" ]; then for suite in $(exec contrib/reprepro/suites.sh); do cat <<-EOF Tree "dists/${suite}" { - Sections "main testing experimental"; + Sections "${components[*]}"; Architectures "${arches[*]}"; } @@ -70,17 +92,6 @@ if [ ! -f "$APTDIR/conf/docker-engine-release.conf" ]; then EOF fi -# set the component for the version being released -component="main" - -if [[ "$VERSION" == *-rc* ]]; then - component="testing" -fi - -if [ $DOCKER_EXPERIMENTAL ] || [[ "$VERSION" == *-dev ]] || [ -n "$(git status --porcelain)" ]; then - component="experimental" -fi - # release the debs for dir in contrib/builder/deb/*/; do version="$(basename "$dir")" @@ -91,7 +102,7 @@ for dir in contrib/builder/deb/*/; do # if we have a $GPG_PASSPHRASE we may as well # dpkg-sign before copying the deb into the pool if [ ! -z "$GPG_PASSPHRASE" ]; then - dpkg-sig -g "--passphrase $GPG_PASSPHRASE" \ + dpkg-sig -g "--no-tty --passphrase '$GPG_PASSPHRASE'" \ -k "$GPG_KEYID" --sign builder "${DEBFILE[@]}" fi @@ -100,6 +111,7 @@ for dir in contrib/builder/deb/*/; do cp "${DEBFILE[@]}" "$APTDIR/pool/$component/d/docker-engine/" # update the filelist for this codename/component + mkdir -p "$APTDIR/dists/$codename/$component" find "$APTDIR/pool/$component" \ -name *~${codename#*-}*.deb > "$APTDIR/dists/$codename/$component/filelist" done @@ -122,6 +134,7 @@ for dir in contrib/builder/deb/*/; do "$APTDIR/dists/$codename" > "$APTDIR/dists/$codename/Release" for arch in "${arches[@]}"; do + mkdir -p "$APTDIR/dists/$codename/$component/binary-$arch" apt-ftparchive \ -o "APT::FTPArchive::Release::Codename=$codename" \ -o "APT::FTPArchive::Release::Suite=$codename" \