better handling of stable flag

Only report releases as part of the "stable" series if they are not
pre-releases and they are not the first release in a series.

Tag releases as either "release" for full releases, or "development
milestone" or "release candidate" for pre-releases.

Change-Id: I493b8390170ecd52b9033e0f33329d840e1f087d
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
Doug Hellmann 2016-02-26 14:44:58 -05:00
parent a79bcb2c61
commit b8f4603c23
4 changed files with 49 additions and 10 deletions

View File

@ -66,7 +66,7 @@ fi
# Look for the previous version on the same branch. If the command
# fails because there are no other tags, we will produce the entire
# history.
PREVIOUS_VERSION=$(git describe --abbrev=0 ${VERSION}^ || echo "")
PREVIOUS_VERSION=$(git describe --abbrev=0 ${VERSION}^ 2>/dev/null || echo "")
if [[ "$PREVIOUS_VERSION" = "" ]]; then
# There was no previous tag, so we're looking for the full history
# of the project.
@ -107,6 +107,9 @@ function get_tag_meta {
# The series name is part of the commit message left by release.sh.
SERIES=$(get_tag_meta series)
# The type of release this is.
RELEASETYPE=$(get_tag_meta release-type)
# The recipient for announcements is part of the commit message left
# by release.sh.
ANNOUNCE=$(get_tag_meta announce)
@ -114,9 +117,20 @@ if [[ ! -z "$ANNOUNCE" ]]; then
email_to="--email-to $ANNOUNCE"
fi
# Figure out if that series is a stable branch or not.
if git branch -a | grep -q origin/stable/$SERIES; then
stable="--stable"
# Figure out if that series is a stable branch or not. We don't
# release pre-releases on stable branches, so we only need to check
# for stable if the release type is a normal release.
if [[ $RELEASETYPE = "release" ]]; then
if git branch -a | grep -q origin/stable/$SERIES; then
stable="--stable"
fi
fi
# If this is the first full release in a series, it isn't "stable"
# yet.
FIRST_FULL=$(get_tag_meta first)
if [[ $FIRST_FULL = "yes" ]]; then
stable=""
fi
# Set up email tags for the project owner.

View File

@ -19,11 +19,17 @@ from __future__ import print_function
import argparse
import os.path
import re
import subprocess
import yaml
PRE_RELEASE_RE = re.compile('''
\.(\d+(?:[ab]|rc)+\d*)$
''', flags=re.VERBOSE | re.UNICODE)
def find_modified_deliverable_files(reporoot):
"Return a list of files modified by the most recent commit."
results = subprocess.check_output(
@ -42,7 +48,9 @@ def get_modified_deliverable_file_content(reporoot, filenames):
"""Return a sequence of tuples containing the new versions.
Return tuples containing (deliverable name, series name, version
number, list of repositories).
number, repository name, hash SHA, include pypi link, first full
version)
"""
# Determine which deliverable files to process by taking our
# command line arguments or by scanning the git repository
@ -93,11 +101,21 @@ def get_modified_deliverable_file_content(reporoot, filenames):
}
version = deliverable_data['releases'][-1]['version']
this_version = all_versions[version]
final_versions = [
r['version']
for r in deliverable_data['releases']
if not PRE_RELEASE_RE.search(r['version'])
]
first_full_release = 'yes' if (
final_versions and
this_version['version'] == final_versions[0]
) else 'no'
for project in this_version['projects']:
yield (deliverable_name, series_name, version,
project['repo'], project['hash'],
send_announcements_to,
include_pypi_link)
include_pypi_link,
first_full_release)
def main():

View File

@ -40,12 +40,18 @@ VERSION=$3
SHA=$4
ANNOUNCE=$5
INCLUDE_PYPI=${6:-no}
FIRST_FULL=${7:-no}
SHORTNAME=`basename $REPO`
RELEASETYPE="release"
if [[ $VERSION =~ .*\.0[b,r].+ ]]; then
pre_release_pat='\.[[:digit:]]+[ab][[:digit:]]+'
rc_release_pat='\.[[:digit:]]+rc[[:digit:]]+'
if [[ $VERSION =~ $pre_release_pat ]]; then
RELEASETYPE="development milestone"
elif [[ $VERSION =~ $rc_release_pat ]]; then
RELEASETYPE="release candidate"
else
RELEASETYPE="release"
fi
setup_temp_space release-tag-$SHORTNAME
@ -76,6 +82,7 @@ meta:series: $SERIES
meta:release-type: $RELEASETYPE
meta:announce: $ANNOUNCE
meta:pypi: $INCLUDE_PYPI
meta:first: $FIRST_FULL
"
echo "Tag message is '$TAGMSG'"
git tag -m "$TAGMSG" -s "$VERSION" $TARGETSHA

View File

@ -42,9 +42,9 @@ shift
DELIVERABLES="$@"
$TOOLSDIR/list_deliverable_changes.py -r $RELEASES_REPO $DELIVERABLES \
| while read deliverable series version repo hash announce_to pypi; do
| while read deliverable series version repo hash announce_to pypi first_full; do
title "$repo $series $version $hash $announce_to"
$TOOLSDIR/release.sh $repo $series $version $hash $announce_to $pypi
$TOOLSDIR/release.sh $repo $series $version $hash $announce_to $pypi $first_full
done
exit 0