chiark / gitweb /
bin/mdw-build: Don't assign `$srcpath' until after `checkout'.
authorMark Wooding <mdw@distorted.org.uk>
Sun, 10 May 2020 13:51:05 +0000 (14:51 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Sun, 10 May 2020 18:46:54 +0000 (19:46 +0100)
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

index ff4125a769dd968a10562a0d762dbd765c10699e..10557a8fa5898286cd69f6be3cd6a6e25c29ef12 100755 (executable)
@@ -254,7 +254,6 @@ while [ ! -f configure.ac -a ! -f configure.in -a \
   cd ..
 done
 assign toppath $(pwd)
   cd ..
 done
 assign toppath $(pwd)
-assign srcpath $toppath
 
 ## Build any necessary qualifiers.
 qual= sep=.
 
 ## 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.
 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
 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?
 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."
     ;;
   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)
     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?
     [ "$(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
   yes,no)
     info "No debian directory found."
     debian=no debver=none
@@ -312,7 +311,7 @@ esac
 case "$checkout" in
   yes)
     cd $releasepath
 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 ""
     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)"
     ;;
     run git checkout-index -afu
     assign gitversion "$(git describe --abbrev=4)"
     ;;
+  no)
+    assign srcpath $toppath
+    ;;
 esac
 
 ## Check the version number.
 esac
 
 ## Check the version number.