From 105fa476dce7312dcbd33e74e33efd88265ea7a7 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Tue, 20 Aug 2013 10:07:33 +0200 Subject: [PATCH] PRE_SOURCE_HOOK handling in generate-*-snapshot scripts: match behaviour and do not test if file exits * Do not test if the file exist. It blocks the usage of 'export PRE_SOURCE_HOOK=/home/git/foo.sh version branch' * Use the same declaration between generate-git-snapshot & generate-svn-snapshot * Match the similar declaration in the git & svn scripts --- scripts/generate-git-snapshot | 9 ++------- scripts/generate-svn-snapshot | 11 +++-------- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/scripts/generate-git-snapshot b/scripts/generate-git-snapshot index 9ac2dd8..8cacd4b 100755 --- a/scripts/generate-git-snapshot +++ b/scripts/generate-git-snapshot @@ -232,13 +232,8 @@ echo "*** source package build phase ***" rm -f ./* || true if [ -n "${PRE_SOURCE_HOOK:-}" ] ; then - if ! [ -s "${PRE_SOURCE_HOOK:-}" ]; then - echo "Error: Could not find hook: ${PRE_SOURCE_HOOK:-}" >&2 - exit 1 - else - echo "*** Found environment variable PRE_SOURCE_HOOK, set to ${PRE_SOURCE_HOOK:-} ***" - sh "${PRE_SOURCE_HOOK:-}" - fi + echo "*** Found environment variable PRE_SOURCE_HOOK, set to ${PRE_SOURCE_HOOK:-} ***" + sh ${PRE_SOURCE_HOOK:-} fi cd "$SOURCE_DIRECTORY" diff --git a/scripts/generate-svn-snapshot b/scripts/generate-svn-snapshot index 0d8c00d..49ad35b 100755 --- a/scripts/generate-svn-snapshot +++ b/scripts/generate-svn-snapshot @@ -162,14 +162,9 @@ if [ "${debian_only:-}" = "1" ] ; then --svn-ignore-new -rfakeroot ) else - if ! [ -z "${PRE_SOURCE_HOOK:-}" ] ; then - if ! [ -s "${PRE_SOURCE_HOOK:-}" ]; then - echo "Error: Could not find hook: ${PRE_SOURCE_HOOK:-}" >&2 - exit 1 - else - echo "*** Found environment variable PRE_SOURCE_HOOK, set to ${PRE_SOURCE_HOOK:-} ***" - sh "${PRE_SOURCE_HOOK:-}" - fi + if [ -n "${PRE_SOURCE_HOOK:-}" ] ; then + echo "*** Found environment variable PRE_SOURCE_HOOK, set to ${PRE_SOURCE_HOOK:-} ***" + sh ${PRE_SOURCE_HOOK:-} fi dpkg-source --tar-ignore=\.svn -b source/${branch:-}