1
0
Fork 0
mirror of https://github.com/syncthing/syncthing-android.git synced 2025-01-08 11:11:34 +00:00

Update syncthing to v0.14.51-rc.2 (#43)

* Update syncthing to v0.14.51-rc.1

* Update syncthing to v0.14.51-rc.2

* Update fdroid metadata

* Update python build script
Use prebuilt go binaries from google and check SHA-256
after downloading requires files from google.
This commit is contained in:
Catfriend1 2018-09-13 09:57:31 +02:00 committed by GitHub
parent 9a8a43d273
commit fdcafc6d1b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 92 additions and 22 deletions

4
.gitignore vendored
View file

@ -29,5 +29,9 @@ project.properties
gradle/wrapper/gradle/
gradle/wrapper/gradlew*
# Prebuilt-go
syncthing/go
syncthing/go.tgz
# External build artifacts
ext/

View file

@ -35,8 +35,8 @@ android {
applicationId "com.github.catfriend1.syncthingandroid"
minSdkVersion 16
targetSdkVersion 26
versionCode 4154
versionName "0.14.50.rc2.6"
versionCode 4156
versionName "0.14.51.rc2.1"
testApplicationId 'com.github.catfriend1.syncthingandroid.test'
testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner'
playAccountConfig = playAccountConfigs.defaultAccountConfig

View file

@ -6,7 +6,7 @@ SourceCode: https://github.com/Catfriend1/syncthing-android
IssueTracker: https://github.com/Catfriend1/syncthing-android/issues
Changelog: https://github.com/Catfriend1/syncthing-android/releases
AutoName: Syncthing-Fork (Catfriend1)
AutoName: Syncthing-Fork
Summary: File synchronization
Description: |-
This is a fork of [[com.nutomic.syncthingandroid]] that brings major
@ -27,24 +27,24 @@ RepoType: git
Repo: https://github.com/Catfriend1/syncthing-android.git
Builds:
- versionName: 0.14.50.rc2.5
versionCode: 4153
commit: v0.14.50.rc2.5
- versionName: 0.14.50.rc2.6
versionCode: 4154
commit: v0.14.50.rc2.6
submodules: true
sudo: |-
apt-get install -y golang-1.9-go/testing
ln -s /usr/lib/go-1.9/bin/go /usr/bin/go
gradle:
- yes
output: app/build/outputs/apk/release/app-release-unsigned.apk
rm:
- syncthing/src/github.com/syncthing/syncthing/lib/model/testdata
prebuild: sed -i -e '/signingConfig/d' app/build.gradle
build: |-
wget -O go.tgz https://dl.google.com/go/go1.9.7.linux-amd64.tar.gz && \
echo '88573008f4f6233b81f81d8ccf92234b4f67238df0f0ab173d75a302a1f3d6ee go.tgz' | shasum -c - && \
tar xf go.tgz && \
PATH="$PWD/go/bin:$PATH" gradle buildNative
ndk: r15c
preassemble:
- buildNative
AutoUpdateMode: Version v%v
UpdateCheckMode: Tags ^v[a-z0-9.]*$
CurrentVersion: 0.14.50.rc2.5
CurrentVersionCode: 4153
CurrentVersion: 0.14.50.rc2.6
CurrentVersionCode: 4154

View file

@ -47,9 +47,66 @@ def get_min_sdk(project_dir):
def get_ndk_home():
if not os.environ.get('ANDROID_NDK_HOME', ''):
fail('ANDROID_NDK_HOME environment variable not defined')
fail('Error: ANDROID_NDK_HOME environment variable not defined')
return os.environ['ANDROID_NDK_HOME']
def which(program):
import os
def is_exe(fpath):
return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
fpath, fname = os.path.split(program)
if fpath:
if is_exe(program):
return program
else:
for path in os.environ["PATH"].split(os.pathsep):
exe_file = os.path.join(path, program)
if is_exe(exe_file):
return exe_file
return None
def install_go():
import os
import tarfile
import urllib
import hashlib
# Consts.
pwd_path = os.path.dirname(os.path.realpath(__file__))
url = 'https://dl.google.com/go/go1.9.7.linux-amd64.tar.gz'
expected_shasum = '88573008f4f6233b81f81d8ccf92234b4f67238df0f0ab173d75a302a1f3d6ee'
# Download prebuilt-go.
url_base_name = os.path.basename(url)
tar_gz_fullfn = pwd_path + os.path.sep + 'go.tgz';
if not os.path.isfile(tar_gz_fullfn):
print('Downloading prebuilt-go tar to:', tar_gz_fullfn)
tar_gz_fullfn = urllib.urlretrieve(url, tar_gz_fullfn)[0]
print('Downloaded prebuilt-go tar to:', tar_gz_fullfn)
# Verfiy SHA-1 checksum of downloaded files.
with open(tar_gz_fullfn, 'rb') as f:
contents = f.read()
found_shasum = hashlib.sha256(contents).hexdigest()
print("SHA-256:", tar_gz_fullfn, "%s" % found_shasum)
if found_shasum != expected_shasum:
fail('Error: SHA-256 checksum', found_shasum, 'of downloaded file does not match expected checksum', expected_shasum)
print("[ok] Checksum of", tar_gz_fullfn, "matches expected value.")
# Proceed with extraction of the prebuilt go.
# This will go to a subfolder "go" in the current path.
print("Extracting prebuilt-go ...")
file_name, file_extension = os.path.splitext(url_base_name)
tar = tarfile.open(tar_gz_fullfn)
tar.extractall(pwd_path)
# Add (...).tar/go/bin" to the PATH.
go_bin_path = pwd_path + os.path.sep + 'go' + os.path.sep + 'bin'
print('Adding to PATH:', go_bin_path)
os.environ["PATH"] += os.pathsep + go_bin_path
if platform.system() not in SUPPORTED_PYTHON_PLATFORMS:
fail('Unsupported python platform %s. Supported platforms: %s', platform.system(),
@ -63,6 +120,18 @@ go_build_dir = os.path.join(build_dir, 'go-packages')
syncthing_dir = os.path.join(module_dir, 'src', 'github.com', 'syncthing', 'syncthing')
min_sdk = get_min_sdk(project_dir)
# Check if go is available.
go_bin = which("go");
if not go_bin:
print('Warning: go is not available on the PATH.')
install_go();
# Retry: Check if go is available.
go_bin = which("go");
if not go_bin:
fail('Error: go is not available on the PATH.')
print ('go_bin [', go_bin, ']')
# Make sure all tags are available for git describe
# https://github.com/syncthing/syncthing-android/issues/872
subprocess.check_call([
@ -79,16 +148,12 @@ for target in BUILD_TARGETS:
if os.environ.get('SYNCTHING_ANDROID_PREBUILT', ''):
# The environment variable indicates the SDK and stdlib was prebuilt, set a custom paths.
standalone_ndk_dir = '%s/standalone-ndk/android-%s-%s' % (
get_ndk_home(), target_min_sdk, target['goarch']
)
standalone_ndk_dir = get_ndk_home() + os.path.sep + 'standalone-ndk' + os.path.sep + 'android-' + target_min_sdk + '-' + target['goarch']
pkg_argument = []
else:
# Build standalone NDK toolchain if it doesn't exist.
# https://developer.android.com/ndk/guides/standalone_toolchain.html
standalone_ndk_dir = '%s/standalone-ndk/android-%s-%s' % (
build_dir, target_min_sdk, target['goarch']
)
standalone_ndk_dir = build_dir + os.path.sep + 'standalone-ndk' + os.path.sep + 'android-' + target_min_sdk + '-' + target['goarch']
pkg_argument = ['-pkgdir', os.path.join(go_build_dir, target['goarch'])]
if not os.path.isdir(standalone_ndk_dir):
@ -122,7 +187,7 @@ for target in BUILD_TARGETS:
syncthingVersion = syncthingVersion.replace("rc", "preview");
print('Building syncthing version', syncthingVersion);
subprocess.check_call([
'go', 'run', 'build.go', '-goos', 'android', '-goarch', target['goarch'],
go_bin, 'run', 'build.go', '-goos', 'android', '-goarch', target['goarch'],
'-version', syncthingVersion
] + pkg_argument + ['-no-upgrade', 'build'], env=environ, cwd=syncthing_dir)

View file

@ -11,4 +11,5 @@ task buildNative(type: Exec) {
task cleanNative(type: Delete) {
delete "$projectDir/../app/src/main/jniLibs/"
delete "gobuild"
delete "go"
}

@ -1 +1 @@
Subproject commit 7c0798b6224e6407e3b0872b204b6fc224d70325
Subproject commit 49d5eae66a979596a229ce1ac95cfc7da11e4bf8