1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-11-04 14:30:11 +01:00

Merge branch 'recent-bug-fixes' into 'master'

Recent bug fixes

Fix a couple of bugs from the tracker.
This commit is contained in:
Daniel Martí 2014-05-29 20:24:39 +00:00
commit 969a568430
3 changed files with 46 additions and 34 deletions

View File

@ -129,7 +129,7 @@ __complete_install() {
__complete_update() {
opts="-h -c -v -q -b -i -I -e -w"
lopts="--help --createmeta --verbose --quiet --buildreport --interactive
--icons --editor --wiki --pretty --clean"
--icons --editor --wiki --pretty --clean --delete-unknown"
case "${prev}" in
-e|--editor)
_filedir

View File

@ -134,8 +134,8 @@ def check_tags(app, pattern):
# Only process tags where the manifest exists...
paths = common.manifest_paths(build_dir, flavour)
version, vercode, package = common.parse_androidmanifests(paths,
app['Update Check Ignore'])
version, vercode, package = \
common.parse_androidmanifests(paths, app['Update Check Ignore'])
if not package or package != appid or not version or not vercode:
continue
@ -210,8 +210,8 @@ def check_repomanifest(app, branch=None):
paths = common.manifest_paths(build_dir, flavour)
version, vercode, package = common.parse_androidmanifests(paths,
app['Update Check Ignore'])
version, vercode, package = \
common.parse_androidmanifests(paths, app['Update Check Ignore'])
if not package:
return (None, "Couldn't find package ID")
if package != appid:

View File

@ -884,6 +884,8 @@ def main():
parser = OptionParser()
parser.add_option("-c", "--createmeta", action="store_true", default=False,
help="Create skeleton metadata files that are missing")
parser.add_option("--delete-unknown", action="store_true", default=False,
help="Delete APKs without metadata from the repo")
parser.add_option("-v", "--verbose", action="store_true", default=False,
help="Spew out even more information than normal")
parser.add_option("-q", "--quiet", action="store_true", default=False,
@ -945,6 +947,45 @@ def main():
if cc:
cachechanged = True
# Generate warnings for apk's with no metadata (or create skeleton
# metadata files, if requested on the command line)
newmetadata = False
for apk in apks:
found = False
for app in apps:
if app['id'] == apk['id']:
found = True
break
if not found:
if options.createmeta:
f = open(os.path.join('metadata', apk['id'] + '.txt'), 'w')
f.write("License:Unknown\n")
f.write("Web Site:\n")
f.write("Source Code:\n")
f.write("Issue Tracker:\n")
f.write("Summary:" + apk['name'] + "\n")
f.write("Description:\n")
f.write(apk['name'] + "\n")
f.write(".\n")
f.close()
logging.info("Generated skeleton metadata for " + apk['id'])
newmetadata = True
else:
msg = apk['apkname'] + " (" + apk['id'] + ") has no metadata!"
if options.delete_unknown:
logging.warn(msg + "\n\tdeleting: repo/" + apk['apkname'])
rmf = os.path.join(repodirs[0], apk['apkname'])
if not os.path.exists(rmf):
logging.error("Could not find {0} to remove it".format(rmf))
else:
os.remove(rmf)
else:
logging.warn(msg + "\n\tUse `fdroid update -c` to create it.")
# update the metadata with the newly created ones included
if newmetadata:
apps = metadata.read_metadata()
# Scan the archive repo for apks as well
if len(repodirs) > 1:
archapks, cc = scan_apks(apps, apkcache, repodirs[1], knownapks)
@ -997,35 +1038,6 @@ def main():
# name comes from there!)
apps = sorted(apps, key=lambda app: app['Name'].upper())
# Generate warnings for apk's with no metadata (or create skeleton
# metadata files, if requested on the command line)
for apk in apks:
found = False
for app in apps:
if app['id'] == apk['id']:
found = True
break
if not found:
if options.createmeta:
f = open(os.path.join('metadata', apk['id'] + '.txt'), 'w')
f.write("License:Unknown\n")
f.write("Web Site:\n")
f.write("Source Code:\n")
f.write("Issue Tracker:\n")
f.write("Summary:" + apk['name'] + "\n")
f.write("Description:\n")
f.write(apk['name'] + "\n")
f.write(".\n")
f.close()
logging.info("Generated skeleton metadata for " + apk['id'])
else:
logging.warn(apk['apkname'] + " (" + apk['id'] + ") has no metadata - removing")
rmf = os.path.join(repodirs[0], apk['apkname'])
if not os.path.exists(rmf):
logging.error("Could not find {0} to remove it".format(rmf))
else:
os.remove(rmf)
if len(repodirs) > 1:
archive_old_apks(apps, apks, archapks, repodirs[0], repodirs[1], config['archive_older'])