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