Merge branch 'stable'

This commit is contained in:
Jean-Sébastien Pédron 2017-01-23 12:03:10 +01:00
commit e8d5465584
No known key found for this signature in database
GPG Key ID: 39E99761A5FD94CC
7 changed files with 153 additions and 69 deletions

View File

@ -7,51 +7,102 @@ endif
ifneq ($(words $(SOURCE_DIST_FILE)),1)
$(error Multiple source archives found; please specify SOURCE_DIST_FILE)
endif
endif
VERSION ?= $(patsubst rabbitmq-server-%.tar.xz,%,$(notdir $(SOURCE_DIST_FILE)))
ifeq ($(VERSION),)
$(error Cannot determine version; please specify VERSION)
endif
# $(DEBIAN_VERSION) doesn't include the package revision: this one is
# only set in debian/changelog.
DEBIAN_VERSION = $(subst -,~,$(VERSION))
DEBIAN_ORIG_TARBALL = rabbitmq-server_$(DEBIAN_VERSION).orig.tar.xz
UNPACKED_DIR = $(patsubst %.tar.xz,%,$(notdir $(SOURCE_DIST_FILE)))
DEB_HOST_ARCH = $(shell dpkg-architecture -qDEB_HOST_ARCH)
CHANGES_FILE = rabbitmq-server_$(DEBIAN_VERSION)-*_$(DEB_HOST_ARCH).changes
# Package signing.
#
# At least the key ID is mandatory ($(SIGNING_KEY)). If it's set, we
# enable signing in dpkg-build-package(1), otherwise we ask for an
# unsigned package.
#
# To maintain backward compatibility, the caller can also specify
# $(GNUPG_PATH) and we set GNUPGHOME accordingly.
ifneq ($(SIGNING_KEY),)
SIGNING_FLAG = -k$(SIGNING_KEY)
ifneq ($(GNUPG_PATH),)
GNUPGHOME = $(GNUPG_PATH)/.gnupg
export GNUPGHOME
endif
DEBIAN_ORIG_TARBALL = rabbitmq-server_$(VERSION).orig.tar.xz
UNPACKED_DIR = rabbitmq-server-$(VERSION)
PACKAGENAME = rabbitmq-server
ifneq "$(UNOFFICIAL_RELEASE)" ""
SIGNING=-us -uc
else
SIGNING=-k$(SIGNING_KEY)
SIGNING_FLAG = -us -uc
endif
unexport DEPS_DIR
unexport ERL_LIBS
MAKEOVERRIDES =
.PHONY: all package clean
all: package
@:
package: clean
cp -a $(SOURCE_DIST_FILE) $(DEBIAN_ORIG_TARBALL)
xzcat $(DEBIAN_ORIG_TARBALL) | tar -xf -
# If a signing key ID was specified, verify that the key is available
# before starting a possibly long build. At the same time, display some
# useful informations on the key so the caller can double-check if he
# wants.
@set -e; \
if test "$(SIGNING_KEY)"; then \
echo; \
echo '--------------------------------------------------'; \
echo "The package will be signed with key $(SIGNING_KEY):"; \
gpg -K "$(SIGNING_KEY)"; \
echo '--------------------------------------------------'; \
echo; \
fi
# Because we are creating a source package as well, Debian expects the
# source archive to have a specially formatted name. Copy the original
# archive to a correctly named file.
cp -a "$(SOURCE_DIST_FILE)" "$(DEBIAN_ORIG_TARBALL)"
# Prepare the source directory: we extract the source archive and copy
# the debian/ subdirectory.
xzcat "$(DEBIAN_ORIG_TARBALL)" | tar -xf -
rsync -a \
--exclude '.sw?' --exclude '.*.sw?' \
--exclude '.git*' \
--delete --delete-excluded \
debian/ $(UNPACKED_DIR)/debian/
UNOFFICIAL_RELEASE=$(UNOFFICIAL_RELEASE) VERSION=$(VERSION) ./check-changelog.sh rabbitmq-server $(UNPACKED_DIR)
cd $(UNPACKED_DIR); GNUPGHOME=$(GNUPG_PATH)/.gnupg dpkg-buildpackage -sa $(SIGNING)
rm -rf $(UNPACKED_DIR)
debian/ "$(UNPACKED_DIR)/debian/"
# Possibly update debian/changelog (in the created source directory):
# - if it contains an entry for the specified version, do nothing;
# - otherwise, prepend a generated entry using "1" as the package
# revision.
cd "$(UNPACKED_DIR)"; \
../scripts/update-changelog.sh "$(DEBIAN_VERSION)"
# Finally build the package! We ask for both the source package and one
# or more binary packages.
cd "$(UNPACKED_DIR)"; \
dpkg-buildpackage -sa $(SIGNING_FLAG)
# Before we remove the source directory, copy the possibly updated
# debian/changelog to the original debian subdirectory, if the caller
# asks for it. He is then responsible for committing it.
if test "$(SAVE_DEBIAN_CHANGELOG)" = 'yes'; then \
cp -a "$(UNPACKED_DIR)/debian/changelog" debian/changelog; \
fi
rm -rf "$(UNPACKED_DIR)"
# If $(PACKAGES_DIR) is specified, move all package files to that
# location.
if test "$(PACKAGES_DIR)"; then \
mkdir -p "$(PACKAGES_DIR)"; \
mv $(PACKAGENAME)_$(VERSION)* "$(PACKAGES_DIR)"; \
mv $$(./scripts/get-debian-package-files-list.sh $(CHANGES_FILE)) \
"$(PACKAGES_DIR)"; \
fi
clean:
rm -rf $(UNPACKED_DIR)
rm -f $(DEBIAN_ORIG_TARBALL)
rm -f $(PACKAGENAME)_*.debian.tar.gz
rm -f $(PACKAGENAME)_*.dsc
rm -f $(PACKAGENAME)_*_*.changes
rm -f $(PACKAGENAME)_*_*.deb
./scripts/get-debian-package-files-list.sh $(CHANGES_FILE) | xargs rm -f

View File

@ -1,9 +0,0 @@
# This file contains additional comments for the debian/changelog to be
# appended within the current version's changelog entry.
# Each line will be a separate comment. Do not begin with an *, dch will
# add that.
# For comments longer than one line do not put a line break and dch will
# neatly format it.
# Shell comments are ignored.
#
Changed Uploaders from Emile Joubert to Blair Hester

View File

@ -1,11 +0,0 @@
# This file contains additional comments for the debian/changelog to be
# appended within the current version's changelog entry.
# Each line will be a separate comment. Do not begin with an *, dch will
# add that.
# For comments longer than one line do not put a line break and dch will
# neatly format it.
# Shell comments are ignored.
#
# Examples:
#Remove parts made of undercooked chicken
#This is a long line which is the beginning of a long two line comment which I am sure is going to be needed if the script cannot handle it

View File

@ -1,29 +0,0 @@
#!/bin/sh
PACKAGE_NAME=$1
cd $2
CHANGELOG_VERSION=$(dpkg-parsechangelog | sed -n 's/^Version: \(.*\)-[^-]*$/\1/p')
if [ "${CHANGELOG_VERSION}" != "${VERSION}" ]; then
if [ -n "${UNOFFICIAL_RELEASE}" ]; then
echo "${PACKAGE_NAME} (${VERSION}-1) unstable; urgency=low" > debian/changelog.tmp
echo >> debian/changelog.tmp
echo " * Unofficial release" >> debian/changelog.tmp
echo >> debian/changelog.tmp
echo " -- Nobody <nobody@example.com> $(date -R)" >> debian/changelog.tmp
echo >> debian/changelog.tmp
cat debian/changelog >> debian/changelog.tmp
mv -f debian/changelog.tmp debian/changelog
exit 0
else
echo
echo There is no entry in debian/changelog for version ${VERSION}!
echo Please create a changelog entry, or set the variable
echo UNOFFICIAL_RELEASE to automatically create one.
echo
exit 1
fi
fi

View File

@ -0,0 +1,22 @@
#!/usr/bin/env python2
import apt_pkg
import os.path
import sys
if len(sys.argv) != 3:
print('Syntax: %s <version a> <version b>' % (os.path.basename(sys.argv[0])))
sys.exit(64)
a = sys.argv[1]
b = sys.argv[2]
apt_pkg.init_system()
vc = apt_pkg.version_compare(a,b)
if vc > 0:
print('%s < %s' % (b, a))
elif vc == 0:
print('%s = %s' % (a, b))
elif vc < 0:
print('%s < %s' % (a, b))

View File

@ -0,0 +1,33 @@
#!/bin/sh
set -e
changes_file=$1
if [ -z "$changes_file" ]; then
echo "Syntax: $(basename $0) <changes file>" 1>&2
exit 64
fi
if [ ! -f "$changes_file" ]; then
exit 0
fi
changes_file_dir=$(dirname "$changes_file")
if test "$changes_file_dir" = '.'; then
changes_file_dir=
else
changes_file_dir="$changes_file_dir/"
fi
# Include the .changes file itself in the list.
echo "$changes_file_dir$(basename "$changes_file")"
# We want to match lines with the following format (it starts
# with a single space):
# f752d307528f0ca87d57995c217344ec 5184732 net extra rabbitmq-(...)
awk '
/^ [a-fA-F0-9]+ / {
if (length($1) == 32) {
print "'$changes_file_dir'" $5;
}
}' < "$changes_file"

View File

@ -0,0 +1,27 @@
#!/bin/sh
PACKAGE_VERSION=$1
PACKAGE_NAME=$(awk '/^Source:/ { print $2; }' < debian/control)
CHANGELOG_VERSION=$(dpkg-parsechangelog | sed -n 's/^Version: \(.*\)-[^-]*$/\1/p')
CHANGELOG_DATE=$(date -R)
if [ "${CHANGELOG_VERSION}" != "${PACKAGE_VERSION}" ]; then
cat > debian/changelog.tmp <<EOF
${PACKAGE_NAME} (${PACKAGE_VERSION}-1) unstable; urgency=low
* New Upstream Release.
-- RabbitMQ Team <info@rabbitmq.com> ${CHANGELOG_DATE}
EOF
cat debian/changelog >> debian/changelog.tmp
mv -f debian/changelog.tmp debian/changelog
fi
echo
echo '--------------------------------------------------'
dpkg-parsechangelog
echo '--------------------------------------------------'
echo