include non-APKs that match metadata and fdroid-generated filenames

Since it is now possible to build and include arbitrary files, like OTA
update ZIP files, the update procedure needs to look for non-APK files that
match the packageName_versionCode pattern of fdroid-generated files.

!193
admin#14
privileged-extension#9
This commit is contained in:
Hans-Christoph Steiner 2017-03-10 18:28:22 +01:00
parent 9d363b91f4
commit 6aca906863
4 changed files with 77 additions and 1 deletions

View file

@ -580,6 +580,14 @@ def scan_repo_files(apkcache, repodir, knownapks, use_date_from_file=False):
repo_file['version'] = shasum
# the static ID is the SHA256 unless it is set in the metadata
repo_file['id'] = shasum
n = name.split('_')
if len(n) == 2:
packageName = n[0]
versionCode = n[1].split('.')[0]
if re.match(r'^-?[0-9]+$', versionCode) \
and common.is_valid_package_name(name.split('_')[0]):
repo_file['id'] = packageName
repo_file['versioncode'] = int(versionCode)
srcfilename = name + ".src.tar.gz"
if os.path.exists(os.path.join(repodir, srcfilename)):
repo_file['srcname'] = srcfilename