blob: 048ebd103fc65a0daf40dbdf26f323afc4f8e96e [file] [log] [blame]
#!/bin/bash
# Simple script to make use of the data produced by "audit" script
# (which determines parents of stable commits and tags of parents)
# You *have* to run the audit script on release X before you can
# use this script to analyse the audit data for release X.
#
# Audit data is used to analyse whether the commit should be considered
# for placement on the tree of interest, or whether it can be ruled
# out immediately by nature of being already present.
#
# Also determine if the parent happens to be already cherry picked into
# the stable release of interest, or in a queue of commits already
# selected, but not yet tagged and released.
#
# You start by running this once against your own stable tree and store
# that away in MYSTABLE_AUDIT -- this creates a baseline list of existing
# stable commits in your tree and what ".x" that they appeared in (this
# may seem pointless but will be used when you start auditing other
# stable trees to compare to what is in your tree.)
#
# The idea is that you run this once, and then manually update the
# output for 1 or 2 kooky commits that don't have clear parentage.
#
# If another dot/extraversion is released since this was run, you
# should specify a start extraversion and then just append the new
# data to your existing data for all the previous extraversions.
#
# My working tree version, i.e. where I want to add commits
MYSTABLE=34
# Where to find the output of this script for $MYSTABLE itself
# We use this data to rule out parent commits that are already cherry
# picked onto a tagged $MYSTABLE.x release. (This can be an empty
# file to avoid a chicken and egg when 1st auditing your own stable tree).
MYSTABLE_AUDIT=../00-audit_$MYSTABLE/analyse.txt
# Where to find a list of parent commit IDs that have already been poached
# and queued, that we should skip over when running this audit. (i.e. if
# auditing v2.6.35, we want to skip what we've already stolen from v2.6.32)
MYQUEUE=../00-audit_32/stolen-from-32-stable
# Another stable tree that I want to look at for candidate commits
VER=v2.6.$1
if [ -z "$1" ];then
echo "Usage: analyse <VERSION> [<EXTRAVERSION>]"
echo -e \\t example: \"analyse 32 26\"
echo -e \\t will examine v2.6.32 commits added after v2.6.32.26
echo -e \\t Starts at EXTRAVERSION=0 if not specified.
echo -e \\t Current destination tree is v2.6.$MYSTABLE - edit script to change.
exit 1
fi
git rev-parse --verify --quiet $VER > /dev/null
if [ $? != 0 ]; then
echo $ver does not appear to be a valid tag.
exit 1
fi
if [ -n "$2" ];then
START=$2
else
START=0
fi
# How many dot releases are there?
DOTS=`git tag |grep $VER'\.[0-9]\+'|wc -l`
if [ $DOTS -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 $DOTS ] ; do
if [ $i -eq 0 ]; then
LAST=$VER
else
LAST=$VER.$i
fi
i=$[$i+1]
THIS=$VER.$i
# Note the commit ID for the version change in the Makefile
MAKEFILE=`git rev-list ^$THIS^ $THIS|sed 's/\(^.\{8\}\).*/\1/'`
echo ---- $VER.$i ----
echo -e Commit\\t\\tParent\\t\\tParent in\\tIn $MYSTABLE.x\\t\\tNotes
echo ========================================================================
for j in `git rev-list $LAST..$THIS | sed 's/\(^.\{8\}\).*/\1/'` ; do
FOUND=0
DOT=""
DOT_COMMIT=""
STABLE=""
PARENT=`cat $THIS/$j/parent | sed 's/\(^.\{8\}\).*/\1/'`
LEN=`cat $THIS/$j/parent|wc -c`
TAG=`cat $THIS/$j/tag-contains | grep -v v2\.6\.[123][0-9][\.-]| grep -v v3\.[0-9]*[\.-] | head -n1`
# this will round up a X-rcN release to a yet unreleased "X"
if [ -z "$TAG" ]; then
TAG=`cat $THIS/$j/tag-contains | head -n1`
TAG=`echo $TAG|sed 's/-rc[0-9]*//'`
fi
# imagine we are in dev cycle and there is no "tag --contains" yet.
if [ -f $THIS/$j/tag-contains ] && [ ! -s $THIS/$j/tag-contains ]; then
L=`git tag|grep -v -- -rc |tail -n1 `
MINOR=`echo $L|sed 's/.*\.\([0-9]*\)$/\1/'`
NMINOR=$[$MINOR+1]
TAG=`echo $L |sed s/$MINOR$/$NMINOR/`
fi
echo -ne $j \\t
if [ "$j" = "$MAKEFILE" ]; then
echo -e xxxxxxxx\\t-- \? -- \\tn/a\\tMakefile ver. change
continue
fi
grep -q unknown $THIS/$j/parent
if [ $? = 0 ]; then
echo -e xxxxxxxx\\t-- \? -- \\t\?
continue
fi
# Check for garbage strings that arent SHA.
if [ "$LEN" != "41" ]; then
echo -e xxxxxxxx\\t-- \? -- \\t\?
continue
fi
echo -ne $PARENT\\t
if [ "$TAG" != "" ]; then
echo -ne $TAG\\t\\t
else
echo -ne ???????\\t\\t
fi
grep -q v2.6.$MYSTABLE $THIS/$j/tag-contains
if [ $? = 0 ] ; then
FOUND=1
fi
# Check the already tagged commits on our own stable tree.
if [ $FOUND = 0 ] ; then
DOT=`grep $PARENT $MYSTABLE_AUDIT|awk '{print $5}'`
DOT_COMMIT=`grep $PARENT $MYSTABLE_AUDIT|awk '{print $1}'`
if [ "$DOT" != "" ]; then
STABLE="\\t$DOT $DOT_COMMIT"
FOUND=1
fi
fi
# Check things already stolen and queued from other stable
if [ $FOUND = 0 ] ; then
grep -q $PARENT $MYQUEUE
if [ $? = 0 ]; then
STABLE="\\tin queue already"
FOUND=1
fi
fi
# Check to see if we are just auditing ourself for a baseline
if [ "$MYSTABLE" = "$1" ] ; then
STABLE="\\t$MYSTABLE.$i"
FOUND=1
fi
if [ $FOUND = 1 ] ; then
echo -e y$STABLE
else
echo n
fi
done
done