[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

automatic build script



On Wed 18 Mar 1998, Paul Slootman wrote:
> I've been digging through my archive, and found the script posted by
> Lars on Nov 10, 1997. I've included it again in the attachment.

Arghh, I included the whole message. _I_ couldn't decode it, so here's
another try:

Paul Slootman
-- 
home: paul@wurtel.demon.nl | work: paul@murphy.nl
http://www.wurtel.demon.nl | Murphy Software, Enschede, the Netherlands
Support Randal Schwartz!
See http://www.lightlink.com/fors/ or send empty email to fund@stonehenge.com
#!/bin/sh

# problem: not all packages work with dpkg-buildpackage -B and if we
# use -b and then delete *_all.deb, the .changes files don't work

dsc2srcdir() {
	basename "$1" .dsc | sed 's/-[a-zA-Z0-9.+]*$//;s/_/-/'
}

test -d BUILT || mkdir BUILT
test -d MESSAGES || mkdir MESSAGES
touch OK BAD

build_from_dsc() {
	for dsc in "$@"
	do
		dir=`dsc2srcdir $dsc`
		rm -rf TEMP
		mkdir TEMP
		if (cd TEMP && dpkg-source -x "$dsc")
		then
			true
		else
			echo dpkg-source failed 1>&2
			return 1
		fi
		if (cd "TEMP/$dir" && dpkg-buildpackage -rfakeroot -b -us -uc)
		then
			true
		else
			echo dpkg-buildpackage failed 1>&2
			return 1
		fi
		rm -rf "TEMP/$dir"
		rm -f TEMP/*.orig.tar.gz
		mv TEMP/*.deb TEMP/*.changes BUILT
		rmdir TEMP	# note: not rm -rf
	done
	return 0
}


find "$@" -name '*.dsc' |
while read dsc
do
	dsc=`cd \`dirname "$dsc"\`; pwd`/`basename "$dsc"`
	if fgrep "$dsc" SKIP >/dev/null
	then
		echo "skipping -- $dsc"
	elif fgrep "$dsc" BAD >/dev/null
	then
		echo "known bad -- $dsc"
	elif fgrep "$dsc" OK >/dev/null
	then
		echo "known good -- $dsc"
	else
		pkg=`basename "$dsc" | sed 's/_.*/_/'`
		
		echo -n "building -- $dsc..."
		if build_from_dsc "$dsc" >MESSAGES/"$pkg" 2>&1 < /dev/null
		then
			echo OK
			echo "$dsc" >> OK
		else
			echo BAD
			echo "$dsc" >> BAD
		fi
	fi
done

Reply to: