From d69622fa9c6e8a546d8eb9ab68c4bac9073cb7b5 Mon Sep 17 00:00:00 2001 From: Stefano Rivera Date: Sun, 6 May 2012 05:12:40 +0200 Subject: [PATCH] check-symbols: Use optparse to display --help --- check-symbols | 56 ++++++++++++++++++++++++++++------- debian/changelog | 3 +- ubuntutools/test/test_help.py | 1 - 3 files changed, 47 insertions(+), 13 deletions(-) diff --git a/check-symbols b/check-symbols index c0a0a03..bcb8b7f 100755 --- a/check-symbols +++ b/check-symbols @@ -29,21 +29,55 @@ # * nm (from binutils) DISTRO=$(lsb_release -c -s) -VERSION=$(apt-cache madison "$1" | grep -- "$DISTRO"'/.*Sources$' | awk '{print $3}') -PACKAGES=$(apt-cache showsrc "$1" | grep-dctrl -s Binary -F Version "$VERSION" | sed 's/Binary\:\ //g;s/\,//g' | sort -u) DEBLINE="" DEBUG=False -if [[ -z $1 ]]; then - echo "Missing argument: source package name." - exit 1 +usage() { + prog=$(basename $0) + cat <&2 + usage 1 + fi + POSITION=$(($POSITION+1)) + esac + shift +done + +if [ $POSITION -eq 0 ]; then + echo "Missing argument: source package name." >&2 + usage 1 fi -if [[ -z $2 ]]; then - DEBDIR="/var/cache/pbuilder/result" -else - DEBDIR="$2" -fi +VERSION=$(apt-cache madison "$PACKAGE" | grep -- "$DISTRO"'/.*Sources$' | awk '{print $3}') +PACKAGES=$(apt-cache showsrc "$PACKAGE" | grep-dctrl -s Binary -F Version "$VERSION" | sed 's/Binary\:\ //g;s/\,//g' | sort -u) if [ `id -u` != "0" ] then @@ -67,7 +101,7 @@ do done if [[ -z $DEBLINE ]]; then - echo "Package doesn't exist: $1." + echo "Package doesn't exist: $PACKAGE." exit 1 fi diff --git a/debian/changelog b/debian/changelog index 84e3eab..06349d0 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,7 +3,8 @@ ubuntu-dev-tools (0.142) UNRELEASED; urgency=low * mk-sbuild: Support kmod, when checking for overlayfs availability. * pbuilder-dist: improve bash_completion for *.dsc files. Thanks Maarten Bezemer. (Closes: #670924, LP: #770529) - * submittodebian, check-mir: Use optparse to display --help (LP: #988009) + * submittodebian, check-mir, check-symbols: Do enough argument parsing to + handle --help (LP: #988009) -- Stefano Rivera Wed, 25 Apr 2012 17:38:58 +0200 diff --git a/ubuntutools/test/test_help.py b/ubuntutools/test/test_help.py index 3d0c32a..e3af9ba 100644 --- a/ubuntutools/test/test_help.py +++ b/ubuntutools/test/test_help.py @@ -25,7 +25,6 @@ from ubuntutools import subprocess from ubuntutools.test import unittest BLACKLIST = { - 'check-symbols': 'No Help', 'grep-merges': 'No Help', 'pbuilder-dist-simple': 'No Help', 'setup-packaging-environment': 'Throws Error',