Updated to Lutin's last version and made it also work from the debian/ dir.

This commit is contained in:
Michael Bienia 2007-04-01 12:54:14 +02:00
parent ad592fb64f
commit 6c3e88e77b

View File

@ -4,40 +4,51 @@
#written and (c) 2007 by Albin Tonnerre <lut1n.tne@gmail.com> (Lutin) #written and (c) 2007 by Albin Tonnerre <lut1n.tne@gmail.com> (Lutin)
#this code is under the GNU GPL V2 licence #this code is under the GNU GPL V2 licence
( [ ! -f "$PWD/debian/changelog" ] || [ ! -f "$PWD/debian/control" ] ) && echo "Please run that script in the source folder" >&2 && exit 1 [ -n "`echo $1 | sed -r 's/(--help|universe|multiverse|main|restricted)//'`" ]\
&& echo "Bad parameter, please use --help" >&2 && exit 1
IGNORE_MAINTAINER="lamont@debian.org q-funk@iki.fi cjwatson@debian.org" [ "$1" == --help ] && echo "Launch this script without any option or with the section as the only parameter (if the package is not yet in the archive or if you don't have the feisty source repo in your sources.list)" && exit 0
IGNORE_DOMAINS="ubuntu\.com|canonical\.com|ubuntu\.com\.au"
[ -n "`head -n 1 debian/changelog | grep -E "\(*ubuntu.*\)"`" ] && # look for the debian directory
[ -z "`grep -E "^Maintainer: .*($IGNORE_DOMAINS)>" debian/control`" ] || \ if [ -f debian/control -a -f debian/changelog ]; then
( echo "Not an ubuntu package or already maintained by the ubuntu team" >&2 && exit 1 ) DEBIANDIR=debian
elif [ -f control -a -f changelog ]; then
DEBIANDIR=.
else
echo "Please run that script in the source folder" >&2 && exit 1
fi
mail=$(grep -E "^Maintainer" debian/control | sed -r 's/.*<(.*)>/\1/') IGNORE_DOMAINS="ubuntu\.com|ubuntu\.com\.au"
for maint in $IGNORE_MAINTAINER; do [ "$maint" = "$mail" ] && echo \
"Maintainer is in the ignore list" >&2 && exit 1; done
[ -n "`head -n 1 $DEBIANDIR/changelog | grep -E "\(*ubuntu.*\)"`" ] &&
[ -z "`grep -E "^Maintainer: .*($IGNORE_DOMAINS)>" $DEBIANDIR/control`" ] || \
{ echo "Not an ubuntu package or already maintained by the ubuntu team" >&2 && \
exit 1; }
mail=$(grep -E "^Maintainer" $DEBIANDIR/control | sed -r 's/.*<(.*)>/\1/')
case $mail in case $mail in
"adconrad@0c3.net") email="Adam Conrad <adconrad@ubuntu.com>" ;; "adconrad@0c3.net") email="Adam Conrad <adconrad@ubuntu.com>" ;;
"mpitt@debian.org") email="Martin Pitt <martin.pitt@ubuntu.com>" ;; "mpitt@debian.org") email="Martin Pitt <martin.pitt@ubuntu.com>" ;;
esac esac
if [ -z "$email" ]; then if [ -z "$email" ]; then
DISTRO=$(head -n 1 debian/changelog|sed -r 's/.*\) (.*);.*/\1/' | cut -d'-' -f1) if [ -z "$1" ]; then
pkgline=$(apt-cache madison `head -n 1 debian/changelog | cut -d' ' -f1` |\ DISTRO=$(head -n 1 $DEBIANDIR/changelog|sed -r 's/.*\) (.*);.*/\1/' | cut -d'-' -f1)
grep -m 1 "$DISTRO.*Sources") pkgline=$(apt-cache madison `head -n 1 $DEBIANDIR/changelog | cut -d' ' -f1`|\
[ -z "$pkgline" ] && echo "You don't have $DISTRO in your source repos" >&2\ grep -m 1 "$DISTRO.*Sources")
&& exit 1 [ -z "$pkgline" ] && echo "You don't have $DISTRO in your source repos" \
section=$(echo $pkgline | grep -Eo "main|universe|multiverse|restricted") >&2 && exit 1
section=$(echo $pkgline | grep -Eo "main|universe|multiverse|restricted")
else section=$1; fi
case $section in case $section in
"main"|"restricted") email="Ubuntu Core Developers <ubuntu-devel@lists.ubuntu.com>" ;; "main"|"restricted") email="Ubuntu Core Developers <ubuntu-devel-discuss@lists.ubuntu.com>" ;;
"universe"|"multiverse") email="Ubuntu MOTU Developers <ubuntu-motu@lists.ubuntu.com>" ;; "universe"|"multiverse") email="Ubuntu MOTU Developers <ubuntu-motu@lists.ubuntu.com>" ;;
esac esac
fi fi
sed -ri "s/(^Maintainer:) (.*)/\1 $email\nX-Original-\1 \2/" debian/control sed -ri "s/(^Maintainer:) (.*)/\1 $email\nXSBC-Original-\1 \2/" $DEBIANDIR/control
[ -f debian/control.in ] && sed -ri "s/(^Maintainer:) (.*)/\1 $email\nX-Original-\1 \2/" debian/control.in [ -f $DEBIANDIR/control.in ] && sed -ri "s/(^Maintainer:) (.*)/\1 $email\nXSBC-Original-\1 \2/" $DEBIANDIR/control.in
dch Modified Maintainer value to match Debian-Maintainer-Field Spec dch "Modified Maintainer value to match Debian-Maintainer-Field Spec"
echo "Maintainer changed to $email" echo "Maintainer changed to $email"
exit 0 exit 0