File: util

package info (click to toggle)
arson 0.9.8beta2-4
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 4,560 kB
  • ctags: 3,714
  • sloc: cpp: 19,734; sh: 15,178; perl: 1,995; xml: 227; makefile: 98
file content (247 lines) | stat: -rwxr-xr-x 5,668 bytes parent folder | download | duplicates (2)
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
#!/bin/sh
################################################
##	Do various things
################################################

##	Utilities
##

write_sect() {
	echo "$1" >>README; echo >>README
	cat "$2" >>README; echo >>README
}

err() {
	echo "$*" >/dev/stderr
	exit 1
}

compile() {
	kde="$1"; shift;
	./configure $* || err 'configure (' $* ')'
	make || err 'make (' $* ')'
	make clean
	rm -f config.cache config.status
	./util $kde || err 'generating files...'
	return 0
}

##	Do stuff
##

case "$1" in
	dist )
		dirname=$(sed -e 's/ v/-/' VERSION)
		rm -f *.tar.{bz2,gz}
		test -d ../tmp || mkdir ../tmp
		cd ../tmp && mkdir dist >/dev/null 2>&1
		cd dist || exit 1
		echo "Checking out arson to $PWD ..."
		cvs -d:pserver:anonymous@cvs.arson.sourceforge.net:/cvsroot/arson login 
		cvs -d:pserver:anonymous@cvs.arson.sourceforge.net:/cvsroot/arson co arson || exit 1

		for kv in kde2 kde3; do
			current="${dirname}-${kv}"
			cp -r arson $current && cd $current
			./util $kv || exit 1
			cd ..
			tar vcf "${current}.tar" $current/*
			bzip2 -c "${current}.tar" > "${current}.tar.bz2"
			gzip -c "${current}.tar" > "${current}.tar.gz"
			rm -rf $current
		done

		mv -f ${dirname}*.tar.* ../../arson/ || exit 1
		cd ..; rm -rf dist
	;;

	reconf )
		cmd='./configure --with-vorbis --with-flac'
		test "$2" == "debug" && cmd="$cmd --enable-debug"
		$cmd
	;;

	upsf )
		shift
		ncftpput upload.sourceforge.net incoming $*
	;;

	mkreadme )
		cat VERSION >README
		head -n 1 AUTHORS >>README
		cat <<EOF >>README
----------------------------------------------------------------------

EOF
		write_sect '* Description' DESCRIPTION
		write_sect '* Features' FEATURES
		write_sect '* Requirements' REQUIREMENTS

		cat <<EOF >>README
* Installation
see INSTALL file

* Todo
see TODO file

* Credits
see AUTHORS file

EOF
	;;

	mkhomepage )
		./textfmt --para DESCRIPTION >.desc
		./textfmt --list FEATURES >.features
		./textfmt --para REQUIREMENTS >.req

		sed -e "/@DESCRIPTION@/r .desc" \
			-e "/@FEATURES@/r .features" \
			-e "/@REQUIREMENTS@/r .req" \
			-e "s/<!--@VERSION@-->/$(sed -e 's/arson v//' VERSION)/" \
			-e "s/<!--@TIMESTAMP@-->/$(date)/" \
			index.tmpl >index.html

		rm -f .desc .features .req
	;;

	uphp )
		test ! -f index.html && ./util mkhomepage
		scp index.html \
		"tonys111@arson.sourceforge.net:/home/groups/a/ar/arson/htdocs/index.html"
	;;

	up )
		shift; foo="$1"; shift;
		scp $* "tonys111@arson.sourceforge.net:/home/groups/a/ar/arson/htdocs/$foo/";
	;;

	cleanbk )
		find . -name '*~' |xargs rm -f
	;;

	xml-messages )
		xmlmsgs=xmlmsgs.cpp
		rm -f $xmlmsgs
		cat <<"EOF" >$xmlmsgs
/*
 * Generated by ./util xml-messages
 * do not edit.
 */
#include <klocale.h>

namespace arson {
void never_to_be_called (void) {
const QString dummy[] {
EOF
		perl -n -e 'print "i18n(\"$1\"),\n" if /<preset/ && /name="(.+?)"/' arsonencoder.xml >>$xmlmsgs
		perl -n -e 'print "i18n(\"$1\"),\n" if /<preset/ && /name="(.+?)"/' arsonisorc.xml >>$xmlmsgs
		perl -n -e 'print "i18n(\"$1\"),\n" if /desc="(.+?)"/' isoopts.xml >>$xmlmsgs

		cat <<"EOF" >>$xmlmsgs
//	HACK: Stuff from arsonui.rc that still needs translation
i18n("&Export Playlist"),
i18n("&Burner"),
i18n("&Ripper")
};	//	ARRAY
}	//	FUNC
}	//	NAMESPACE
EOF
	;;

	src-make-am )
		if test -z "$2"; then
			echo "Specify kde2 or kde3!"
			exit 1
		fi

		cat <<"EOF" >src/Makefile.am
##
##	DO NOT EDIT THIS FILE. IT IS GENERATED.
##	Edit src/Makefile.am.in, then rerun:
##	./util src-make-am kde2|3
##
EOF
		if test "x$2" = "xkde3"; then
			sed -e 's/LIB_KFILE/LIB_KIO/' src/Makefile.am.in >>src/Makefile.am
		else
			cat src/Makefile.am.in >>src/Makefile.am
		fi
	;;

	kde[23] )
		test -h admin && rm -f admin

		test -d "$1-admin" && {
			test -d admin && rm -rf admin
			mv "$1-admin" admin
			rm -rf kde?-admin/
		}

		test -f Makefile && make distclean
		rm -f src/Makefile.am
		./util src-make-am "$1"
		make -f Makefile.cvs
	;;

	checkabspath )
		grep -e '/home/tonys111/' src/*.cpp src/*.h
	;;

	remove )
		echo -n "Root password to uninstall: "
		su -c 'make uninstall' || exit 1
		find ~/.kde/ -iname '*arson*' |xargs rm -f
	;;

	hack_configure )
		echo 'Modifying configure...'
		cat <<"EOF" >.hackconf
ts_kde_config="$(which kde-config 2>/dev/null)"
if test x"$ts_kde_config" != "x"; then
	ac_default_prefix=${KDEDIR:-$(kde-config --prefix)}
else
	ac_default_prefix=${KDEDIR:-/usr/local/kde}
fi
EOF
		sed -e '/^ac_default_prefix=[$]{KDEDIR:-\/usr\/local\/kde}/r .hackconf' \
			-e 's/^ac_default_prefix=[$]{KDEDIR:-\/usr\/local\/kde}//' configure >.configure.tmp

		mv -f .configure.tmp configure
		rm -f .hackconf
		chmod 755 configure
	;;

	test-compile )
		kde="$1"
		test -z "$kde" && kde='kde3'

		compile $kde \
		&& compile $kde --enable-trace \
		&& compile $kde --with-vorbis \
		&& compile $kde --with-flac \
		&& compile $kde --enable-kdeopts \
		&& compile $kde --enable-final
	;;


	* )			##	Usage message
		cat <<EOF
  upsf - Upload the specified file to sourceforge's incoming directory
  dist - Create arson-Version.tar.gz and .bz2
  distclean - Super cleanup
  reconf - Rerun ./configure (debug or no)
  cleanbk - Remove emacs backup files (*~)
  mkreadme - Generate the README file
  mkhomepage - Generate index.html
  uphp - Upload index.html to Sourceforge
  hack_configure - Hack the configure script to change default kde prefix
  checkabspath - Check for absolute paths in the source
  kde2 - Setup to build for KDE2
  kde3 - Setup to build for KDE3
  src-make-am <kde2|kde3>- Generate src/Makefile.am
  xml-messages - Generate src/xmlmsgs.cpp from XML resource files
  test-compile - Test various build configurations (takes a long time)
EOF
	;;
esac