blob: 60268dc9ca4842f49e01fb1b0f3f50ed9b351dfc [file]
#!/bin/bash
# Simple script to walk the dot releases of a particular version, and
# try and determine the parent upstream commit ID from the commit log.
# The simple regex gets it right most of the time without being overly
# complex.
#
# For each dot release (EXTRAVERSION in the Makefile) a directory is
# created based on the stable commit ID, and in that directory, will
# be a file "parent" with the parent commit ID, and a file containing
# the tags where that commit can be found (we are largely only interested
# in the oldest tag, since we are aiming to determine whether we need
# the commit for our stable tree of interest.)
#
# The "git tag --contains <ID>" operation is not particularly fast,
# so this can take quite a while to run. Supply a start point for
# the audit, if you want to "resume" after a new dot release has
# come out -- i.e. if v2.6.32.27 is released, run "./audit 32 26"
#
# This can be run in a bare clone. It has no need for any checked
# out files, or a need to be on any special commit.
if [ -z "$1" ];then
echo "Usage: audit <VERSION> [<EXTRAVERSION>]"
echo -e \\t example: \"audit 32 26\"
echo -e \\t will audit v2.6.32 for new content added after v2.6.32.26
echo -e \\t Starts at EXTRAVERSION=0 if not specified.
exit 1
fi
ver=v2.6.$1
git rev-parse --verify --quiet $ver > /dev/null
if [ $? != 0 ]; then
echo $ver does not appear to be a valid tag.
exit 1
fi
# How many dot releases are there?
endver=`git tag |grep $ver'\.[0-9]\+'|wc -l`
if [ $endver -eq 0 ];then
echo there doesnt appear to be stable EXTRAVERSION tags for $ver here
exit 1
fi
if [ -n "$2" ];then
START=$2
else
START=0
fi
i=$START
while [ $i -lt $endver ]; do
# There isn't tags for v2.6.3x.0
if [ $i -eq 0 ]; then
begin=$ver
else
begin=$ver.$i
fi
last=$i
i=$[$i+1]
rm -rf $ver.$i
mkdir $ver.$i
git rev-list $begin..$ver.$i |wc -l > $ver.$i/count
echo Working $ver.$i which has `cat $ver.$i/count` new patches.
git rev-list $begin..$ver.$i > $ver.$i/list
echo -n Processing commit...
p=0
for j in `cat $ver.$i/list` ; do
ABBREV=`echo $j|sed 's/\(........\).*/\1/'`
PARENT=`git show $j|grep ommit|grep 'pstream\|herry'|sed 's/.* \([0-9a-f]\+\).*/\1/'`
LEN=`echo $PARENT|wc -c`
# Check for garbage strings that arent SHA.
if [ "$LEN" != "41" ]; then
PARENT=""
fi
mkdir $ver.$i/$ABBREV
if [ -z "$PARENT" ]; then
PARENT="unknown for $j"
echo "unknown for $j" > $ver.$i/$ABBREV/tag-contains
else
git tag --contains $PARENT > $ver.$i/$ABBREV/tag-contains
fi
echo $PARENT > $ver.$i/$ABBREV/parent
p=$[$p+1]
echo -n $p...
done
echo done $ver.$i.
done