[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [chutney/master] Handle CHUTNEY_DATA_DIR correctly, even if it's relative
commit bc7a8eab200cc38d919e23c48938672de90ecabb
Author: teor <teor2345@xxxxxxxxx>
Date: Mon Feb 27 23:34:34 2017 +1100
Handle CHUTNEY_DATA_DIR correctly, even if it's relative
And handle it consistently across chutney and scripts.
Closes 21568.
---
README | 4 +++-
tools/bootstrap-network.sh | 13 ++++++++++++-
tools/hsaddress.sh | 12 +++++++++++-
tools/test-network.sh | 24 +++++++++++++++++-------
tools/warnings.sh | 12 +++++++++++-
5 files changed, 54 insertions(+), 11 deletions(-)
diff --git a/README b/README
index f126145..b2ce936 100644
--- a/README
+++ b/README
@@ -55,9 +55,11 @@ Warning Options:
CHUTNEY_WARNINGS_SUMMARY=false
--no-warnings CHUTNEY_WARNINGS_SKIP=true
-Other Options:
+Expert Options:
--coverage USE_COVERAGE_BINARY=true
+ --net-dir CHUTNEY_DATA_DIR
--dry-run NETWORK_DRY_RUN=true
+ (These are advanced options: in the past, they have had long-standing bugs.)
Standard Actions:
./chutney configure networks/basic
diff --git a/tools/bootstrap-network.sh b/tools/bootstrap-network.sh
index 496bc95..7fb2eed 100755
--- a/tools/bootstrap-network.sh
+++ b/tools/bootstrap-network.sh
@@ -13,6 +13,7 @@
# (default: 'basic')
#
+# Get a working chutney path
if [ ! -d "$CHUTNEY_PATH" -o ! -x "$CHUTNEY_PATH/chutney" ]; then
# looks like a broken path: use the path to this tool instead
TOOLS_PATH=`dirname "$0"`
@@ -23,6 +24,16 @@ if [ -d "$PWD/$CHUTNEY_PATH" -a -x "$PWD/$CHUTNEY_PATH/chutney" ]; then
export CHUTNEY_PATH="$PWD/$CHUTNEY_PATH"
fi
+# Get a working net path
+if [ ! -d "$CHUTNEY_DATA_DIR" ]; then
+ # looks like a broken path: use the chutney path as a base
+ export CHUTNEY_DATA_DIR="$CHUTNEY_PATH/net"
+fi
+if [ -d "$PWD/$CHUTNEY_DATA_DIR" ]; then
+ # looks like a relative path: make chutney path absolute
+ export CHUTNEY_DATA_DIR="$PWD/$CHUTNEY_DATA_DIR"
+fi
+
VOTING_OFFSET=6
CHUTNEY="$CHUTNEY_PATH/chutney"
myname=$(basename "$0")
@@ -48,7 +59,7 @@ echo "$myname: bootstrapping network: $flavour"
# files like this.
offset=$(expr \( $(date +%s) + $VOTING_OFFSET \) % 300)
CONFOPT="TestingV3AuthVotingStartOffset"
-for file in "$CHUTNEY_PATH"/net/nodes/*a/torrc ; do
+for file in "$CHUTNEY_DATA_DIR"/nodes/*a/torrc ; do
sed -i.bak -e "s/^${CONFOPT}.*$/${CONFOPT} $offset/1" $file
done
diff --git a/tools/hsaddress.sh b/tools/hsaddress.sh
index c5d3a6f..517c6b5 100755
--- a/tools/hsaddress.sh
+++ b/tools/hsaddress.sh
@@ -17,8 +17,18 @@ if [ -d "$PWD/$CHUTNEY_PATH" -a -x "$PWD/$CHUTNEY_PATH/chutney" ]; then
export CHUTNEY_PATH="$PWD/$CHUTNEY_PATH"
fi
+# Get a working net path
+if [ ! -d "$CHUTNEY_DATA_DIR" ]; then
+ # looks like a broken path: use the chutney path as a base
+ export CHUTNEY_DATA_DIR="$CHUTNEY_PATH/net"
+fi
+if [ -d "$PWD/$CHUTNEY_DATA_DIR" ]; then
+ # looks like a relative path: make chutney path absolute
+ export CHUTNEY_DATA_DIR="$PWD/$CHUTNEY_DATA_DIR"
+fi
+
NAME=$(basename "$0")
-DEST="$CHUTNEY_PATH/net/nodes"
+DEST="$CHUTNEY_DATA_DIR/nodes"
TARGET=hidden_service/hostname
function usage() {
diff --git a/tools/test-network.sh b/tools/test-network.sh
index 1308c08..6924c20 100755
--- a/tools/test-network.sh
+++ b/tools/test-network.sh
@@ -91,13 +91,7 @@ do
export CHUTNEY_LISTEN_ADDRESS_V6="$2"
shift
;;
- --coverage)
- export USE_COVERAGE_BINARY=true
- ;;
- --dry-run)
- # process arguments, but don't call any other scripts
- export NETWORK_DRY_RUN=true
- ;;
+ # Warning Options
# we summarise unexpected warnings by default
# this shows all warnings per-node
--all-warnings)
@@ -108,6 +102,22 @@ do
--no-warnings)
export CHUTNEY_WARNINGS_SKIP=true
;;
+ # Expert options
+ # Code Coverage Binary
+ --coverage)
+ export USE_COVERAGE_BINARY=true
+ ;;
+ # Do Nothing (but process arguments and set environmental variables)
+ --dry-run)
+ # process arguments, but don't call any other scripts
+ export NETWORK_DRY_RUN=true
+ ;;
+ # The net directory, usually chutney/net
+ --net-dir)
+ export CHUTNEY_DATA_DIR="$2"
+ shift
+ ;;
+ # Oops
*)
echo "$myname: Sorry, I don't know what to do with '$1'."
echo "$UPDATE_YOUR_CHUTNEY"
diff --git a/tools/warnings.sh b/tools/warnings.sh
index 761375e..02912cb 100755
--- a/tools/warnings.sh
+++ b/tools/warnings.sh
@@ -21,6 +21,16 @@ if [ -d "$PWD/$CHUTNEY_PATH" -a -x "$PWD/$CHUTNEY_PATH/chutney" ]; then
export CHUTNEY_PATH="$PWD/$CHUTNEY_PATH"
fi
+# Get a working net path
+if [ ! -d "$CHUTNEY_DATA_DIR" ]; then
+ # looks like a broken path: use the chutney path as a base
+ export CHUTNEY_DATA_DIR="$CHUTNEY_PATH/net"
+fi
+if [ -d "$PWD/$CHUTNEY_DATA_DIR" ]; then
+ # looks like a relative path: make chutney path absolute
+ export CHUTNEY_DATA_DIR="$PWD/$CHUTNEY_DATA_DIR"
+fi
+
function show_warnings() {
# Work out the file and filter settings
if [ "$CHUTNEY_WARNINGS_SUMMARY" = true ]; then
@@ -75,7 +85,7 @@ if [ -t 1 ]; then
fi
CHUTNEY="$CHUTNEY_PATH/chutney"
NAME=$(basename "$0")
-DEST="$CHUTNEY_PATH/net/nodes"
+DEST="$CHUTNEY_DATA_DIR/nodes"
LOG_FILE=info.log
# ignore warnings we expect to get every time chutney runs
CHUTNEY_WARNINGS_IGNORE_EXPECTED=${CHUTNEY_WARNINGS_IGNORE_EXPECTED:-0}
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits