script to list the latest release of each library

Change-Id: Iec427e01d3e7ce05c861bec33185d5b24aaa24d0
This commit is contained in:
Doug Hellmann 2015-02-02 18:12:20 -05:00
parent f93a75f9ea
commit 8a6e21c7ac
1 changed files with 58 additions and 0 deletions

58
list_latest_releases.sh Executable file
View File

@ -0,0 +1,58 @@
#!/bin/bash
#
# 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.
#
# Show the latest tags for all Oslo projects as an approximation for
# reporting on which releases exist.
bindir=$(cd $(dirname $0) && pwd)
repodir=$(cd $bindir/../../.. && pwd)
# Make sure no pager is configured so the output is not blocked
export PAGER=
if [ -z "$*" ]
then
libs=$($bindir/list_oslo_projects.py | egrep -v -e '(oslo.version|cookiecutter|incubator)')
else
libs="$*"
fi
# Assuming the tags were created in chronological order, get the most
# recent one. This will break if we ever go back and create a patch
# release.
function get_last_tag {
git for-each-ref --sort=taggerdate --format '%(refname)' refs/tags \
| sed -e 's|refs/tags/||' \
| ${bindir}/highest_semver.py
}
function list_versions {
# Show the tag for each library
for lib in $*
do
the_date=""
cd $repodir/$lib
highest_tag=$(get_last_tag)
if [ -z "$highest_tag" ]
then
the_date="0000-00-00 00:00:00 +0000"
highest_tag="UNRELEASED"
else
the_date=$(git log -q --format='format:%ci' -n 1 $highest_tag)
fi
echo $the_date $lib $highest_tag
done
}
list_versions $libs | sort -nr