import the dependencies needed for creating stable branches

We have the script to create stable branches from the deliverable files,
but the thing it calls wasn't imported at the same time. This patch
moves the needed pieces from the release-tools repo to project-config so
they are all in the same place.

Change-Id: Ic4c3b68e1c98bda3dcbbc37ecc5f39ad5ac8f57f
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
Doug Hellmann 2016-08-23 12:57:47 -04:00
parent 8be8a60e32
commit 93cc7a52e3
3 changed files with 103 additions and 3 deletions

View File

@ -17,7 +17,7 @@
# License for the specific language governing permissions and limitations
# under the License.
set -e
set -ex
TOOLSDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source $TOOLSDIR/functions
@ -44,8 +44,8 @@ shift
DELIVERABLES="$@"
$TOOLSDIR/list_deliverable_changes.py -r $RELEASES_REPO $DELIVERABLES \
| while read deliverable ignore_series version repo ignore_hash ignore_announce_to pypi ignore_first_full; do
echo "$deliverable $version $repo"
| while read deliverable series version diff_start repo hash announce_to pypi first_full; do
echo "$SERIES $repo $version"
$TOOLSDIR/make_stable_branch.sh $SERIES $repo $version
done

View File

@ -73,6 +73,25 @@ defaultbranch=$branch"
}
function update_upper_constraints {
typeset branch="$1"
typeset uc_server='git.openstack.org'
typeset uc_path='cgit/openstack/requirements/plain/upper-constraints.txt'
typeset uc_url="https://${uc_server}/${uc_path}?h=${branch}"
echo "Updating tox.ini for upper-constraints"
git checkout $branch
sed -i~ -e "s,-c.*{\(env:UPPER_CONSTRAINTS_FILE\)[^ ]*} ,-c{\1:$uc_url}," tox.ini
if ! git diff --exit-code >/dev/null 2>&1 ; then
git add tox.ini
git commit -m "Update UPPER_CONSTRAINTS_FILE for $branch"
git show
local shortbranch=$(basename $branch)
git review -t "create-${shortbranch}"
fi
}
function clone_repo {
typeset repo="$1"
typeset branch="$2"

View File

@ -0,0 +1,81 @@
#!/bin/bash
#
# Script to cut stable/foo release branch of a project
#
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
set -e
if [[ $# -lt 3 ]]; then
echo "Usage: $0 series repo_name version"
echo
echo "Example: $0 kilo openstack/oslo.config 1.9.2"
exit 2
fi
TOOLSDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source $TOOLSDIR/functions
SERIES=$1
REPO=$2
VERSION=$3
LPROJECT="$PROJECT"
PROJECT=$(basename $REPO)
NEW_BRANCH="stable/$SERIES"
setup_temp_space stable-branch-$PROJECT-$SERIES
clone_repo $REPO
cd $REPO
LANG=C git review -s
if $(git branch -r | grep $NEW_BRANCH > /dev/null); then
echo "A $NEW_BRANCH branch already exists !"
cd ../..
rm -rf $MYTMPDIR
exit 1
fi
echo "Creating $NEW_BRANCH from $VERSION"
git branch $NEW_BRANCH $VERSION
REALSHA=`git show-ref -s $NEW_BRANCH`
git push gerrit $NEW_BRANCH
update_gitreview "$NEW_BRANCH"
update_upper_constraints "$NEW_BRANCH"
if [[ -d releasenotes/source ]]; then
# Also update the reno settings, in master
echo "Updating reno"
git checkout master
shortbranch=$(basename $NEW_BRANCH)
commit_msg="Update reno for $NEW_BRANCH"
titlebranch=$(python -c "print('$shortbranch'.title())")
cat - > releasenotes/source/${shortbranch}.rst <<EOF
===================================
$titlebranch Series Release Notes
===================================
.. release-notes::
:branch: origin/$NEW_BRANCH
EOF
echo " $shortbranch" >> releasenotes/source/index.rst
git add releasenotes/source/index.rst releasenotes/source/${shortbranch}.rst
git commit -m "$commit_msg"
git show
git review -t "reno-${shortbranch}"
else
echo "$REPO does not use reno, no update needed"
fi