Package: git-buildpackage
Version: 0.4.43
Severity: minor

        Hi there,

 There's no way to override an user defined sign-tags = True (in his
 ~/.gbp.conf) when running git-import-orig from a script.  I tried
 --no-sign-tags and --sign-tags=no and =False.

 Would be nice to be able to do, especially as using a ./.gbp.conf
 causes this file to be imported on first import (probably a bug as
 well, but not sure).  See attached scripts which demonstrates the
 workaround and it's issue (tarbal-diff foo.tar.gz foo.tar.gz should
 demonstrate that you see .gbp.conf in the diff).  I don't really care
 about that second bug which goes away with the first one for me.  :-)

   Cheers,

PS: thanks for allowing me to write this script based on gbp  :-)
-- 
Loïc Minier
#!/bin/sh
# tarball-diff - output the diff between two tarballs
# Copyright (C) 2008 Loïc Minier <[email protected]>
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
# SOFTWARE IN THE PUBLIC INTEREST, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
#
# Except as contained in this notice, the name of the author shall not be used
# in advertising or otherwise to promote the sale, use or other dealings in
# this Software without prior written authorization from the author.
#
# depends: git-buildpackage, git-core

set -e

log() {
    echo "$*" >&2
}

log_i() {
    log "I:" "$@"
}

log_w() {
    log "W:" "$@"
}

die() {
    log "E:" "$@"
    exit 1
}

usage() {
   log "Usage: $(basename "$0") <first tarball> <second tarball>"
}

if ! git --version >/dev/null 2>&1; then
    die "Need git to diff tarballs"
elif ! git-buildpackage --version >/dev/null 2>&1; then
    die "Need git-buildpackage to diff tarballs"
fi

while [ $# -gt 0 ]; do
    case $1 in
      --help)
        usage
        exit 0
      ;;
      --)
        shift
        break
      ;;
      -*)
        die "Unknown option $1"
      ;;
      *)
        # regular args
        break
      ;;
    esac
done

if [ $# -ne 2 ]; then
    die "Need exactly two arguments, the tarballs to compare"
fi

first="$1"
second="$2"

# absolute pathnames
if ! echo "$first" | grep -q '^/'; then
    first="$(pwd)/$first"
fi
if ! echo "$second" | grep -q '^/'; then
    first="$(pwd)/$second"
fi

if ! [ -r "$first" ]; then
    die "Can't read $first"
elif ! [ -r "$second" ]; then
    die "Can't read $second"
fi

DIFF_DIR=""
cleanup() {
    if [ -n "$DIFF_DIR" ]; then
        rm -rf "$DIFF_DIR"
    fi
}

trap "cleanup" 0 1 2 3 9 11 13 15

DIFF_DIR="$(mktemp -dt)"

cd "$DIFF_DIR"
# can't be overriden by flags
cat >.gbp.conf <<EOF
[DEFAULT]
sign-tags = False
EOF
git init --quiet
log_i "Importing first tarball"
git-import-orig --upstream-branch=tarball-diff --upstream-tag="%(version)s" \
    --upstream-version=1 --no-dch --no-merge "$first" >/dev/null
log_i "Importing second tarball"
git-import-orig --upstream-branch=tarball-diff --upstream-tag="%(version)s" \
    --upstream-version=2 --no-dch --no-merge "$second" >/dev/null
git diff 1 2 || true

Reply via email to