mirror of
				https://github.com/f-droid/fdroidserver.git
				synced 2025-11-04 14:30:30 +03:00 
			
		
		
		
	Read only metadata of apps given on the command line
This commit is contained in:
		
							parent
							
								
									66018d3f09
								
							
						
					
					
						commit
						8ab1d53318
					
				
					 9 changed files with 12 additions and 27 deletions
				
			
		| 
						 | 
				
			
			@ -24,9 +24,9 @@ def main():
 | 
			
		|||
    )
 | 
			
		||||
    metadata.add_metadata_arguments(parser)
 | 
			
		||||
    options = common.parse_args(parser)
 | 
			
		||||
    pkgs = common.read_pkg_args(options.appid, True)
 | 
			
		||||
    allapps = metadata.read_metadata(pkgs)
 | 
			
		||||
    apps = common.read_app_args(options.appid, allapps, True)
 | 
			
		||||
    apps = common.read_app_args(
 | 
			
		||||
        options.appid, allow_version_codes=True, sort_by_time=True
 | 
			
		||||
    )
 | 
			
		||||
    common.read_config()
 | 
			
		||||
 | 
			
		||||
    for appid, app in apps.items():
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -19,9 +19,7 @@ def main():
 | 
			
		|||
    parser.add_argument("appid", nargs='*', help=_("applicationId with optional versionCode in the form APPID[:VERCODE]"))
 | 
			
		||||
    metadata.add_metadata_arguments(parser)
 | 
			
		||||
    options = common.parse_args(parser)
 | 
			
		||||
    pkgs = common.read_pkg_args(options.appid, True)
 | 
			
		||||
    allapps = metadata.read_metadata(pkgs)
 | 
			
		||||
    apps = common.read_app_args(options.appid, allapps, True)
 | 
			
		||||
    apps = common.read_app_args(options.appid, allow_version_codes=True, sort_by_time=True)
 | 
			
		||||
    common.read_config()
 | 
			
		||||
    srclib_dir = os.path.join('build', 'srclib')
 | 
			
		||||
    os.makedirs(srclib_dir, exist_ok=True)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1117,10 +1117,7 @@ def main():
 | 
			
		|||
    srclib_dir = os.path.join(build_dir, 'srclib')
 | 
			
		||||
    extlib_dir = os.path.join(build_dir, 'extlib')
 | 
			
		||||
 | 
			
		||||
    # Read all app and srclib metadata
 | 
			
		||||
    pkgs = common.read_pkg_args(options.appid, True)
 | 
			
		||||
    allapps = metadata.read_metadata(pkgs, sort_by_time=True)
 | 
			
		||||
    apps = common.read_app_args(options.appid, allapps, True)
 | 
			
		||||
    apps = common.read_app_args(options.appid, allow_version_codes=True, sort_by_time=True)
 | 
			
		||||
 | 
			
		||||
    for appid, app in list(apps.items()):
 | 
			
		||||
        if (app.get('Disabled') and not options.force) or not app.get('RepoType') or not app.get('Builds', []):
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -730,10 +730,7 @@ def main():
 | 
			
		|||
            logging.error(_('Build metadata git repo has uncommited changes!'))
 | 
			
		||||
            sys.exit(1)
 | 
			
		||||
 | 
			
		||||
    # Get all apps...
 | 
			
		||||
    allapps = metadata.read_metadata()
 | 
			
		||||
 | 
			
		||||
    apps = common.read_app_args(options.appid, allapps, False)
 | 
			
		||||
    apps = common.read_app_args(options.appid)
 | 
			
		||||
 | 
			
		||||
    processed = []
 | 
			
		||||
    failed = dict()
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -939,7 +939,7 @@ def get_metadata_files(vercodes):
 | 
			
		|||
    return metadatafiles
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def read_app_args(appid_versionCode_pairs, allapps, allow_version_codes=False):
 | 
			
		||||
def read_app_args(appid_versionCode_pairs, allow_version_codes=False, sort_by_time=False):
 | 
			
		||||
    """Build a list of App instances for processing.
 | 
			
		||||
 | 
			
		||||
    On top of what read_pkg_args does, this returns the whole app
 | 
			
		||||
| 
						 | 
				
			
			@ -950,6 +950,7 @@ def read_app_args(appid_versionCode_pairs, allapps, allow_version_codes=False):
 | 
			
		|||
 | 
			
		||||
    """
 | 
			
		||||
    vercodes = read_pkg_args(appid_versionCode_pairs, allow_version_codes)
 | 
			
		||||
    allapps = fdroidserver.metadata.read_metadata(appid_versionCode_pairs, sort_by_time)
 | 
			
		||||
 | 
			
		||||
    if not vercodes:
 | 
			
		||||
        return allapps
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -878,9 +878,7 @@ def main():
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def lint_metadata(options):
 | 
			
		||||
    # Get all apps...
 | 
			
		||||
    allapps = metadata.read_metadata(options.appid)
 | 
			
		||||
    apps = common.read_app_args(options.appid, allapps, False)
 | 
			
		||||
    apps = common.read_app_args(options.appid)
 | 
			
		||||
 | 
			
		||||
    anywarns = check_for_unsupported_metadata_files()
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -81,9 +81,7 @@ def main():
 | 
			
		|||
 | 
			
		||||
    config = common.read_config()
 | 
			
		||||
 | 
			
		||||
    # Get all apps...
 | 
			
		||||
    allapps = metadata.read_metadata(options.appid)
 | 
			
		||||
    apps = common.read_app_args(options.appid, allapps, False)
 | 
			
		||||
    apps = common.read_app_args(options.appid)
 | 
			
		||||
 | 
			
		||||
    for appid, app in apps.items():
 | 
			
		||||
        path = Path(app.metadatapath)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1144,10 +1144,7 @@ def main():
 | 
			
		|||
            _get_tool()
 | 
			
		||||
        return
 | 
			
		||||
 | 
			
		||||
    # Read all app and srclib metadata
 | 
			
		||||
 | 
			
		||||
    allapps = metadata.read_metadata()
 | 
			
		||||
    apps = common.read_app_args(appids, allapps, True)
 | 
			
		||||
    apps = common.read_app_args(appids, allow_version_codes=True)
 | 
			
		||||
 | 
			
		||||
    build_dir = 'build'
 | 
			
		||||
    if not os.path.isdir(build_dir):
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,6 +1,5 @@
 | 
			
		|||
#!/usr/bin/env python3
 | 
			
		||||
 | 
			
		||||
import collections
 | 
			
		||||
import glob
 | 
			
		||||
import inspect
 | 
			
		||||
import logging
 | 
			
		||||
| 
						 | 
				
			
			@ -855,7 +854,7 @@ class Test_main(unittest.TestCase):
 | 
			
		|||
 | 
			
		||||
            self.exit_func.assert_not_called()
 | 
			
		||||
            self.read_app_args_func.assert_called_once_with(
 | 
			
		||||
                ['com.example.app'], collections.OrderedDict(), True
 | 
			
		||||
                ['com.example.app'], allow_version_codes=True
 | 
			
		||||
            )
 | 
			
		||||
            self.scan_binary_func.assert_not_called()
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue