From d75e5f4a55ecb1711ea1155e08065c368b1fb8a1 Mon Sep 17 00:00:00 2001 From: Dan Ballard Date: Fri, 24 Nov 2023 14:07:03 -0800 Subject: [PATCH] Revert "script to update tor-fetch script to latest published tor expert bundle; compress mac .dmg" This reverts commit acf3fcb648e87a8a149dcdbe996c05e6bec506b0. --- .drone.yml | 2 +- .gitignore | 2 -- fetch-tor-macos.sh | 4 ++-- fetch-tor-win.ps1 | 8 +++----- fetch-tor.sh | 14 +++----------- lib/cwtch/ffi.dart | 40 ++++++++++++++++++++-------------------- linux/cwtch | 2 +- linux/cwtch.template.sh | 2 +- linux/package-release.sh | 2 +- macos/package-release.sh | 6 ++---- run-tests.sh | 4 ++-- 11 files changed, 36 insertions(+), 50 deletions(-) diff --git a/.drone.yml b/.drone.yml index 08002453..0ddf9fa4 100644 --- a/.drone.yml +++ b/.drone.yml @@ -220,7 +220,7 @@ steps: - copy 'C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Redist\MSVC\14.36.32532\x64\Microsoft.VC143.CRT\msvcp140.dll' $Env:releasedir - copy README.md $Env:releasedir\ - copy windows\*.bat $Env:releasedir\ - - Copy-Item -Path windows/tor -Destination $Env:releasedir" -recurse + - powershell -command "Expand-Archive -Path tor.zip -DestinationPath $Env:releasedir\Tor" - name: package-windows image: openpriv/nsis diff --git a/.gitignore b/.gitignore index 74e0c4a5..48117da2 100644 --- a/.gitignore +++ b/.gitignore @@ -69,9 +69,7 @@ analysis_options.yaml integration_test/env/default/tor integration_test/env/temp* linux/Tor -linux/tor linux/tor.tar.gz -macos/tor coverage test/failures diff --git a/fetch-tor-macos.sh b/fetch-tor-macos.sh index c85b5d1e..a1071966 100755 --- a/fetch-tor-macos.sh +++ b/fetch-tor-macos.sh @@ -1,7 +1,7 @@ #!/bin/sh cd macos -curl https://archive.torproject.org/tor-package-archive/torbrowser/13.0.1/tor-expert-bundle-macos-aarch64-13.0.1.tar.gz --output tor.tar.gz +curl https://git.openprivacy.ca/openprivacy/buildfiles/raw/branch/master/tor/tor-macos-0.4.7.8.tar.gz --output tor.tar.gz tar -xzf tor.tar.gz -chmod a+x tor/tor +chmod a+x Tor/tor.real cd .. diff --git a/fetch-tor-win.ps1 b/fetch-tor-win.ps1 index 45f74a6f..7e7c4a01 100644 --- a/fetch-tor-win.ps1 +++ b/fetch-tor-win.ps1 @@ -1,8 +1,6 @@ -Invoke-WebRequest -Uri https://archive.torproject.org/tor-package-archive/torbrowser/13.0.1/tor-expert-bundle-windows-x86_64-13.0.1.tar.gz -OutFile tor.tar.gz +Invoke-WebRequest -Uri https://git.openprivacy.ca/openprivacy/buildfiles/raw/branch/master/tor/tor-win64-0.4.7.8.zip -OutFile tor.zip -# if ((Get-FileHash tor.tar.gz -Algorithm sha512).Hash -ne '5b8f900a37f6e90d7a945b3903d769383c7478042cb43b2105d2374186e1a536f1a4758a2823d1d5be71d53a81dcfd8243293e04f82812d355983df322823cf4' ) { Write-Error 'tor.zip sha512sum mismatch' } +if ((Get-FileHash tor.zip -Algorithm sha512).Hash -ne '5b8f900a37f6e90d7a945b3903d769383c7478042cb43b2105d2374186e1a536f1a4758a2823d1d5be71d53a81dcfd8243293e04f82812d355983df322823cf4' ) { Write-Error 'tor.zip sha512sum mismatch' } -#Expand-Archive -Path tor.tar.gz -DestinationPath tor -mkdir windows/tor -tar -xzf tor.tar.gz -C windows/tor +Expand-Archive -Path tor.zip -DestinationPath Tor diff --git a/fetch-tor.sh b/fetch-tor.sh index 0ffa18d5..ca71ca7b 100755 --- a/fetch-tor.sh +++ b/fetch-tor.sh @@ -1,22 +1,14 @@ #!/bin/sh cd linux -wget https://archive.torproject.org/tor-package-archive/torbrowser/13.0.1/tor-expert-bundle-linux-x86_64-13.0.1.tar.gz -O tor.tar.gz +wget https://git.openprivacy.ca/openprivacy/buildfiles/raw/branch/master/tor/tor-0.4.7.8-linux-x86_64.tar.gz -O tor.tar.gz tar -xzf tor.tar.gz cd .. mkdir -p android/app/src/main/jniLibs/arm64-v8a -wget https://archive.torproject.org/tor-package-archive/torbrowser/13.0.3/tor-expert-bundle-android-aarch64-13.0.3.tar.gz -O tor-aarch64.tar.gz -mkdir tor-aarch64 -tar -xzf tor-aarch64.tar.gz -C tor-aarch64 -cp tor-aarch64/tor/libTor.so android/app/src/main/jniLibs/arm64-v8a/libtor.so +wget https://git.openprivacy.ca/openprivacy/buildfiles/raw/branch/master/tor/tor-0.4.7.10-arm64 -O android/app/src/main/jniLibs/arm64-v8a/libtor.so chmod a+x android/app/src/main/jniLibs/arm64-v8a/libtor.so -rm -r tor-aarch64 mkdir -p android/app/src/main/jniLibs/armeabi-v7a -wget https://archive.torproject.org/tor-package-archive/torbrowser/13.0.3/tor-expert-bundle-android-armv7-13.0.3.tar.gz -O tor-armv7.tar.gz -mkdir tor-armv7 -tar -xzf tor-armv7.tar.gz -C tor-armv7 -cp tor-armv7/tor/libTor.so android/app/src/main/jniLibs/armeabi-v7a/libtor.so +wget https://git.openprivacy.ca/openprivacy/buildfiles/raw/branch/master/tor/tor-0.4.7.10-arm7 -O android/app/src/main/jniLibs/armeabi-v7a/libtor.so chmod a+x android/app/src/main/jniLibs/armeabi-v7a/libtor.so -rm -r tor-armv7 \ No newline at end of file diff --git a/lib/cwtch/ffi.dart b/lib/cwtch/ffi.dart index d462ffcf..ec0f9197 100644 --- a/lib/cwtch/ffi.dart +++ b/lib/cwtch/ffi.dart @@ -177,44 +177,44 @@ class CwtchFfi implements Cwtch { cwtchDir = envVars['CWTCH_HOME'] ?? path.join(envVars['HOME']!, ".cwtch"); } - if (await File("linux/tor/tor").exists()) { - bundledTor = "linux/tor/tor"; - } else if (await File("lib/tor/tor").exists()) { - bundledTor = "lib/tor/tor"; - } else if (await File(path.join(home, ".local/lib/cwtch/tor/tor")).exists()) { - bundledTor = path.join(home, ".local/lib/cwtch/tor/tor"); - } else if (await File("/usr/lib/cwtch/tor/tor").exists()) { - bundledTor = "/usr/lib/cwtch/tor/tor"; + if (await File("linux/Tor/tor").exists()) { + bundledTor = "linux/Tor/tor"; + } else if (await File("lib/Tor/tor").exists()) { + bundledTor = "lib/Tor/tor"; + } else if (await File(path.join(home, ".local/lib/cwtch/Tor/tor")).exists()) { + bundledTor = path.join(home, ".local/lib/cwtch/Tor/tor"); + } else if (await File("/usr/lib/cwtch/Tor/tor").exists()) { + bundledTor = "/usr/lib/cwtch/Tor/tor"; } else { bundledTor = "tor"; } } else if (Platform.isWindows) { cwtchDir = envVars['CWTCH_DIR'] ?? path.join(envVars['UserProfile']!, ".cwtch"); - String currentTor = path.join(Directory.current.absolute.path, "tor\\tor\\tor.exe"); + String currentTor = path.join(Directory.current.absolute.path, "Tor\\Tor\\tor.exe"); if (await File(currentTor).exists()) { bundledTor = currentTor; } else { String exeDir = path.dirname(Platform.resolvedExecutable); - bundledTor = path.join(exeDir, "tor\\tor\\tor.exe"); + bundledTor = path.join(exeDir, "Tor\\Tor\\tor.exe"); } } else if (Platform.isMacOS) { cwtchDir = envVars['CWTCH_HOME'] ?? path.join(envVars['HOME']!, "Library/Application Support/Cwtch"); - if (await File("Cwtch.app/Contents/MacOS/tor/tor").exists()) { - bundledTor = "Cwtch.app/Contents/MacOS/tor/tor"; - } else if (await File("/Applications/Cwtch.app/Contents/MacOS/tor/tor").exists()) { - bundledTor = "/Applications/Cwtch.app/Contents/MacOS/tor/tor"; - } else if (await File("/Volumes/Cwtch/Cwtch.app/Contents/MacOS/tor/tor").exists()) { - bundledTor = "/Volumes/Cwtch/Cwtch.app/Contents/MacOS/tor/tor"; - } else if (await File("/Applications/Tor Browser.app/Contents/MacOS/tor/tor").exists()) { - bundledTor = "/Applications/Tor Browser.app/Contents/MacOS/tor/tor"; + if (await File("Cwtch.app/Contents/MacOS/Tor/tor.real").exists()) { + bundledTor = "Cwtch.app/Contents/MacOS/Tor/tor.real"; + } else if (await File("/Applications/Cwtch.app/Contents/MacOS/Tor/tor.real").exists()) { + bundledTor = "/Applications/Cwtch.app/Contents/MacOS/Tor/tor.real"; + } else if (await File("/Volumes/Cwtch/Cwtch.app/Contents/MacOS/Tor/tor.real").exists()) { + bundledTor = "/Volumes/Cwtch/Cwtch.app/Contents/MacOS/Tor/tor.real"; + } else if (await File("/Applications/Tor Browser.app/Contents/MacOS/Tor/tor.real").exists()) { + bundledTor = "/Applications/Tor Browser.app/Contents/MacOS/Tor/tor.real"; print("We couldn't find Tor in the Cwtch app directory, however we can fall back to the Tor Browser binary"); } else { var splitPath = path.split(dirname(Platform.script.path)); if (splitPath[0] == "/" && splitPath[1] == "Applications") { var appName = splitPath[2]; print("We're running in /Applications in a non standard app name: $appName"); - if (await File("/Applications/$appName/Contents/MacOS/tor/tor").exists()) { - bundledTor = "/Applications/$appName/Contents/MacOS/tor/tor"; + if (await File("/Applications/$appName/Contents/MacOS/Tor/tor.real").exists()) { + bundledTor = "/Applications/$appName/Contents/MacOS/Tor/tor.real"; } } } diff --git a/linux/cwtch b/linux/cwtch index 17eace72..3c9e1ec9 100755 --- a/linux/cwtch +++ b/linux/cwtch @@ -2,4 +2,4 @@ # Script to run cwtch directly from package tarball directory -exec env LD_LIBRARY_PATH=./lib/:./lib/tor ./lib/cwtch +exec env LD_LIBRARY_PATH=./lib/:./lib/Tor ./lib/cwtch diff --git a/linux/cwtch.template.sh b/linux/cwtch.template.sh index f03bb488..79cde3f4 100755 --- a/linux/cwtch.template.sh +++ b/linux/cwtch.template.sh @@ -1,3 +1,3 @@ #!/bin/sh -exec env LD_LIBRARY_PATH=PREFIX/lib/cwtch/:PREFIX/lib/cwtch/tor PREFIX/lib/cwtch/cwtch +exec env LD_LIBRARY_PATH=PREFIX/lib/cwtch/:PREFIX/lib/cwtch/Tor PREFIX/lib/cwtch/cwtch diff --git a/linux/package-release.sh b/linux/package-release.sh index 466f111d..191a4823 100755 --- a/linux/package-release.sh +++ b/linux/package-release.sh @@ -9,4 +9,4 @@ cp linux/cwtch build/linux/x64/release/bundle/ cp README.md build/linux/x64/release/bundle/ cp linux/cwtch.png build/linux/x64/release/bundle/ cp linux/libCwtch.so build/linux/x64/release/bundle/lib/ -cp -r linux/tor build/linux/x64/release/bundle/lib +cp -r linux/Tor build/linux/x64/release/bundle/lib diff --git a/macos/package-release.sh b/macos/package-release.sh index 25e79bd2..ecef47cc 100755 --- a/macos/package-release.sh +++ b/macos/package-release.sh @@ -4,7 +4,7 @@ cp libCwtch.x64.dylib build/macos/Build/Products/Release/Cwtch.app/Contents/Frameworks/ cp libCwtch.arm64.dylib build/macos/Build/Products/Release/Cwtch.app/Contents/Frameworks/ -cp -r macos/tor build/macos/Build/Products/Release/Cwtch.app/Contents/MacOS/ +cp -r macos/Tor build/macos/Build/Products/Release/Cwtch.app/Contents/MacOS/ @@ -16,9 +16,7 @@ cp -r "build/macos/Build/Products/Release/Cwtch.app" macos_dmg/ cp macos/dmg/.DS_Store macos_dmg/ cp macos/dmg/.VolumeIcon.icns macos_dmg/ ln -s /Applications macos_dmg/Applications -hdiutil create -fs HFS+ -volname Cwtch -srcfolder macos_dmg Cwtch.tmp.dmg -# compress -hdiutil convert Cwtch.tmp.dmg -format UDZO -imagekey zlib-level=9 -o Cwtch.dmg +hdiutil create -fs HFS+ -volname Cwtch -srcfolder macos_dmg Cwtch.dmg # create-dmg requires GUI and is therefore less suited to automated builds, preserving here for # manual runs to generate new .DS_Store and .VolumeIcon.icns for capture to the dmg dir for automated reuse diff --git a/run-tests.sh b/run-tests.sh index e141e22a..eb9c68c5 100755 --- a/run-tests.sh +++ b/run-tests.sh @@ -5,8 +5,8 @@ sed "s|featurePaths: REPLACED_BY_SCRIPT|featurePaths: [$paths]|" integra flutter pub run build_runner clean flutter pub run build_runner build --delete-conflicting-outputs -PATH=$PATH:$PWD/linux/tor -LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"$PWD/linux/":"$PWD/linux/tor/" +PATH=$PATH:$PWD/linux/Tor +LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"$PWD/linux/":"$PWD/linux/Tor/" PATH=$PATH LD_LIBRARY_PATH=$LD_LIBRARY_PATH LOG_FILE=test.log CWTCH_HOME=$PWD/integration_test/env/temp/ flutter test -d linux --dart-define TEST_MODE=true integration_test/gherkin_suite_test.dart #node index2.js #if [ "$HEADLESS" = "false" ]; then