mass-release.sh 883 Bytes
Newer Older
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
#!/bin/bash

if [ "$1" = "-D" ]
then
	dist="$2"
	shift
	shift
fi

if [ -z "$1" -o "$1" = '--help' ]
then
	echo "Usage: $0 [-D distribution] dirs..."
	echo
	echo "Calls debchange -r on all repos that are not already released"
	echo "(i.e. distribution is UNRELEASED)."
	exit
fi

set -e

while [ -n "$1" ]
do
	dir=$1
	shift

	if ! pushd "$dir" >/dev/null
	then
		echo "Failed to switch to \"$dir\""
		continue
	fi

	if [ ! -e changelog ]
	then
		echo "No changelog file found, skipping $dir"
		popd >/dev/null
		continue
	fi

	currentdist=$(dpkg-parsechangelog -lchangelog -c1 |grep-dctrl -n -s Distribution .)
	if [ "$currentdist" = "UNRELEASED" ]
	then
		echo "Releasing $dir"
		if [ -n "$dist" ]
		then
Joachim Breitner's avatar
Joachim Breitner committed
45
			debchange --changelog=changelog  -r '' -D $dist
46 47 48 49 50 51 52 53
		else
			debchange --changelog=changelog  -r ''
		fi
	else
		echo "Skipping $dir, already released."
	fi
	popd >/dev/null
done