mirror of
				https://github.com/f-droid/fdroidserver.git
				synced 2025-11-04 06:30:27 +03:00 
			
		
		
		
	common: properly parse version from NDK's source.properties
This commit is contained in:
		
							parent
							
								
									6a875a1821
								
							
						
					
					
						commit
						649347dcd4
					
				
					 10 changed files with 65 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -551,6 +551,13 @@ include tests/dump_internal_metadata_format.py
 | 
			
		|||
include tests/exception.TestCase
 | 
			
		||||
include tests/extra/manual-vmtools-test.py
 | 
			
		||||
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/make.sh
 | 
			
		||||
include tests/getsig/run.sh
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3821,7 +3821,7 @@ def get_android_tools_versions(ndk_path=None):
 | 
			
		|||
            with open(ndk_release_txt, 'r') as fp:
 | 
			
		||||
                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):
 | 
			
		||||
        if 'source.properties' in files:
 | 
			
		||||
            source_properties = os.path.join(root, 'source.properties')
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1627,6 +1627,21 @@ class CommonTest(unittest.TestCase):
 | 
			
		|||
                {'AutoName': testvalue, 'id': 'nope'}]:
 | 
			
		||||
            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__":
 | 
			
		||||
    os.chdir(os.path.dirname(__file__))
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,2 @@
 | 
			
		|||
Pkg.Desc = Android NDK
 | 
			
		||||
Pkg.Revision = 21.3.6528147
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,2 @@
 | 
			
		|||
Pkg.Desc = Android NDK
 | 
			
		||||
Pkg.Revision = 11.2.2725575
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,2 @@
 | 
			
		|||
Pkg.Desc = Android NDK
 | 
			
		||||
Pkg.Revision = 17.2.4988734
 | 
			
		||||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			@ -0,0 +1,3 @@
 | 
			
		|||
Pkg.Revision=6
 | 
			
		||||
Pkg.Path=skiaparser;1
 | 
			
		||||
Pkg.Desc=Layout Inspector image server for API 29-30
 | 
			
		||||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue