forked from ClusterLabs/pacemaker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bumplibs.sh
executable file
·100 lines (88 loc) · 3.19 KB
/
bumplibs.sh
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#!/bin/bash
declare -A headers
headers[crmcommon]="include/crm/common include/crm/crm.h"
headers[crmcluster]="include/crm/cluster.h"
headers[transitioner]="include/crm/transition.h"
headers[cib]="include/crm/cib.h include/crm/cib/util.h"
headers[pe_rules]="include/crm/pengine/rules.h"
headers[pe_status]="include/crm/pengine/common.h include/crm/pengine/complex.h include/crm/pengine/rules.h include/crm/pengine/status.h"
headers[pengine]="include/crm/pengine/common.h include/crm/pengine/complex.h include/crm/pengine/rules.h include/crm/pengine/status.h"
headers[stonithd]="include/crm/stonith-ng.h"
headers[lrmd]="include/crm/lrmd.h"
LAST_RELEASE=`test -e /Volumes || git tag -l | grep Pacemaker | grep -v rc | sort -Vr | head -n 1`
for lib in crmcommon crmcluster transitioner cib pe_rules pe_status stonithd pengine lrmd; do
git diff -w $LAST_RELEASE..HEAD ${headers[$lib]}
echo ""
am=`find . -name Makefile.am -exec grep -lr "lib${lib}_la.*version-info" \{\} \;`
am_dir=`dirname $am`
if
grep "lib${lib}_la_SOURCES.*\\\\" $am
then
echo -e "\033[1;35m -- Sources list for lib$lib is probably truncated! --\033[0m"
echo ""
fi
sources=`grep "lib${lib}_la_SOURCES" $am | sed s/.*=// | sed 's:$(top_builddir)/::' | sed 's:$(top_srcdir)/::' | sed 's:\\\::' | sed 's:$(libpe_rules_la_SOURCES):rules.c\ common.c:'`
full_sources=""
for f in $sources; do
if
echo $f | grep -q "/"
then
full_sources="$full_sources $f"
else
full_sources="$full_sources $am_dir/$f"
fi
done
lines=`git diff -w $LAST_RELEASE..HEAD ${headers[$lib]} $full_sources | wc -l`
if [ $lines -gt 0 ]; then
echo "- Headers: ${headers[$lib]}"
echo "- Sources: $full_sources"
echo "- Changed Sources since $LAST_RELEASE:"
git diff -w $LAST_RELEASE..HEAD --stat $full_sources
echo ""
read -p "Are the changes to lib$lib: [a]dditions, [r]emovals or [f]ixes? [None]: " CHANGE
git show $LAST_RELEASE:$am | grep version-info
VER=`git show $LAST_RELEASE:$am | grep "lib.*${lib}_la.*version-info" | sed s/.*version-info// | awk '{print $1}'`
VER_NOW=`grep "lib.*${lib}_la.*version-info" $am | sed s/.*version-info// | awk '{print $1}'`
VER_1=`echo $VER | awk -F: '{print $1}'`
VER_2=`echo $VER | awk -F: '{print $2}'`
VER_3=`echo $VER | awk -F: '{print $3}'`
VER_1_NOW=`echo $VER_NOW | awk -F: '{print $1}'`
case $CHANGE in
A|a)
echo "New version with backwards compatible extensions: x+1:0:z+1"
VER_1=`expr $VER_1 + 1`
VER_2=0
VER_3=`expr $VER_3 + 1`
;;
R|r)
echo "New backwards incompatible version: x+1:0:0"
VER_1=`expr $VER_1 + 1`
VER_2=0
VER_3=0
for h in ${headers[$lib]}; do
sed -i.sed "s/lib${lib}.so.${VER_1_NOW}/lib${lib}.so.${VER_1}/" $h
done
;;
F|f)
echo "Bugfix: x:y+1:z"
VER_2=`expr $VER_2 + 1`
;;
esac
VER_NEW=$VER_1:$VER_2:$VER_3
if [ ! -z $CHANGE ]; then
if [ $VER_NEW != $VER_NOW ]; then
echo "Updating $lib library version: $VER -> $VER_NEW"
sed -i.sed "s/version-info\ $VER_NOW/version-info\ $VER_NEW/" $am
else
echo "No further version changes needed"
fi
else
echo "Skipping $lib version"
fi
else
echo "No changes to $lib interface"
fi
read -p "Continue?"
echo ""
done
git diff -w