[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [chutney/master] Detect tor build directories with src/app or src/or



commit 99ba2818d7e0dfcaf76ced26472257ac14309fd3
Author: teor <teor@xxxxxxxxxxxxxx>
Date:   Wed Aug 8 13:02:21 2018 +1000

    Detect tor build directories with src/app or src/or
    
    Supports Tor 0.3.5 and later.
    
    Fixes 27067.
---
 tools/test-network.sh | 30 +++++++++++++++++++++++-------
 1 file changed, 23 insertions(+), 7 deletions(-)

diff --git a/tools/test-network.sh b/tools/test-network.sh
index 3aecfb1..16d8f78 100755
--- a/tools/test-network.sh
+++ b/tools/test-network.sh
@@ -187,19 +187,20 @@ fi
 #  - if $PWD looks like a tor build directory, set it to $PWD, or
 #  - unset $TOR_DIR, and let chutney fall back to finding tor binaries in
 #    $CHUTNEY_TOR and $CHUTNEY_TOR_GENCERT, or $PATH
+#
+# Find the Tor build dir using the src/tools dir
 if [ ! -d "$TOR_DIR" ]; then
-    if [ -d "$BUILDDIR/src/or" -a -d "$BUILDDIR/src/tools" ]; then
+    if [ -d "$BUILDDIR/src/tools" ]; then
         # Choose the build directory
         # But only if it looks like one
         $ECHO "$myname: \$TOR_DIR not set, trying \$BUILDDIR"
         export TOR_DIR="$BUILDDIR"
-    elif [ -d "$PWD/src/or" -a -d "$PWD/src/tools" ]; then
+    elif [ -d "$PWD/src/tools" ]; then
         # Guess the tor directory is the current directory
         # But only if it looks like one
         $ECHO "$myname: \$TOR_DIR not set, trying \$PWD"
         export TOR_DIR="$PWD"
-    elif [ -d "$PWD/../tor" -a -d "$PWD/../tor/src/or" -a \
-	   -d "$PWD/../tor/src/tools" ]; then
+    elif [ -d "$PWD/../tor" -a -d "$PWD/../tor/src/tools" ]; then
         # Guess the tor directory is next to the current directory
         # But only if it looks like one
         $ECHO "$myname: \$TOR_DIR not set, trying \$PWD/../tor"
@@ -210,10 +211,25 @@ if [ ! -d "$TOR_DIR" ]; then
     fi
 fi
 
-# make TOR_DIR absolute
-if [ -d "$PWD/$TOR_DIR" -a -d "$PWD/$TOR_DIR/src/or" -a \
+# Now find the name of the Tor app dir, which changed in Tor 0.3.5
+if [ -d "$TOR_DIR" ]; then
+    if [ -d "$TOR_DIR/src/app" ]; then
+        $ECHO "$myname: \$TOR_DIR is a Tor 0.3.5 or later build directory"
+        TOR_APP_DIR="$TOR_DIR/src/app"
+    elif [ -d "$TOR_DIR/src/or" ]; then
+        $ECHO "$myname: \$TOR_DIR is a Tor 0.3.4 or earlier build directory"
+        TOR_APP_DIR="$TOR_DIR/src/or"
+    else
+        $ECHO "$myname: \$TOR_DIR has no src/app or src/or, chutney will use \$CHUTNEY_TOR and \$CHUTNEY_TOR_GENCERT as tor binary paths, or search \$PATH for tor binary names"
+        unset TOR_DIR
+    fi
+fi
+
+# make TOR_DIR and TOR_APP_DIR absolute
+if [ -d "$PWD/$TOR_DIR" -a -d "$PWD/$TOR_APP_DIR" -a \
     -d "$PWD/$TOR_DIR/src/tools" ]; then
     export TOR_DIR="$PWD/$TOR_DIR"
+    export TOR_APP_DIR="$PWD/$TOR_APP_DIR"
 fi
 
 # mandatory: $CHUTNEY_PATH is the path to the chutney launch script
@@ -267,7 +283,7 @@ fi
 if [ -d "$TOR_DIR" ]; then
     $ECHO "$myname: Setting \$CHUTNEY_TOR and \$CHUTNEY_TOR_GENCERT based on TOR_DIR: '$TOR_DIR'"
     # TOR_DIR is absolute, so these are absolute paths
-    export CHUTNEY_TOR="$TOR_DIR/src/or/$tor_name"
+    export CHUTNEY_TOR="$TOR_APP_DIR/$tor_name"
     export CHUTNEY_TOR_GENCERT="$TOR_DIR/src/tools/$tor_gencert_name"
 else
     if [ -x "$CHUTNEY_TOR" ]; then

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits