mirror of
				https://github.com/f-droid/fdroidserver.git
				synced 2025-11-04 06:30:27 +03:00 
			
		
		
		
	new helpers: get_output_extension() & get_release_apk_filename()
This also moves to the standard var names: appid & versionCode
This commit is contained in:
		
							parent
							
								
									8b52740636
								
							
						
					
					
						commit
						b933043ca1
					
				
					 2 changed files with 14 additions and 7 deletions
				
			
		| 
						 | 
				
			
			@ -1126,13 +1126,23 @@ def apk_parse_release_filename(apkname):
 | 
			
		|||
    return None, None, None
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def get_output_extension(build):
 | 
			
		||||
    if build.output:
 | 
			
		||||
        return get_file_extension(replace_build_vars(build.output, build))
 | 
			
		||||
    return 'apk'
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def get_release_apk_filename(appid, versionCode):
 | 
			
		||||
    return f"{appid}_{versionCode}.apk"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def get_release_filename(app, build, extension=None):
 | 
			
		||||
    if extension:
 | 
			
		||||
        return "%s_%s.%s" % (app.id, build.versionCode, extension)
 | 
			
		||||
    if build.output and get_file_extension(build.output):
 | 
			
		||||
        return "%s_%s.%s" % (app.id, build.versionCode, get_file_extension(build.output))
 | 
			
		||||
    else:
 | 
			
		||||
        return "%s_%s.apk" % (app.id, build.versionCode)
 | 
			
		||||
        return get_release_apk_filename(app.id, build.versionCode)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def get_toolsversion_logname(app, build):
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -104,11 +104,6 @@ class IntegrationTest(unittest.TestCase):
 | 
			
		|||
            for line in filtered:
 | 
			
		||||
                f.write(line)
 | 
			
		||||
 | 
			
		||||
    @staticmethod
 | 
			
		||||
    def get_fdroid_apk_filename(file):
 | 
			
		||||
        id, version_code, _ = get_apkid(file)
 | 
			
		||||
        return f"{id}_{version_code}.apk"
 | 
			
		||||
 | 
			
		||||
    @staticmethod
 | 
			
		||||
    def copy_apks_into_repo():
 | 
			
		||||
        def to_skip(name):
 | 
			
		||||
| 
						 | 
				
			
			@ -126,8 +121,10 @@ class IntegrationTest(unittest.TestCase):
 | 
			
		|||
 | 
			
		||||
        for f in FILES.glob("*.apk"):
 | 
			
		||||
            if not to_skip(f.name):
 | 
			
		||||
                appid, versionCode, _ignored = get_apkid(f)
 | 
			
		||||
                shutil.copy(
 | 
			
		||||
                    f, Path("repo") / IntegrationTest.get_fdroid_apk_filename(f)
 | 
			
		||||
                    f,
 | 
			
		||||
                    Path("repo") / common.get_release_apk_filename(appid, versionCode),
 | 
			
		||||
                )
 | 
			
		||||
 | 
			
		||||
    @staticmethod
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue