Package: git-buildpackage
Version: 0.6.19
Severity: wishlist
Tags: patch

"pbuilder" and "cowbuilder" accept first option with "--" or without "--".
(with "--" as the main syntax in manpage.)

"git" and "gbp" accept first option always without "--".

So I understand your rationale for the choice of
 $ git-pbuilder login --save-after-login
as the main syntax but I keep hitting
 $ git-pbuilder --login --save-after-login
since I used to type
 $ pbuilder --login --save-after-login

As I see your code, the syntax relaxation to accomodate my mistakes can
be a very minor change. See attached patch. Please consider.

Regards,
Osamu

-- System Information:
Debian Release: jessie/sid
  APT prefers testing-updates
  APT policy: (500, 'testing-updates'), (500, 'testing')
Architecture: amd64 (x86_64)
diff -Nru git-buildpackage-0.6.20.orig/bin/git-pbuilder git-buildpackage-0.6.20/bin/git-pbuilder
--- git-buildpackage-0.6.20.orig/bin/git-pbuilder	2014-09-12 19:59:29.000000000 +0900
+++ git-buildpackage-0.6.20/bin/git-pbuilder	2014-10-18 02:19:26.485928023 +0900
@@ -203,13 +203,22 @@
     esac
 fi
 
-# If the first argument to the script is update, create, or login, run the
-# builder with the corresponding option under sudo rather than proceeding.
+# If the first argument to the script is update, create, or login; or
+# --update, --create, or --login, set the $action.
 case $1 in
 update|create|login)
+    action="--$1"
+    shift
+--update|--create|--login)
     action="$1"
     shift
+*)
+    action=""
+    ;;
+esac
 
+# Run the builder for $action under sudo rather than proceeding.
+if [ -n "$action" ]; then
     # Since we're running the builder under sudo, $HOME will change to root's
     # home directory and the user's .pbuilderrc won't be run.  sudo -E would
     # fix this, but that requires special configuration in sudoers to allow
@@ -221,26 +230,24 @@
 
     # Run the builder.
     if [ no = "$GIT_PBUILDER_AUTOCONF" ] ; then
-        sudo "$BUILDER" --"$action" "${OPTIONS[@]}" "$@"
+        sudo "$BUILDER" "$action" "${OPTIONS[@]}" "$@"
     else
         if [ "$EXT" = '-backports' ] ; then
             OTHERMIRROR="deb $BACKPORTS $DIST$EXT main"
-            sudo "$BUILDER" --"$action" --distribution "$DIST" \
+            sudo "$BUILDER" "$action" --distribution "$DIST" \
                 --othermirror "$OTHERMIRROR" "${OPTIONS[@]}" "$@"
         else
-            sudo "$BUILDER" --"$action" --distribution "$DIST" \
+            sudo "$BUILDER" "$action" --distribution "$DIST" \
                 "${OPTIONS[@]}" "$@"
         fi
     fi
     exit $?
-    ;;
-*)
-    if [ -z "$GBP_BUILD_DIR" ]; then
-        echo "Warning: git-pbuilder should be run via git-buildpackage" >&2
-    fi
-    ;;
-esac
+fi
 
+# Build package: not (update | create | login)
+if [ -z "$GBP_BUILD_DIR" ]; then
+    echo "Warning: git-pbuilder should be run via git-buildpackage" >&2
+fi
 # Print out some information about what we're doing.
 building="Building with $BUILDER"
 if [ no = "$GIT_PBUILDER_AUTOCONF" ] ; then

Reply via email to