Merge pull request #1419 from lethosor/travis-clear-df-folder

travis: Always clear DF folder
develop
Lethosor 2019-01-02 19:51:18 -05:00 committed by GitHub
commit 22fc43c7af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 26 additions and 17 deletions

@ -28,7 +28,7 @@ matrix:
- g++-4.8 - g++-4.8
before_install: before_install:
- export DF_VERSION=$(sh travis/get-df-version.sh) - export DF_VERSION=$(sh travis/get-df-version.sh)
- export DF_FOLDER="$HOME/DF-travis/$DF_VERSION" - export DF_FOLDER="$HOME/DF-travis/$DF_VERSION/df_linux"
- pip install --user "sphinx==1.4" "requests[security]" - pip install --user "sphinx==1.4" "requests[security]"
- sh travis/build-lua.sh - sh travis/build-lua.sh
- sh travis/download-df.sh - sh travis/download-df.sh
@ -56,9 +56,7 @@ script:
- python travis/check-rpc.py "$DF_FOLDER/dfhack-rpc.txt" - python travis/check-rpc.py "$DF_FOLDER/dfhack-rpc.txt"
before_cache: before_cache:
- cat "$DF_FOLDER/stderr.log" - cat "$DF_FOLDER/stderr.log"
- rm -rf "$DF_FOLDER/hack" - rm -rf "$DF_FOLDER"
- rm -rf "$DF_FOLDER/dfhack-config"
- rm -f "$DF_FOLDER"/*.log
notifications: notifications:
email: false email: false
irc: irc:

@ -10,31 +10,37 @@ cd "$(dirname "$0")"
echo "DF_VERSION: $DF_VERSION" echo "DF_VERSION: $DF_VERSION"
echo "DF_FOLDER: $DF_FOLDER" echo "DF_FOLDER: $DF_FOLDER"
mkdir -p "$DF_FOLDER" mkdir -p "$DF_FOLDER"
cd "$DF_FOLDER" # back out of df_linux
cd "$DF_FOLDER/.."
if [ -f receipt ]; then if [ -f receipt ]; then
if [ "$selfmd5" != "$(cat receipt)" ]; then if [ "$selfmd5" != "$(cat receipt)" ]; then
echo "download-df.sh changed; removing DF" echo "download-df.sh changed; removing DF"
rm receipt
else else
echo "Already downloaded $DF_VERSION" echo "Already downloaded $DF_VERSION"
exit 0
fi fi
fi fi
rm -rif "$tardest" df_linux if [ ! -f receipt ]; then
rm -f "$tardest"
minor=$(echo "$DF_VERSION" | cut -d. -f2)
patch=$(echo "$DF_VERSION" | cut -d. -f3)
url="http://www.bay12games.com/dwarves/df_${minor}_${patch}_linux.tar.bz2"
echo Downloading
wget "$url" -O "$tardest"
fi
minor=$(echo "$DF_VERSION" | cut -d. -f2) rm -rf df_linux
patch=$(echo "$DF_VERSION" | cut -d. -f3) mkdir df_linux
url="http://www.bay12games.com/dwarves/df_${minor}_${patch}_linux.tar.bz2"
echo Downloading
wget "$url" -O "$tardest"
echo Extracting echo Extracting
tar xf "$tardest" --strip-components=1 tar xf "$tardest" --strip-components=1 -C df_linux
echo Changing settings echo Changing settings
echo '' >> "$DF_FOLDER/data/init/init.txt" echo '' >> "df_linux/data/init/init.txt"
echo '[PRINT_MODE:TEXT]' >> "$DF_FOLDER/data/init/init.txt" echo '[PRINT_MODE:TEXT]' >> "df_linux/data/init/init.txt"
echo '[SOUND:NO]' >> "$DF_FOLDER/data/init/init.txt" echo '[SOUND:NO]' >> "df_linux/data/init/init.txt"
echo Done echo Done
echo "$selfmd5" > receipt echo "$selfmd5" > receipt
ls

@ -1,4 +1,4 @@
#!/bin/sh #!/bin/sh
cd "$(dirname "$0")" cd "$(dirname "$0")"
cd .. cd ..
grep DF_VERSION CMakeLists.txt | perl -ne 'print "$&\n" if /[\d\.]+/' grep -i 'set(DF_VERSION' CMakeLists.txt | perl -ne 'print "$&\n" if /[\d\.]+/'

@ -14,6 +14,9 @@ os.chdir(sys.argv[1])
if os.path.exists(test_stage): if os.path.exists(test_stage):
os.remove(test_stage) os.remove(test_stage)
print(os.getcwd())
print(os.listdir('.'))
tries = 0 tries = 0
while True: while True:
tries += 1 tries += 1
@ -33,3 +36,5 @@ while True:
process = subprocess.Popen([dfhack], stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE) process = subprocess.Popen([dfhack], stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE)
process.communicate() process.communicate()
if process.returncode != 0:
print('DF exited with ' + repr(process.returncode))