File: update_src.sh

package info (click to toggle)
tex4ht 20080701-2
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 41,280 kB
  • ctags: 2,625
  • sloc: ansic: 12,111; java: 2,991; sh: 922; perl: 346; makefile: 113
file content (129 lines) | stat: -rw-r--r-- 2,820 bytes parent folder | download
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
#!/bin/sh
# Created by Kapil Hari Paranjape <kapil@imsc.res.in>
# Based on inputs from Antonio Ospite <ospite@studenti.unina.it>
# This creates the new .orig.tar.gz if there is an update
set -e

# Uncomment this to debug
#set -x

CHANGELOGS="bugfixes2.html bugfixes3.html bugfixes4.html"
NEWS="bugfixes.html"
STYFILES="DraTex.sty AlDraTex.sty ProTex.sty AlProTex.sty"
#EITSCR="http://www.cse.ohio-state.edu/~gurari/temp/nogjava.perl"
#FIXJAVA="nogjava.perl"

# Use the watch file and uscan
# "uscan" exit is 1 even when there *is* a new file!
USCANOUT=$(uscan --report) || /bin/true

if [ -z "$USCANOUT" ] 
then
	echo "Existing source is up-to-date."
	exit 0
fi

# Extract information from the uscan report

URL=$(expr "$USCANOUT" : '.*\(http:\/\/.*\.tar\.gz\).*')
VERSION=$(expr "$USCANOUT" : '.*Newer version (\([0-9]*\)).*')

T4HTFIXURL=$(dirname "$URL")
T4HTURL=$(dirname "$T4HTFIXURL")
LIT="$T4HTFIXURL/tex4ht-lit.zip"
STYURL=$(expr "$T4HTURL" : '\(.*~[^/]*\)/.*')/tpf

ARCHIVE=$(basename $URL)
DIR=$(basename $ARCHIVE .tar.gz)

echo -n "Creating temporary directory for download ..."
TMPDIR=$(mktemp -d)
echo "Done."

OLDIR=$PWD

echo -n "Downloading the new sources ..."
cd $TMPDIR
if ! (wget -q $URL)
then
	echo "Error: Could not download $URL"
	exit 201
fi
if ! (wget -q $LIT)
then
	echo "Error: Could not download $LIT"
	exit 202
fi
for html in $NEWS $CHANGELOGS 
do
	if ! (wget -q $T4HTURL/$html)
	then
		echo "Error: Could not download $T4HTURL/$html"
		exit 203
	fi
done
for sty in $STYFILES
do
	if ! (wget -q $STYURL/$sty)
	then
		echo "Error: Could not download $STYURL/$sty"
		exit 204
	fi
done
#if ! (wget -q $EITSCR -O $FIXJAVA)
#then
#	echo "Error: Could not download $FIXJAVE"
#	exit 205
#fi
echo "Done."

echo -n "Unpacking the source ..."
if [ -e $ARCHIVE ]
then
	tar xzf $ARCHIVE

	# Fix unnecessary execute permissions
	find $DIR/src ! -type d | xargs -i chmod -x \{\}

	# Fix unnecessary execute permissions
	find $DIR/texmf ! -type d | xargs -i chmod -x \{\}
else
	echo "Error: $ARCHIVE not found"
	exit 211
fi

if [ -e tex4ht-lit.zip ]
then
	if type -path unzip 
	then
		unzip -d $DIR/lit -aqq tex4ht-lit.zip
	else
		7z x -o$DIR/lit -tzip -y tex4ht-lit.zip
	fi
	mv $STYFILES $NEWS $CHANGELOGS $DIR/lit

	# Fix unnecessary execute permissions
	find $DIR/lit ! -type d | xargs -i chmod -x \{\}
else
	echo "Error: tex4ht-lit.zip not found"
	echo 212
fi
#mv $FIXJAVA $DIR/src
chmod +x $DIR/src/$FIXJAVA
echo "Done."

echo -n "Creating the new orig.tar.gz..."
mv $DIR tex4ht-${VERSION}.orig
GZIP="--best --rsyncable" tar czf $OLDIR/../tex4ht_${VERSION}.orig.tar.gz tex4ht-${VERSION}.orig
#tar czf $OLDIR/../tex4ht_${VERSION}.orig.tar.gz ${DIR}
echo "Done."

echo "Cleaning up ..."
cd $OLDIR
rm -rf $TMPDIR
echo "Done."

echo "New original sources are at ../tex4ht_${VERSION}.orig.tar.gz".

exit 0