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
#!/bin/sh
# 2003-2006, 2008 (c) Etersoft www.etersoft.ru
# Author: Vitaly Lipatov <lav@etersoft.ru>
# Public domain
# Make patch for file in $1 against CVS/SVN repository or .orig file
# load common functions, compatible with local and installed script
. `dirname $0`/../share/eterbuild/functions/common
if [ -f Makefile ] ; then
DD1=`grep ^TOPOBJDIR Makefile | sed -e "s| ||g"`
DD2=`grep ^top_builddir Makefile | sed -e "s| ||g"`
DD3=`grep ^top_srcdir Makefile | sed -e "s| ||g"`
elif [ -f Makefile.in ] ; then
DD1=`grep ^TOPOBJDIR Makefile.in | sed -e "s| ||g"`
DD2=`grep ^top_builddir Makefile.in | sed -e "s| ||g"`
DD3=`grep ^top_srcdir Makefile.in | sed -e "s| ||g"`
else
warning "Can't get topdir from Makefile.in"
fi
if [ -n "$DD1" ] ; then
export $DD1
TOPDIR=$TOPOBJDIR
fi
if [ -n "$DD2" ] ; then
export $DD2
TOPDIR=$top_builddir
fi
if [ -n "$DD3" ] ; then
export $DD3
TOPDIR=$top_srcdir
fi
#test -z "$TOPDIR" && exit 1
#echo "TOPDIR: $TOPDIR"
export TOPDIR
which cvs >/dev/null && CVS=cvs
which svn >/dev/null && SVN=svn
which git >/dev/null && GIT=git
if [ -f $1.orig ] ; then
DIFILE=`realpath $1`
[ -n "$TOPDIR" ] && cd "$TOPDIR"
DIFILE=${DIFILE/`realpath $PWD`\//}
#echo 2 $DIFILE $PWD
diff -purN $DIFILE.orig $DIFILE > $DIFILE.patch
exit 0
fi
if [ -n "$CVS" -a -d CVS ] ; then
DIFILE=`realpath $1`
[ -n "$TOPDIR" ] && cd "$TOPDIR"
DIFILE=${DIFILE/`realpath $PWD`\//}
#echo 1 $DIFILE $PWD
$CVS diff -u $DIFILE > $DIFILE.patch
exit 0
fi
if [ -n "$SVN" -a -d .svn ] ; then
DIFILE=`realpath $1`
[ -n "$TOPDIR" ] && cd "$TOPDIR"
DIFILE=${DIFILE/`realpath $PWD`\//}
#echo 2 $DIFILE $PWD
$SVN diff $DIFILE > $DIFILE.patch
exit 0
fi
if [ -n "$GIT" ] ; then
DIFILE=`realpath $1`
[ -n "$TOPDIR" ] && cd "$TOPDIR"
DIFILE=${DIFILE/`realpath $PWD`\//}
#echo 2 $DIFILE $PWD
$GIT diff $DIFILE | sed -e "s|^--- a/|--- |g" | sed -e "s|^\+\+\+ b/|\+\+\+ |g" > $DIFILE.patch
exit 0
fi