moby/hack/make/release-rpm
Tibor Vass 996138bf8e Fix release scripts
Add some missing dependencies in the Dockerfile:
- apt-utils for apt-ftparchive.conf
- bsdmainutils for our use of the column command in
  hack/make/generate-index-listing

We also ensure that the docker daemon is started before calling
release-deb or release-rpm, since .detect-daemon-osarch, which is sourced
in each of them, requires the daemon to be running.

This commit also gets completely rid of s3cmd and fixes references to
AWS_* environment variables (changing from AWS_ACCESS_KEY to
AWS_ACCESS_KEY_ID and AWS_SECRET_KEY to AWS_SECRET_ACCESS_KEY) in order
to please awscli. Also AWS_DEFAULT_REGION is now important to specify,
the default has been set to the region used by get.docker.com and
test.docker.com.

Signed-off-by: Tibor Vass <tibor@docker.com>
2016-03-25 11:55:26 -04:00

78 lines
2.4 KiB
Bash
Executable file

#!/bin/bash
set -e
# This script creates the yum repos for the .rpm files generated by hack/make/build-rpm
#
# The following can then be used as a yum repo:
# http://yum.dockerproject.org/repo/$release/$distro/$distro-version
#
# For example:
# http://yum.dockerproject.org/repo/main/fedora/23
# http://yum.dockerproject.org/repo/testing/centos/7
# http://yum.dockerproject.org/repo/experimental/fedora/23
# http://yum.dockerproject.org/repo/main/centos/7
#
# ... and so on and so forth for the builds created by hack/make/build-rpm
source "$(dirname "$BASH_SOURCE")/.integration-daemon-start"
source "$(dirname "$BASH_SOURCE")/.detect-daemon-osarch"
: ${DOCKER_RELEASE_DIR:=$DEST}
YUMDIR=$DOCKER_RELEASE_DIR/yum/repo
: ${GPG_KEYID:=releasedocker}
# manage the repos for each distribution separately
distros=( fedora centos opensuse oraclelinux )
# get the release
release="main"
if [[ "$VERSION" == *-rc* ]]; then
release="testing"
fi
if [ $DOCKER_EXPERIMENTAL ] || [[ "$VERSION" == *-dev ]] || [ -n "$(git status --porcelain)" ]; then
release="experimental"
fi
for distro in "${distros[@]}"; do
# Setup the yum repo
REPO=$YUMDIR/$release/$distro
for dir in contrib/builder/rpm/${PACKAGE_ARCH}/$distro-*/; do
version="$(basename "$dir")"
suite="${version##*-}"
# if the directory does not exist, initialize the yum repo
if [[ ! -d $REPO/$suite/Packages ]]; then
mkdir -p "$REPO/$suite/Packages"
createrepo --pretty "$REPO/$suite"
fi
# path to rpms
RPMFILE=( "bundles/$VERSION/build-rpm/$version/RPMS/"*"/docker-engine"*.rpm "bundles/$VERSION/build-rpm/$version/SRPMS/docker-engine"*.rpm )
# if we have a $GPG_PASSPHRASE we may as well
# sign the rpms before adding to repo
if [ ! -z $GPG_PASSPHRASE ]; then
# export our key to rpm import
gpg --armor --export "$GPG_KEYID" > /tmp/gpg
rpm --import /tmp/gpg
# sign the rpms
echo "yes" | setsid rpm \
--define "_gpg_name $GPG_KEYID" \
--define "_signature gpg" \
--define "__gpg_check_password_cmd /bin/true" \
--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}" \
--resign "${RPMFILE[@]}"
fi
# copy the rpms to the packages folder
cp "${RPMFILE[@]}" "$REPO/$suite/Packages"
# update the repo
createrepo --pretty --update "$REPO/$suite"
done
done