From 0a28dbb15de66a2a77c72b98edd6d367538c0377 Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Tue, 12 May 2009 00:05:06 +0100 Subject: [PATCH] * update-maintainer: - Convert to getopt so that '--section main' works as well as '--section=main'. --- debian/changelog | 5 +++++ update-maintainer | 41 +++++++++++++++++++++++------------------ 2 files changed, 28 insertions(+), 18 deletions(-) diff --git a/debian/changelog b/debian/changelog index eff8a70..914f873 100644 --- a/debian/changelog +++ b/debian/changelog @@ -30,6 +30,11 @@ ubuntu-dev-tools (0.74) UNRELEASED; urgency=low - Check if user has upload privileges instead of checking for team membership when seeing if operations are permitted + [ Colin Watson ] + * update-maintainer: + - Convert to getopt so that '--section main' works as well as + '--section=main'. + -- Iain Lane Sun, 10 May 2009 19:13:34 +0100 ubuntu-dev-tools (0.73) karmic; urgency=low diff --git a/update-maintainer b/update-maintainer index c457530..b23ead7 100755 --- a/update-maintainer +++ b/update-maintainer @@ -29,29 +29,34 @@ Usage: $0 [--path=PATH] [--section=SECTION] EOF } -for argv in "$@"; do - param=${argv%=*} - value=${argv#*=} - case $param in - "--path") - path="$value" - ;; - "--section") - [ "$value" != "main" ] && - [ "$value" != "restricted" ] && - [ "$value" != "universe" ] && - [ "$value" != "multiverse" ] && echo "Invalid section. Valid sections: main restricted universe multiverse" >&2 && exit 1 - section=$value - ;; - "--help") +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) usage exit 0 - ;; + ;; + --) + shift + break + ;; *) echo "Bad parameter." - usage + usage >&2 exit 1 - ;; + ;; esac done