~ubuntu-branches/ubuntu/utopic/pacemaker/utopic-proposed

« back to all changes in this revision

Viewing changes to bumplibs.sh

  • Committer: Package Import Robot
  • Author(s): Andres Rodriguez
  • Date: 2013-07-16 16:40:24 UTC
  • mfrom: (1.1.11) (2.2.3 experimental)
  • Revision ID: package-import@ubuntu.com-20130716164024-lvwrf4xivk1wdr3c
Tags: 1.1.9+git20130321-1ubuntu1
* Resync from debian expiremental.
* debian/control:
  - Use lower version for Build-Depends on libcorosync-dev
    and libqb-dev.
  - Build-Depends on libcfg-dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/bash
 
2
 
 
3
declare -A headers
 
4
headers[crmcommon]="include/crm/common include/crm/crm.h"
 
5
headers[crmcluster]="include/crm/cluster.h"
 
6
headers[transitioner]="include/crm/transition.h"
 
7
headers[cib]="include/crm/cib.h include/crm/cib/util.h"
 
8
headers[pe_rules]="include/crm/pengine/rules.h"
 
9
headers[pe_status]="include/crm/pengine/common.h  include/crm/pengine/complex.h  include/crm/pengine/rules.h  include/crm/pengine/status.h"
 
10
headers[pengine]="include/crm/pengine/common.h  include/crm/pengine/complex.h  include/crm/pengine/rules.h  include/crm/pengine/status.h"
 
11
headers[stonithd]="include/crm/stonith-ng.h"
 
12
headers[lrmd]="include/crm/lrmd.h"
 
13
 
 
14
LAST_RELEASE=`test -e /Volumes || git tag -l | grep Pacemaker | sort -Vr | head -n 1`
 
15
for lib in crmcommon crmcluster transitioner cib pe_rules pe_status stonithd pengine lrmd; do
 
16
    git diff -w $LAST_RELEASE..HEAD ${headers[$lib]}
 
17
    echo ""
 
18
 
 
19
    am=`find . -name Makefile.am -exec grep -lr "lib${lib}_la.*version-info" \{\} \;`
 
20
    am_dir=`dirname $am`
 
21
 
 
22
    if
 
23
        grep "lib${lib}_la_SOURCES.*\\\\" $am
 
24
    then
 
25
        echo -e "\033[1;35m -- Sources list for lib$lib is probably truncated! --\033[0m"
 
26
        echo ""
 
27
    fi
 
28
 
 
29
    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:'`
 
30
    full_sources=""
 
31
    for f in $sources; do
 
32
        if
 
33
            echo $f | grep -q "/"
 
34
        then
 
35
            full_sources="$full_sources $f"
 
36
        else
 
37
            full_sources="$full_sources $am_dir/$f"
 
38
        fi
 
39
    done
 
40
 
 
41
    lines=`git diff -w $LAST_RELEASE..HEAD ${headers[$lib]} $full_sources | wc -l`
 
42
 
 
43
    if [ $lines -gt 0 ]; then
 
44
        echo "- Headers: ${headers[$lib]}"
 
45
        echo "- Sources: $full_sources"
 
46
        echo "- Changed Sources since $LAST_RELEASE:"
 
47
        git diff -w $LAST_RELEASE..HEAD --stat $full_sources
 
48
        echo ""
 
49
        read -p "Are the changes to lib$lib: [a]dditions, [r]emovals or [f]ixes? [None]: " CHANGE
 
50
 
 
51
        git show $LAST_RELEASE:$am | grep version-info
 
52
        VER=`git show $LAST_RELEASE:$am | grep "lib.*${lib}_la.*version-info" | sed s/.*version-info// | awk '{print $1}'`
 
53
        VER_NOW=`grep "lib.*${lib}_la.*version-info" $am | sed s/.*version-info// | awk '{print $1}'`
 
54
        VER_1=`echo $VER | awk -F: '{print $1}'`
 
55
        VER_2=`echo $VER | awk -F: '{print $2}'`
 
56
        VER_3=`echo $VER | awk -F: '{print $3}'`
 
57
        VER_1_NOW=`echo $VER_NOW | awk -F: '{print $1}'`
 
58
 
 
59
        case $CHANGE in
 
60
            A|a)
 
61
                echo "New version with backwards compatible extensions: x+1:0:z+1"
 
62
                VER_1=`expr $VER_1 + 1`
 
63
                VER_2=0
 
64
                VER_3=`expr $VER_3 + 1`
 
65
                ;;
 
66
            R|r)
 
67
                echo "New backwards incompatible version: x+1:0:0"
 
68
                VER_1=`expr $VER_1 + 1`
 
69
                VER_2=0
 
70
                VER_3=0
 
71
                for h in ${headers[$lib]}; do
 
72
                    sed -i.sed  "s/lib${lib}.so.${VER_1_NOW}/lib${lib}.so.${VER_1}/" $h
 
73
                done
 
74
                ;;
 
75
            F|f)
 
76
                echo "Bugfix: x:y+1:z"
 
77
                VER_2=`expr $VER_2 + 1`
 
78
                ;;
 
79
        esac
 
80
        VER_NEW=$VER_1:$VER_2:$VER_3
 
81
 
 
82
        if [ ! -z $CHANGE ]; then
 
83
            if [ $VER_NEW != $VER_NOW ]; then
 
84
                echo "Updating $lib library version: $VER -> $VER_NEW"
 
85
                sed -i.sed  "s/version-info\ $VER_NOW/version-info\ $VER_NEW/" $am
 
86
            else
 
87
                echo "No further version changes needed"
 
88
            fi
 
89
        else
 
90
            echo "Skipping $lib version"
 
91
        fi
 
92
    else
 
93
        echo "No changes to $lib interface"
 
94
    fi
 
95
 
 
96
    read -p "Continue?"
 
97
    echo ""
 
98
done
 
99
 
 
100
git diff -w