From 07da062a3416fe391d799fb83d7b3ed4ee613940 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Tue, 25 May 2021 16:56:55 +0200 Subject: [PATCH 1/3] buildserver: fix ssh BatchMode config --- buildserver/setup-env-vars | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildserver/setup-env-vars b/buildserver/setup-env-vars index 19259266..5fed9e8f 100644 --- a/buildserver/setup-env-vars +++ b/buildserver/setup-env-vars @@ -17,4 +17,4 @@ chmod 0644 $bsenv # make sure that SSH never hangs at a password or key prompt printf ' StrictHostKeyChecking yes' >> /etc/ssh/ssh_config -printf ' BatchMode yes' >> /etc/ssh/config +printf ' BatchMode yes' >> /etc/ssh/ssh_config From bb77d7a6d2e1d669162adb6fc5bbdd0d38220fbc Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Tue, 25 May 2021 17:30:20 +0200 Subject: [PATCH 2/3] buildserver: standardize SDK install location /opt/android-sdk _/opt/android-sdk_ was chosen for a number of reasons: * _/opt_ is [standardized][1] for packages like the Android SDK, which has its own directory layout. * _android-sdk_ is used rather than the upstream directory name from the ZIP (e.g. _android-sdk-linux_) so that the path is the same on all platforms. * On platforms without official _/opt_ support ([macOS][2], [Windows][3], [FreeBSD][4], etc.), it does not conflict with any existing system directory. [1]: https://refspecs.linuxfoundation.org/FHS_3.0/fhs/ch03s13.html [2]: https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/FileSystemOverview/FileSystemOverview.html#//apple_ref/doc/uid/TP40010672-CH2-SW7 [3]: https://en.wikipedia.org/wiki/Directory_structure#Windows_10 [4]: https://www.freebsd.org/cgi/man.cgi?query=hier&sektion=7&format=html --- buildserver/Vagrantfile | 2 +- buildserver/config.buildserver.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/buildserver/Vagrantfile b/buildserver/Vagrantfile index 982c0267..63a891b1 100644 --- a/buildserver/Vagrantfile +++ b/buildserver/Vagrantfile @@ -79,7 +79,7 @@ Vagrant.configure("2") do |config| end config.vm.provision "shell", path: "setup-env-vars", - args: ["/home/vagrant/android-sdk"] + args: ["/opt/android-sdk"] config.vm.provision "shell", path: "provision-apt-get-install", args: [configfile['debian_mirror']] config.vm.provision "shell", path: "provision-android-sdk" diff --git a/buildserver/config.buildserver.yml b/buildserver/config.buildserver.yml index 2a3cb3fa..37b2bb4e 100644 --- a/buildserver/config.buildserver.yml +++ b/buildserver/config.buildserver.yml @@ -1,4 +1,4 @@ -sdk_path: /home/vagrant/android-sdk +sdk_path: /opt/android-sdk ndk_paths: r10e: /home/vagrant/android-ndk/r10e r21e: /home/vagrant/android-ndk/r21e From 93145a43fb92991adbe15da1ca4325d84717283f Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Tue, 25 May 2021 22:39:03 +0200 Subject: [PATCH 3/3] buildserver: use standardized paths for the NDKs This should help with reproducibility since some tools like Python still include the build paths in the binaries. https://gitlab.com/fdroid/fdroidserver/-/merge_requests/919#note_578180986 The default ANDROID_SDK_ROOT base dir of /opt/android-sdk is hard-coded in buildserver/Vagrantfile. The $ANDROID_HOME/ndk subdir is where Android Studio will install the NDK into versioned subdirs. https://developer.android.com/studio/projects/configure-agp-ndk#agp_version_41 --- buildserver/Vagrantfile | 2 +- buildserver/config.buildserver.yml | 6 +++--- buildserver/provision-android-ndk | 8 +++++++- fdroidserver/common.py | 6 +++--- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/buildserver/Vagrantfile b/buildserver/Vagrantfile index 63a891b1..ef1a407a 100644 --- a/buildserver/Vagrantfile +++ b/buildserver/Vagrantfile @@ -84,7 +84,7 @@ Vagrant.configure("2") do |config| args: [configfile['debian_mirror']] config.vm.provision "shell", path: "provision-android-sdk" config.vm.provision "shell", path: "provision-android-ndk", - args: ["/home/vagrant/android-ndk"] + args: ["/opt/android-sdk/ndk"] config.vm.provision "shell", path: "provision-gradle" end diff --git a/buildserver/config.buildserver.yml b/buildserver/config.buildserver.yml index 37b2bb4e..3073faf7 100644 --- a/buildserver/config.buildserver.yml +++ b/buildserver/config.buildserver.yml @@ -1,8 +1,8 @@ sdk_path: /opt/android-sdk ndk_paths: - r10e: /home/vagrant/android-ndk/r10e - r21e: /home/vagrant/android-ndk/r21e - r22b: /home/vagrant/android-ndk/r22b + r10e: /opt/android-sdk/ndk/r10e + r21e: /opt/android-sdk/ndk/21.4.7075529 + r22b: /opt/android-sdk/ndk/22.0.7026061 java_paths: 8: /usr/lib/jvm/java-8-openjdk-amd64 diff --git a/buildserver/provision-android-ndk b/buildserver/provision-android-ndk index 1fcabf93..655bf06f 100644 --- a/buildserver/provision-android-ndk +++ b/buildserver/provision-android-ndk @@ -18,9 +18,15 @@ fi for version in r21e r22b; do if [ ! -e ${NDK_BASE}/${version} ]; then unzip /vagrant/cache/android-ndk-${version}-linux-x86_64.zip > /dev/null - mv android-ndk-${version} ${version} + mv android-ndk-${version} \ + `sed -En 's,^Pkg.Revision *= *(.+),\1,p' android-ndk-${version}/source.properties` fi done +# allow gradle/etc to install missing NDK versions +chgrp vagrant $NDK_BASE +chmod g+w $NDK_BASE + +# ensure all users can read and execute the NDK chmod -R a+rX $NDK_BASE/ find $NDK_BASE/ -type f -executable -print0 | xargs -0 chmod a+x diff --git a/fdroidserver/common.py b/fdroidserver/common.py index fba87e99..01244f03 100644 --- a/fdroidserver/common.py +++ b/fdroidserver/common.py @@ -4006,9 +4006,9 @@ def auto_install_ndk(build): --onserver` calls can run in a single session. The production buildserver is reset between every build. - The default ANDROID_HOME base dir of /home/vagrant/android-sdk is - hard-coded in buildserver/Vagrantfile. The "ndk" subdir is where - Android Studio will install the NDK into versioned subdirs. + The default ANDROID_SDK_ROOT base dir of /opt/android-sdk is hard-coded in + buildserver/Vagrantfile. The $ANDROID_HOME/ndk subdir is where Android + Studio will install the NDK into versioned subdirs. https://developer.android.com/studio/projects/configure-agp-ndk#agp_version_41 Also, r10e and older cannot be handled via this mechanism because