mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-10-03 17:50:11 +02:00
only support zipballs in NDK provisioning
Since I discovered there is an r10e zipball, this can now get all NDKs in zipball form. fdroid/android-sdk-transparency-log@447fea86e7 closes #902
This commit is contained in:
parent
9f77044d0d
commit
7a1d236c8d
@ -10,11 +10,6 @@ NDK_BASE=$1
|
||||
test -e $NDK_BASE || mkdir -p $NDK_BASE
|
||||
cd $NDK_BASE
|
||||
|
||||
if [ ! -e $NDK_BASE/r10e ]; then
|
||||
7zr x /vagrant/cache/android-ndk-r10e-linux-x86_64.bin > /dev/null
|
||||
mv android-ndk-r10e r10e
|
||||
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
|
||||
|
@ -96,7 +96,6 @@ packages="
|
||||
openjdk-8-jre-headless
|
||||
openjdk-8-jdk-headless
|
||||
optipng
|
||||
p7zip
|
||||
pkg-config
|
||||
python-gnupg
|
||||
python-lxml
|
||||
|
@ -307,7 +307,7 @@ def fill_config_defaults(thisconfig):
|
||||
for k in list(ndk_paths.keys()):
|
||||
if not re.match(r'r[1-9][0-9]*[a-z]?', k):
|
||||
for ndkdict in NDKS:
|
||||
if k == ndkdict['revision']:
|
||||
if k == ndkdict.get('revision'):
|
||||
ndk_paths[ndkdict['release']] = ndk_paths.pop(k)
|
||||
break
|
||||
|
||||
@ -4015,12 +4015,23 @@ def sha256base64(filename):
|
||||
|
||||
|
||||
def get_ndk_version(ndk_path):
|
||||
"""Get the version info from the metadata in the NDK package
|
||||
|
||||
Since r11, the info is nice and easy to find in
|
||||
sources.properties. Before, there was a kludgey format in
|
||||
RELEASE.txt. This is only needed for r10e.
|
||||
|
||||
"""
|
||||
source_properties = os.path.join(ndk_path, 'source.properties')
|
||||
release_txt = os.path.join(ndk_path, 'RELEASE.TXT')
|
||||
if os.path.exists(source_properties):
|
||||
with open(source_properties) as fp:
|
||||
m = re.search(r'^Pkg.Revision *= *(.+)', fp.read(), flags=re.MULTILINE)
|
||||
if m:
|
||||
return m.group(1)
|
||||
elif os.path.exists(release_txt):
|
||||
with open(release_txt) as fp:
|
||||
return fp.read().split('-')[0]
|
||||
|
||||
|
||||
def auto_install_ndk(build):
|
||||
@ -4118,6 +4129,11 @@ def _install_ndk(ndk):
|
||||
|
||||
"""Derived from https://gitlab.com/fdroid/android-sdk-transparency-log/-/blob/master/checksums.json"""
|
||||
NDKS = [
|
||||
{
|
||||
"release": "r10e",
|
||||
"sha256": "ee5f405f3b57c4f5c3b3b8b5d495ae12b660e03d2112e4ed5c728d349f1e520c",
|
||||
"url": "https://dl.google.com/android/repository/android-ndk-r10e-linux-x86_64.zip"
|
||||
},
|
||||
{
|
||||
"release": "r11",
|
||||
"revision": "11.0.2655954",
|
||||
|
@ -291,8 +291,6 @@ CACHE_FILES = [
|
||||
'dccda8aa069563c8ba2f6cdfd0777df0e34a5b4d15138ca8b9757e94f4e8a8cb'),
|
||||
('https://services.gradle.org/distributions/gradle-7.0.2-bin.zip',
|
||||
'0e46229820205440b48a5501122002842b82886e76af35f0f3a069243dca4b3c'),
|
||||
('https://dl.google.com/android/ndk/android-ndk-r10e-linux-x86_64.bin',
|
||||
'102d6723f67ff1384330d12c45854315d6452d6510286f4e5891e00a5a8f1d5a'),
|
||||
('https://dl.google.com/android/repository/android-ndk-r21e-linux-x86_64.zip',
|
||||
'ad7ce5467e18d40050dc51b8e7affc3e635c85bd8c59be62de32352328ed467e'),
|
||||
('https://dl.google.com/android/repository/android-ndk-r22b-linux-x86_64.zip',
|
||||
|
@ -1825,13 +1825,27 @@ class CommonTest(unittest.TestCase):
|
||||
|
||||
list_entry = mock.Mock()
|
||||
calls = []
|
||||
build.ndk = ['11.0.2655954', 'r12b', 'r21e']
|
||||
build.ndk = ['r10e', '11.0.2655954', 'r12b', 'r21e']
|
||||
for n in build.ndk:
|
||||
calls.append(mock.call(n))
|
||||
with mock.patch('fdroidserver.common._install_ndk', list_entry):
|
||||
fdroidserver.common.auto_install_ndk(build)
|
||||
list_entry.assert_has_calls(calls)
|
||||
|
||||
@unittest.skip("This test downloads and unzips a 1GB file.")
|
||||
def test_install_ndk(self):
|
||||
"""NDK r10e is a special case since its missing source.properties"""
|
||||
sdk_path = tempfile.mkdtemp(
|
||||
prefix=inspect.currentframe().f_code.co_name, dir=self.tmpdir
|
||||
)
|
||||
config = {'sdk_path': sdk_path}
|
||||
fdroidserver.common.config = config
|
||||
fdroidserver.common._install_ndk('r10e')
|
||||
r10e = os.path.join(sdk_path, 'ndk', 'r10e')
|
||||
self.assertEqual('r10e', fdroidserver.common.get_ndk_version(r10e))
|
||||
fdroidserver.common.fill_config_defaults(config)
|
||||
self.assertEqual({'r10e': r10e}, config['ndk_paths'])
|
||||
|
||||
def test_fill_config_defaults(self):
|
||||
"""Test the auto-detection of NDKs installed in standard paths"""
|
||||
sdk_path = tempfile.mkdtemp(
|
||||
@ -1854,6 +1868,16 @@ class CommonTest(unittest.TestCase):
|
||||
fdroidserver.common.fill_config_defaults(config)
|
||||
self.assertEqual({'r17c': ndk_bundle, 'r21e': r21e}, config['ndk_paths'])
|
||||
|
||||
r10e = os.path.join(sdk_path, 'ndk', 'r10e')
|
||||
os.makedirs(r10e)
|
||||
with open(os.path.join(r10e, 'RELEASE.TXT'), 'w') as fp:
|
||||
fp.write('r10e-rc4 (64-bit)\n')
|
||||
config = {'sdk_path': sdk_path}
|
||||
fdroidserver.common.fill_config_defaults(config)
|
||||
self.assertEqual(
|
||||
{'r10e': r10e, 'r17c': ndk_bundle, 'r21e': r21e}, config['ndk_paths']
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
os.chdir(os.path.dirname(__file__))
|
||||
|
Loading…
Reference in New Issue
Block a user