Fix archive repo apk names and source references

This commit is contained in:
Ciaran Gultnieks 2013-05-15 17:09:37 +01:00
parent 979dc7840d
commit 44a364ba1c

View file

@ -232,11 +232,10 @@ def scan_apks(apps, apkcache, repodir, knownapks):
apks = [] apks = []
for apkfile in glob.glob(os.path.join(repodir, '*.apk')): for apkfile in glob.glob(os.path.join(repodir, '*.apk')):
apkfilename = apkfile[5:] apkfilename = apkfile[len(repodir):]
if apkfilename.find(' ') != -1: if apkfilename.find(' ') != -1:
print "No spaces in APK filenames!" print "No spaces in APK filenames!"
sys.exit(1) sys.exit(1)
srcfilename = apkfilename[:-4] + "_src.tar.gz"
if apkfilename in apkcache: if apkfilename in apkcache:
if options.verbose: if options.verbose:
@ -249,6 +248,7 @@ def scan_apks(apps, apkcache, repodir, knownapks):
print "Processing " + apkfilename print "Processing " + apkfilename
thisinfo = {} thisinfo = {}
thisinfo['apkname'] = apkfilename thisinfo['apkname'] = apkfilename
srcfilename = apkfilename[:-4] + "_src.tar.gz"
if os.path.exists(os.path.join(repodir, srcfilename)): if os.path.exists(os.path.join(repodir, srcfilename)):
thisinfo['srcname'] = srcfilename thisinfo['srcname'] = srcfilename
thisinfo['size'] = os.path.getsize(apkfile) thisinfo['size'] = os.path.getsize(apkfile)
@ -747,8 +747,10 @@ def main():
if len(repodirs) > 1: if len(repodirs) > 1:
archive_old_apks(apps, apks, repodirs[0], repodirs[1], archive_older) archive_old_apks(apps, apks, repodirs[0], repodirs[1], archive_older)
# Make the index for the main repo...
make_index(apps, apks, repodirs[0], False, categories) make_index(apps, apks, repodirs[0], False, categories)
# If there's an archive repo, scan the apks for that and make the index...
archapks = None archapks = None
if len(repodirs) > 1: if len(repodirs) > 1:
archapks, cc = scan_apks(apps, apkcache, repodirs[1], knownapks) archapks, cc = scan_apks(apps, apkcache, repodirs[1], knownapks)