mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-09-14 06:52:39 +03:00
fdroid publish
now includes OTA ZIPs and related source
This adds support for publishing ZIP files which were built with `fdroid build`. This is for "Over-The-Air" (OTA) update ZIP files for flashing to ROMs. The first example of this is the Privileged Extension, which must be installed by flashing an OTA ZIP on Android > 5.0. !181 https://gitlab.com/fdroid/privileged-extension/issues/9 https://gitlab.com/fdroid/privileged-extension/issues/10 https://gitlab.com/fdroid/fdroiddata/merge_requests/1804 Also, "if app.Binaries:" is the same as "if app.Binaries is not None:", but is the standard Python style.
This commit is contained in:
parent
0eea26753a
commit
bc27dee950
4 changed files with 18 additions and 11 deletions
|
@ -460,7 +460,7 @@ def has_extension(filename, ext):
|
||||||
return ext == f_ext
|
return ext == f_ext
|
||||||
|
|
||||||
|
|
||||||
apk_regex = re.compile(r"^(.+)_([0-9]+)\.apk$")
|
publish_name_regex = re.compile(r"^(.+)_([0-9]+)\.(apk|zip)$")
|
||||||
|
|
||||||
|
|
||||||
def clean_description(description):
|
def clean_description(description):
|
||||||
|
@ -476,13 +476,13 @@ def clean_description(description):
|
||||||
return returnstring.rstrip('\n')
|
return returnstring.rstrip('\n')
|
||||||
|
|
||||||
|
|
||||||
def apknameinfo(filename):
|
def publishednameinfo(filename):
|
||||||
filename = os.path.basename(filename)
|
filename = os.path.basename(filename)
|
||||||
m = apk_regex.match(filename)
|
m = publish_name_regex.match(filename)
|
||||||
try:
|
try:
|
||||||
result = (m.group(1), m.group(2))
|
result = (m.group(1), m.group(2))
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
raise FDroidException("Invalid apk name: %s" % filename)
|
raise FDroidException("Invalid name for published file: %s" % filename)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -72,7 +72,7 @@ def main():
|
||||||
for apkfile in sorted(glob.glob(os.path.join(output_dir, '*.apk'))):
|
for apkfile in sorted(glob.glob(os.path.join(output_dir, '*.apk'))):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
appid, vercode = common.apknameinfo(apkfile)
|
appid, vercode = common.publishednameinfo(apkfile)
|
||||||
except FDroidException:
|
except FDroidException:
|
||||||
continue
|
continue
|
||||||
if appid not in apks:
|
if appid not in apks:
|
||||||
|
@ -87,7 +87,7 @@ def main():
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
|
||||||
apks = {common.apknameinfo(apkfile)[0]: apkfile for apkfile in
|
apks = {common.publishednameinfo(apkfile)[0]: apkfile for apkfile in
|
||||||
sorted(glob.glob(os.path.join(output_dir, '*.apk')))}
|
sorted(glob.glob(os.path.join(output_dir, '*.apk')))}
|
||||||
|
|
||||||
for appid, apk in apks.items():
|
for appid, apk in apks.items():
|
||||||
|
|
|
@ -102,10 +102,11 @@ def main():
|
||||||
logging.info("{0} apps, {0} key aliases".format(len(allapps),
|
logging.info("{0} apps, {0} key aliases".format(len(allapps),
|
||||||
len(allaliases)))
|
len(allaliases)))
|
||||||
|
|
||||||
# Process any apks that are waiting to be signed...
|
# Process any APKs or ZIPs that are waiting to be signed...
|
||||||
for apkfile in sorted(glob.glob(os.path.join(unsigned_dir, '*.apk'))):
|
for apkfile in sorted(glob.glob(os.path.join(unsigned_dir, '*.apk'))
|
||||||
|
+ glob.glob(os.path.join(unsigned_dir, '*.zip'))):
|
||||||
|
|
||||||
appid, vercode = common.apknameinfo(apkfile)
|
appid, vercode = common.publishednameinfo(apkfile)
|
||||||
apkfilename = os.path.basename(apkfile)
|
apkfilename = os.path.basename(apkfile)
|
||||||
if vercodes and appid not in vercodes:
|
if vercodes and appid not in vercodes:
|
||||||
continue
|
continue
|
||||||
|
@ -122,7 +123,7 @@ def main():
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
app = allapps[appid]
|
app = allapps[appid]
|
||||||
|
|
||||||
if app.Binaries is not None:
|
if app.Binaries:
|
||||||
|
|
||||||
# It's an app where we build from source, and verify the apk
|
# It's an app where we build from source, and verify the apk
|
||||||
# contents against a developer's binary, and then publish their
|
# contents against a developer's binary, and then publish their
|
||||||
|
@ -143,6 +144,12 @@ def main():
|
||||||
shutil.move(srcapk, os.path.join(output_dir, apkfilename))
|
shutil.move(srcapk, os.path.join(output_dir, apkfilename))
|
||||||
os.remove(apkfile)
|
os.remove(apkfile)
|
||||||
|
|
||||||
|
elif apkfile.endswith('.zip'):
|
||||||
|
|
||||||
|
# OTA ZIPs built by fdroid do not need to be signed by jarsigner,
|
||||||
|
# just to be moved into place in the repo
|
||||||
|
shutil.move(apkfile, os.path.join(output_dir, apkfilename))
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
|
||||||
# It's a 'normal' app, i.e. we sign and publish it...
|
# It's a 'normal' app, i.e. we sign and publish it...
|
||||||
|
|
|
@ -60,7 +60,7 @@ def main():
|
||||||
for apkfile in sorted(glob.glob(os.path.join(unsigned_dir, '*.apk'))):
|
for apkfile in sorted(glob.glob(os.path.join(unsigned_dir, '*.apk'))):
|
||||||
|
|
||||||
apkfilename = os.path.basename(apkfile)
|
apkfilename = os.path.basename(apkfile)
|
||||||
appid, vercode = common.apknameinfo(apkfile)
|
appid, vercode = common.publishednameinfo(apkfile)
|
||||||
|
|
||||||
if vercodes and appid not in vercodes:
|
if vercodes and appid not in vercodes:
|
||||||
continue
|
continue
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue