File: arb_create_patch.sh

package info (click to toggle)
arb 6.0.6-8
  • links: PTS, VCS
  • area: non-free
  • in suites: sid, trixie
  • size: 66,204 kB
  • sloc: ansic: 394,911; cpp: 250,290; makefile: 19,644; sh: 15,879; perl: 10,473; fortran: 6,019; ruby: 683; xml: 503; python: 53; awk: 32
file content (68 lines) | stat: -rwxr-xr-x 2,421 bytes parent folder | download | duplicates (6)
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
#!/bin/bash -x

NAME=$1
if [ -z "$NAME" ]; then
    echo "Usage: arb_create_patch.sh name"
    false
else
    if [ ! -d "$ARBHOME" ]; then
        echo "No patch created (ARBHOME undefined)"
    else
        if [ ! -d $ARBHOME/.svn ]; then
            echo "No patch created (no SVN checkout in ARBHOME)"
        else
            cd $ARBHOME
            PATCHDIR=./patches.arb
            mkdir -p $PATCHDIR
            DATE=`date '+%Y%m%d_%H%M%S'`
            PATCHNAME=${NAME}_$DATE
            PATCH=$PATCHDIR/$PATCHNAME.patch
            FAKEPATCH=$PATCHDIR/fake.patch
            RECENT_PATCH=./latest.patch
            INTERDIFF_PATCH=./interdiff.patch
            IGNORE_WHITE_PATCH=./latest_iwhite.patch
            WHITE_PATCH=./white.patch

            svn diff > $PATCH
            
            if [ -e $PATCH ]; then
                if [ ! -s $PATCH ]; then
                    rm $PATCH
                    if [ ! -e $FAKEPATCH ]; then
                        echo "Index: No changes" > $FAKEPATCH
                        echo "===================================================================" >> $FAKEPATCH
                    fi
                    ln --force $FAKEPATCH $RECENT_PATCH
                    touch $FAKEPATCH
                    rm -f $INTERDIFF_PATCH $IGNORE_WHITE_PATCH $WHITE_PATCH
                    echo "No patch generated (no diff)"
                else
                    DIFF=1
                    INTER=0
                    if [ -e $RECENT_PATCH ]; then
                        DIFF=`diff $PATCH $RECENT_PATCH | wc -l`
                        INTER=DIFF
                    fi

                    if [ $DIFF = 0 ]; then
                        echo "No patch generated (same as last patch)"
                        rm $PATCH
                        rm -f $INTERDIFF_PATCH
                    else
                        (   svn diff -x -b > $IGNORE_WHITE_PATCH ; \
                            interdiff $PATCH $IGNORE_WHITE_PATCH > $WHITE_PATCH ) &

                        if [ $INTER != 0 ]; then
                            interdiff -w $RECENT_PATCH $PATCH > $INTERDIFF_PATCH
                        else
                            rm -f $INTERDIFF_PATCH
                        fi
                        ln --force $PATCH $RECENT_PATCH
                        ls -hog $PATCH $RECENT_PATCH
                    fi
                fi
            fi
        fi
    fi
fi