1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-11-19 21:30:10 +01:00

common: properly parse version from NDK's source.properties

This commit is contained in:
Hans-Christoph Steiner 2021-03-09 12:01:57 +01:00
parent 6a875a1821
commit 649347dcd4
10 changed files with 65 additions and 1 deletions

View File

@ -551,6 +551,13 @@ include tests/dump_internal_metadata_format.py
include tests/exception.TestCase include tests/exception.TestCase
include tests/extra/manual-vmtools-test.py include tests/extra/manual-vmtools-test.py
include tests/funding-usernames.yaml include tests/funding-usernames.yaml
include tests/get_android_tools_versions/android-ndk/android-ndk-r21d/source.properties
include tests/get_android_tools_versions/android-ndk/r11c/source.properties
include tests/get_android_tools_versions/android-ndk/r17c/source.properties
include tests/get_android_tools_versions/android-sdk/patcher/v4/source.properties
include tests/get_android_tools_versions/android-sdk/platforms/android-30/source.properties
include tests/get_android_tools_versions/android-sdk/skiaparser/1/source.properties
include tests/get_android_tools_versions/android-sdk/tools/source.properties
include tests/getsig/getsig.java include tests/getsig/getsig.java
include tests/getsig/make.sh include tests/getsig/make.sh
include tests/getsig/run.sh include tests/getsig/run.sh

View File

@ -3821,7 +3821,7 @@ def get_android_tools_versions(ndk_path=None):
with open(ndk_release_txt, 'r') as fp: with open(ndk_release_txt, 'r') as fp:
components.append((os.path.basename(ndk_path), fp.read()[:-1])) components.append((os.path.basename(ndk_path), fp.read()[:-1]))
pattern = re.compile('^Pkg.Revision=(.+)', re.MULTILINE) pattern = re.compile(r'^Pkg.Revision *= *(.+)', re.MULTILINE)
for root, dirs, files in os.walk(sdk_path): for root, dirs, files in os.walk(sdk_path):
if 'source.properties' in files: if 'source.properties' in files:
source_properties = os.path.join(root, 'source.properties') source_properties = os.path.join(root, 'source.properties')

View File

@ -1627,6 +1627,21 @@ class CommonTest(unittest.TestCase):
{'AutoName': testvalue, 'id': 'nope'}]: {'AutoName': testvalue, 'id': 'nope'}]:
self.assertEqual(testvalue, fdroidserver.common.get_app_display_name(app)) self.assertEqual(testvalue, fdroidserver.common.get_app_display_name(app))
def test_get_android_tools_versions(self):
sdk_path = os.path.join(self.basedir, 'get_android_tools_versions')
fdroidserver.common.config = {'sdk_path': sdk_path}
components = fdroidserver.common.get_android_tools_versions()
expected = (
('android-ndk/android-ndk-r21d', '21.3.6528147'),
('android-ndk/r11c', '11.2.2725575'),
('android-ndk/r17c', '17.2.4988734'),
('android-sdk/patcher/v4', '1'),
('android-sdk/platforms/android-30', '3'),
('android-sdk/skiaparser/1', '6'),
('android-sdk/tools', '26.1.1'),
)
self.assertSequenceEqual(expected, sorted(components))
if __name__ == "__main__": if __name__ == "__main__":
os.chdir(os.path.dirname(__file__)) os.chdir(os.path.dirname(__file__))

View File

@ -0,0 +1,2 @@
Pkg.Desc = Android NDK
Pkg.Revision = 21.3.6528147

View File

@ -0,0 +1,2 @@
Pkg.Desc = Android NDK
Pkg.Revision = 11.2.2725575

View File

@ -0,0 +1,2 @@
Pkg.Desc = Android NDK
Pkg.Revision = 17.2.4988734

View File

@ -0,0 +1,18 @@
#
# Copyright (C) 2016 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
Pkg.Revision=1
Pkg.Path=patcher;v4
Pkg.Desc=SDK Patch Applier v4

View File

@ -0,0 +1,9 @@
Pkg.Desc=Android SDK Platform 11
Pkg.UserSrc=false
Platform.Version=11
Platform.CodeName=
Pkg.Revision=3
AndroidVersion.ApiLevel=30
Layoutlib.Api=15
Layoutlib.Revision=1
Platform.MinToolsRev=22

View File

@ -0,0 +1,3 @@
Pkg.Revision=6
Pkg.Path=skiaparser;1
Pkg.Desc=Layout Inspector image server for API 29-30

View File

@ -0,0 +1,6 @@
Pkg.UserSrc=false
Pkg.Revision=26.1.1
Platform.MinPlatformToolsRev=20
Pkg.Dependencies=emulator
Pkg.Path=tools
Pkg.Desc=Android SDK Tools