mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-10-03 17:50:11 +02:00
make read_metadata only parse files actually used by lint/rewritemeta
Now that the description formatting is removed, there is no need to load all of the app metadata before operating on a single one. This change makes lint and rewritemeta only load the metadata for the apps it is actually operating on. Before, it would always load all metadata files. #845 closes #678
This commit is contained in:
parent
c98b15e72a
commit
129438fd30
@ -583,7 +583,7 @@ def main():
|
||||
config = common.read_config(options)
|
||||
|
||||
# Get all apps...
|
||||
allapps = metadata.read_metadata()
|
||||
allapps = metadata.read_metadata(options.appid)
|
||||
apps = common.read_app_args(options.appid, allapps, False)
|
||||
|
||||
anywarns = check_for_unsupported_metadata_files()
|
||||
|
@ -541,7 +541,7 @@ def read_srclibs():
|
||||
srclibs[srclibname] = parse_yaml_srclib(metadatapath)
|
||||
|
||||
|
||||
def read_metadata(check_vcs=[], refresh=True, sort_by_time=False):
|
||||
def read_metadata(appids=None, check_vcs=[], refresh=True, sort_by_time=False):
|
||||
"""Return a list of App instances sorted newest first
|
||||
|
||||
This reads all of the metadata files in a 'data' repository, then
|
||||
@ -563,6 +563,20 @@ def read_metadata(check_vcs=[], refresh=True, sort_by_time=False):
|
||||
if not os.path.exists(basedir):
|
||||
os.makedirs(basedir)
|
||||
|
||||
if appids:
|
||||
vercodes = fdroidserver.common.read_pkg_args(appids)
|
||||
found_invalid = False
|
||||
metadatafiles = []
|
||||
for appid in vercodes.keys():
|
||||
f = os.path.join('metadata', '%s.yml' % appid)
|
||||
if os.path.exists(f):
|
||||
metadatafiles.append(f)
|
||||
else:
|
||||
found_invalid = True
|
||||
logging.critical(_("No such package: %s") % appid)
|
||||
if found_invalid:
|
||||
raise FDroidException(_("Found invalid appids in arguments"))
|
||||
else:
|
||||
metadatafiles = (glob.glob(os.path.join('metadata', '*.yml'))
|
||||
+ glob.glob('.fdroid.yml'))
|
||||
|
||||
|
@ -61,7 +61,7 @@ def main():
|
||||
config = common.read_config(options)
|
||||
|
||||
# Get all apps...
|
||||
allapps = metadata.read_metadata()
|
||||
allapps = metadata.read_metadata(options.appid)
|
||||
apps = common.read_app_args(options.appid, allapps, False)
|
||||
|
||||
for appid, app in apps.items():
|
||||
|
Loading…
Reference in New Issue
Block a user