chiark / gitweb /
bin/mdw-build: Don't assign `$srcpath' until after `checkout'.
[profile] / 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)
-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.