knownapks = common.KnownApks()
for apk in apks:
knownapks.recordapk(apk['apkname'], apk['id'])
-
- app, added = knownapks.getapp(apk['apkname'])
- if not added:
- print 'Need a date for ' + apk['apkname']
- p = subprocess.Popen('git log --format="%ci" metadata/' + apk['id'] + '.txt | tail -n 1',
- shell=True, stdout = subprocess.PIPE)
- d = p.communicate()[0][:10]
- if len(d) == 0:
- print "...didn't find a metadata commit"
- else:
- print '...metadata committed:' + d
- if apk['apkname'].startswith(apk['id']):
- vercode = int(apk['apkname'][len(apk['id'])+1:-4])
- print '...built vercode:' + str(vercode)
- expr = 'Build Version:[^,]+,' + str(vercode) + ',.*'
- p = subprocess.Popen('git log --format="%ci" -S"' + expr + '" --pickaxe-regex metadata/' + apk['id'] + '.txt | tail -n 1',
- shell=True, stdout = subprocess.PIPE)
- d = p.communicate()[0][:10]
- if len(d) > 0:
- print '...build line added:' + d
- print '...using that!'
- knownapks.apks[apk['apkname']] = (apk['id'], time.strptime(d, '%Y-%m-%d'))
- knownapks.changed = True
- else:
- print "...didn't find addition of build line"
- else:
- oldestvercode = 99999999
- for apk2 in apks:
- if apk2['id'] == apk['id']:
- if apk2['versioncode'] < oldestvercode:
- oldestvercode = apk2['versioncode']
- if oldestvercode == apk['versioncode']:
- print '...oldest non-built apk - using metadata commit date'
- knownapks.apks[apk['apkname']] = (apk['id'], time.strptime(d, '%Y-%m-%d'))
- knownapks.changed = True
-
knownapks.writeifchanged()
# Generate latest apps HTML for widget