tools: Simplify grep_all.sh

Branches and tags are really just refs in git so rather than
open-codeing that and having 2 for loops just call everything a ref.

While we're there sort tags in reverse order this has the cosmetic
advantage that series are chronological order ie:

    1.1.0-1215-g8dc48120  : openstackdocstheme===1.18.1
    origin/master         : openstackdocstheme===1.18.1
    origin/stable/newton  : openstackdocstheme===1.5.0
    origin/stable/ocata   : openstackdocstheme===1.6.1
    origin/stable/pike    : openstackdocstheme===1.16.1
    folsom-eol            :
    grizzly-eol           :
    havana-eol            :
    icehouse-eol          :
    juno-eol              :
    kilo-eol              : openstackdocstheme===1.1.0
    liberty-eol           : openstackdocstheme===1.2.6
    mitaka-eol            : openstackdocstheme===1.3.0
becomes:
    1.1.0-1215-g8dc48120  : openstackdocstheme===1.18.1
    origin/master         : openstackdocstheme===1.18.1
    origin/stable/newton  : openstackdocstheme===1.5.0
    origin/stable/ocata   : openstackdocstheme===1.6.1
    origin/stable/pike    : openstackdocstheme===1.16.1
    mitaka-eol            : openstackdocstheme===1.3.0
    liberty-eol           : openstackdocstheme===1.2.6
    kilo-eol              : openstackdocstheme===1.1.0
    juno-eol              :
    icehouse-eol          :
    havana-eol            :
    grizzly-eol           :
    folsom-eol            :

Change-Id: If32cb11f1bcd3aefdc3717d3e943b0fa15a42002
This commit is contained in:
Tony Breeds 2018-01-24 16:07:20 +11:00
parent 8dc4812029
commit 351b878093

View File

@ -14,10 +14,9 @@
# Note(tonyb): Expand HEAD into something that's hopefully more human
# readable
declare -a branches=($(git describe --always) origin/master)
branches+=($(git branch --no-color -r --list 'origin/stable/*'))
declare -a tags=($(git tag --list '*-eol' | sort))
declare -a refs=($(git describe --always) origin/master)
refs+=($(git branch --no-color -r --list 'origin/stable/*'))
refs+=($(git tag --list '*-eol' | sort -r))
if [ $# -ne 1 ]; then
echo "Usage: $0 dependency-name" 1>&2
@ -29,19 +28,11 @@ function search {
}
printf '\nRequirements\n------------\n'
for branch in ${branches[@]} ; do
printf "%-22s: %s\n" $branch "$(search $1 $branch global-requirements.txt)"
done
echo
for tag in ${tags[@]} ; do
printf "%-22s: %s\n" $tag "$(search $1 $tag global-requirements.txt)"
for ref in ${refs[@]}; do
printf "%-22s: %s\n" $ref "$(search $1 $ref global-requirements.txt)"
done
printf '\nConstraints\n-----------\n'
for branch in ${branches[@]} ; do
printf "%-22s: %s\n" $branch "$(search $1 $branch upper-constraints.txt)"
done
echo
for tag in ${tags[@]} ; do
printf "%-22s: %s\n" $tag "$(search $1 $tag upper-constraints.txt)"
for ref in ${refs[@]}; do
printf "%-22s: %s\n" $ref "$(search $1 $ref upper-constraints.txt)"
done