From ad592fb64f2c2ef130de550c9211c36af249bad7 Mon Sep 17 00:00:00 2001 From: Luke Yelavich Date: Sun, 1 Apr 2007 20:32:17 +1000 Subject: [PATCH] * Add update-maintainer script to change the maintainer field in debian/control, as per the DebianMaintainerField spec. --- update-maintainer | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100755 update-maintainer diff --git a/update-maintainer b/update-maintainer new file mode 100755 index 0000000..a32295f --- /dev/null +++ b/update-maintainer @@ -0,0 +1,43 @@ +#!/bin/bash +#update-maintainer +#small - thus not perfect - script to update maintainer field in ubuntu packages +#written and (c) 2007 by Albin Tonnerre (Lutin) +#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 + +IGNORE_MAINTAINER="lamont@debian.org q-funk@iki.fi cjwatson@debian.org" +IGNORE_DOMAINS="ubuntu\.com|canonical\.com|ubuntu\.com\.au" + +[ -n "`head -n 1 debian/changelog | grep -E "\(*ubuntu.*\)"`" ] && +[ -z "`grep -E "^Maintainer: .*($IGNORE_DOMAINS)>" debian/control`" ] || \ +( echo "Not an ubuntu package or already maintained by the ubuntu team" >&2 && exit 1 ) + +mail=$(grep -E "^Maintainer" debian/control | sed -r 's/.*<(.*)>/\1/') +for maint in $IGNORE_MAINTAINER; do [ "$maint" = "$mail" ] && echo \ + "Maintainer is in the ignore list" >&2 && exit 1; done + +case $mail in + "adconrad@0c3.net") email="Adam Conrad " ;; + "mpitt@debian.org") email="Martin Pitt " ;; +esac + +if [ -z "$email" ]; then + DISTRO=$(head -n 1 debian/changelog|sed -r 's/.*\) (.*);.*/\1/' | cut -d'-' -f1) + pkgline=$(apt-cache madison `head -n 1 debian/changelog | cut -d' ' -f1` |\ + grep -m 1 "$DISTRO.*Sources") + [ -z "$pkgline" ] && echo "You don't have $DISTRO in your source repos" >&2\ + && exit 1 + section=$(echo $pkgline | grep -Eo "main|universe|multiverse|restricted") + case $section in + "main"|"restricted") email="Ubuntu Core Developers " ;; + "universe"|"multiverse") email="Ubuntu MOTU Developers " ;; + esac +fi + +sed -ri "s/(^Maintainer:) (.*)/\1 $email\nX-Original-\1 \2/" debian/control +[ -f debian/control.in ] && sed -ri "s/(^Maintainer:) (.*)/\1 $email\nX-Original-\1 \2/" debian/control.in + +dch Modified Maintainer value to match Debian-Maintainer-Field Spec +echo "Maintainer changed to $email" +exit 0