2008-10-07 05:54:49 +01:00
|
|
|
#!/bin/sh
|
2008-08-11 20:06:35 +02:00
|
|
|
#
|
2007-08-04 13:52:30 +02:00
|
|
|
# Copyright 2007 (C) Albin Tonnerre (Lutin) <lut1n.tne@gmail.com>
|
2008-08-11 20:06:35 +02:00
|
|
|
#
|
|
|
|
# ##################################################################
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of the GNU General Public License
|
|
|
|
# as published by the Free Software Foundation; version 2.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# See file /usr/share/common-licenses/GPL-2 for more details.
|
|
|
|
#
|
|
|
|
# ##################################################################
|
2007-08-04 13:52:30 +02:00
|
|
|
#
|
2008-02-17 17:55:25 +01:00
|
|
|
# This script is used to update the Maintainer field of an Ubuntu package
|
2007-08-04 13:52:30 +02:00
|
|
|
# to match the DebianMaintainerField specification.
|
2007-04-01 20:32:17 +10:00
|
|
|
|
2007-11-15 22:35:30 +11:00
|
|
|
usage() {
|
|
|
|
cat <<EOF
|
2008-07-18 13:30:50 +01:00
|
|
|
Usage: $0 [--path=PATH] [--section=SECTION]
|
2008-02-17 17:55:25 +01:00
|
|
|
--path=PATH Specify the path of the source directory.
|
|
|
|
--section=SECTION Specify the section of the package (if the package is
|
2007-11-15 22:35:30 +11:00
|
|
|
not yet in the archive.
|
|
|
|
EOF
|
|
|
|
}
|
|
|
|
|
2009-05-12 00:05:06 +01:00
|
|
|
eval set -- "$(getopt -o '' -l path:,section:,help -- "$@")" || { usage >&2; exit 1; }
|
|
|
|
while :; do
|
|
|
|
case $1 in
|
|
|
|
--path)
|
|
|
|
path="$2"
|
|
|
|
shift 2
|
|
|
|
;;
|
|
|
|
--section)
|
|
|
|
[ "$2" != "main" ] &&
|
|
|
|
[ "$2" != "restricted" ] &&
|
|
|
|
[ "$2" != "universe" ] &&
|
|
|
|
[ "$2" != "multiverse" ] && echo "Invalid section. Valid sections: main restricted universe multiverse" >&2 && exit 1
|
|
|
|
section="$2"
|
|
|
|
shift 2
|
|
|
|
;;
|
|
|
|
--help)
|
2007-11-15 22:35:30 +11:00
|
|
|
usage
|
2007-11-24 07:50:05 +11:00
|
|
|
exit 0
|
2009-05-12 00:05:06 +01:00
|
|
|
;;
|
|
|
|
--)
|
|
|
|
shift
|
|
|
|
break
|
|
|
|
;;
|
2007-11-15 22:35:30 +11:00
|
|
|
*)
|
|
|
|
echo "Bad parameter."
|
2009-05-12 00:05:06 +01:00
|
|
|
usage >&2
|
2007-11-15 22:35:30 +11:00
|
|
|
exit 1
|
2009-05-12 00:05:06 +01:00
|
|
|
;;
|
2007-08-12 23:19:38 +02:00
|
|
|
esac
|
|
|
|
done
|
2007-04-01 12:54:14 +02:00
|
|
|
|
2007-04-30 18:27:21 +02:00
|
|
|
cd ${path-.}
|
2007-04-01 12:54:14 +02:00
|
|
|
|
|
|
|
# look for the debian directory
|
2008-10-07 05:54:49 +01:00
|
|
|
if [ -f debian/control ] && [ -f debian/changelog ]; then
|
2007-04-01 12:54:14 +02:00
|
|
|
DEBIANDIR=debian
|
2008-10-07 05:54:49 +01:00
|
|
|
elif [ -f control ] && [ -f changelog ]; then
|
2007-04-01 12:54:14 +02:00
|
|
|
DEBIANDIR=.
|
|
|
|
else
|
2008-10-07 05:54:49 +01:00
|
|
|
echo "Please execute «$0» in the source folder." >&2
|
|
|
|
exit 1
|
2007-04-01 12:54:14 +02:00
|
|
|
fi
|
2007-04-01 20:32:17 +10:00
|
|
|
|
2008-09-07 15:32:07 +02:00
|
|
|
if [ ! -r $DEBIANDIR/changelog ]
|
|
|
|
then
|
|
|
|
echo "Make sure that the changelog file is readable." >&2 && exit 1
|
|
|
|
fi
|
|
|
|
|
2008-10-07 05:54:49 +01:00
|
|
|
for file in control control.in control.real; do
|
2008-09-07 15:32:07 +02:00
|
|
|
if [ -f $DEBIANDIR/$file ]; then
|
2008-10-07 05:54:49 +01:00
|
|
|
if [ ! -r $DEBIANDIR/$file ] || [ ! -w $DEBIANDIR/$file ]; then
|
2008-09-07 15:32:07 +02:00
|
|
|
echo "Make sure that the control file(s) is (are) readable and writable." >&2 && exit 1
|
|
|
|
fi
|
|
|
|
controls="$controls $file"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2009-05-16 19:11:45 +00:00
|
|
|
if ! head -1 $DEBIANDIR/changelog | egrep -q '(*ubuntu.*|*build.*)'
|
2008-02-17 17:55:25 +01:00
|
|
|
then
|
|
|
|
echo "Latest changelog entry has no Ubuntu version number." >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if grep -E "^Maintainer: .*@.*ubuntu.*>" $DEBIANDIR/control >/dev/null
|
|
|
|
then
|
|
|
|
echo "Package already maintained by the Ubuntu team." >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
2007-08-12 23:19:38 +02:00
|
|
|
|
|
|
|
if [ -z "$section" ]; then
|
2007-11-15 22:35:30 +11:00
|
|
|
DISTRO=$(sed -r '1!d;s/.*\) (.*);.*/\1/' $DEBIANDIR/changelog | cut -d'-' -f1)
|
|
|
|
pkgline=$(rmadison -u ubuntu -a source -s $DISTRO $(head -1 $DEBIANDIR/changelog | cut -d' ' -f1))
|
2007-08-12 23:19:38 +02:00
|
|
|
if [ -z "$pkgline" ]; then
|
2007-11-15 22:35:30 +11:00
|
|
|
echo "The package doesn't exist in the $DISTRO archive. You may have to use the" >&2
|
|
|
|
echo "--section argument. Run $0 --help for more information." >&2
|
2007-08-12 23:19:38 +02:00
|
|
|
exit 1
|
2007-04-30 18:27:21 +02:00
|
|
|
fi
|
2008-02-23 21:40:39 +01:00
|
|
|
section=$(echo $pkgline | grep -Eo "main|universe|multiverse|restricted") || section=main
|
2007-04-01 20:32:17 +10:00
|
|
|
fi
|
2008-02-17 17:55:25 +01:00
|
|
|
|
2007-08-12 23:19:38 +02:00
|
|
|
case $section in
|
|
|
|
"main"|"restricted") email="Ubuntu Core Developers <ubuntu-devel-discuss@lists.ubuntu.com>" ;;
|
|
|
|
"universe"|"multiverse") email="Ubuntu MOTU Developers <ubuntu-motu@lists.ubuntu.com>" ;;
|
|
|
|
*) echo "No section found for this package; aborting" >&2; exit 1 ;;
|
|
|
|
esac
|
2007-04-01 20:32:17 +10:00
|
|
|
|
2008-09-07 15:32:07 +02:00
|
|
|
for file in $controls; do
|
|
|
|
sed -ri "s/(^Maintainer:) (.*)/\1 $email\nXSBC-Original-\1 \2/" $DEBIANDIR/$file
|
2007-08-12 23:19:38 +02:00
|
|
|
done
|