severity #406811 important
severity #405437 important
merge #405437 #406811 #408696
stop

        Hi,

 In fact all command line flags are ignored, especially -sa, -v, -d, -S
 or -B.  This renders svn-buildpackage unusable for me as I always build
 in pbuilder.

 The workaround is to specify the builder and its flag on each
 invocation of svn-buildpackage; this imposes a painful quoting burden,
 and I'm not sure all options can really be passed in this way.

 I wrote the attached wrapper in case it's useful for other people
 around.

   Bye,
-- 
Loïc Minier <[EMAIL PROTECTED]>
#!/bin/sh

set -e

sbp_conf="$HOME/.svn-buildpackage.conf"

has_config() {
    local optname="$1"

    if ! [ -e "$sbp_conf" ]; then
        return 1
    fi
    if egrep -q "^$optname[[:space:]]*(\$|=)" "$sbp_conf"; then
        return 0
    fi
    return 1
    sed -n "s/^$optname[[:space:]]*=\?[[:space:]]*//p" "$sbp_conf"
}

get_config() {
    local optname="$1"
    local default="$2"

    if ! has_config "$1"; then
        echo "$default"
        return
    fi

    sed -n "s/^$optname[[:space:]]*=\?[[:space:]]*//p" "$sbp_conf"
}

svn_builder="$(get_config svn-builder dpkg-buildpackage)"

# these are stored in escape()d form
sbp_opts=""
builder_opts=""

# this is not for the kids
escape() {
    echo "$*" | sed "s/'/'\"'\"'/g; s/.*/'&'/"
}
unescape () {
    eval "echo" "$*"
}

while [ -n "$1" ]; do
  case "$1" in
    # hook sbp's help flag to warn there's a wrapper
    -h|--help)
      echo "Hey, I'm the $0 wrapper and I don't have any embedded help."
      exit 1
    ;;
    # sbp options with one parameter this script is interested in
    --svn-builder)
      shift
      svn_builder="$1"
      shift
    ;;
    # sbp options this script is interested in
    --svn-builder=*)
      svn_builder=$(echo "$1" | sed 's/^--svn-builder=//')
      shift
    ;;
    # sbp options with one parameter this script is not interested in
    
--svn-move-to|--svn-pkg|--svn-override|--svn-prebuild|--svn-postbuild|--svn-pretag|--svn-posttag)
      sbp_opts="$sbp_opts $1 $(escape "$2")"
      shift
      shift
    ;;
    # sbp options with one parameter this script is not interested in
    --svn-*)
      sbp_opts="$sbp_opts $(escape "$1")"
      shift
    ;;
    # other options passed to the builder
    *)
      builder_opts="$builder_opts $(escape "$1")"
      shift
    ;;
  esac
done

eval exec nice -n 19 /usr/bin/svn-buildpackage $sbp_opts 
\"--svn-builder=$svn_builder $builder_opts\"

Reply via email to