From be2a23145689a47546e3ccad9f6abe60d7f55bcd Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Sun, 10 May 2020 14:51:05 +0100 Subject: [PATCH] bin/mdw-build: Don't assign `$srcpath' until after `checkout'. Otherwise we end up printing two `--- srcpath = ...' lines in the common `checkout' case, which is just silly. Instead: * set `$srcpath' in the `checkout' stanza, either pointing the new tree or back at the original one; and * use `$topath' for the original source tree until we've established `$srcpath'. --- bin/mdw-build | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/bin/mdw-build b/bin/mdw-build index ff4125a..10557a8 100755 --- a/bin/mdw-build +++ b/bin/mdw-build @@ -254,7 +254,6 @@ while [ ! -f configure.ac -a ! -f configure.in -a \ cd .. done assign toppath $(pwd) -assign srcpath $toppath ## Build any necessary qualifiers. qual= sep=. @@ -264,7 +263,7 @@ case ${SBOX_SESSION_DIR+t},${DEB_BUILD_ARCH+t} in esac ## Construct the output directory. -assign releasepath $srcpath/dist-$build$qual +assign releasepath $toppath/dist-$build$qual chmod -R +w $releasepath 2>/dev/null || : rm -rf $releasepath 2>/dev/null || : mkdir $releasepath @@ -277,7 +276,7 @@ case $verbose in esac ## Do we have a Git repository? -case "$checkout,$setup,$(yesno [ -d $srcpath/.git ])" in +case "$checkout,$setup,$(yesno [ -d $toppath/.git ])" in yes,no,*) fail "Inconsistent options: can't check out without setup." ;; @@ -286,14 +285,14 @@ case "$checkout,$setup,$(yesno [ -d $srcpath/.git ])" in checkout=no gitver=none ;; yes,yes,yes) - cd $srcpath + cd $toppath [ "$(git ls-files -m)" = "" ] || warn "working tree has uncommitted changes" ;; esac ## Is there Debian build equipment? -case "$debian,$(yesno [ -d $srcpath/debian ])" in +case "$debian,$(yesno [ -d $toppath/debian ])" in yes,no) info "No debian directory found." debian=no debver=none @@ -312,7 +311,7 @@ esac case "$checkout" in yes) cd $releasepath - run git clone -sn $srcpath/.git _source + run git clone -sn $toppath/.git _source assign srcpath $releasepath/_source cd $srcpath run git update-ref refs/heads/mdw-build $checkoutrev "" @@ -321,6 +320,9 @@ case "$checkout" in run git checkout-index -afu assign gitversion "$(git describe --abbrev=4)" ;; + no) + assign srcpath $toppath + ;; esac ## Check the version number. -- 2.11.0