summaryrefslogtreecommitdiff
path: root/list_latest_releases.sh
blob: 171ae50bc32d89e3cb751c9b3c53ef5f84cee30d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/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

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