mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-11-14 02:50:12 +01:00
Merge branch '273-invalid-apk-gets-through-to-publish-stage' into 'master'
throw proper error when download of apks fail Closes #273 See merge request !258
This commit is contained in:
commit
1c25c516aa
@ -27,6 +27,7 @@ import tarfile
|
||||
import traceback
|
||||
import time
|
||||
import json
|
||||
import requests
|
||||
from configparser import ConfigParser
|
||||
from argparse import ArgumentParser
|
||||
import logging
|
||||
@ -1212,7 +1213,10 @@ def main():
|
||||
logging.info("...retrieving " + url)
|
||||
of = "{0}_{1}.apk.binary".format(app.id, build.versionCode)
|
||||
of = os.path.join(output_dir, of)
|
||||
net.download_file(url, local_filename=of)
|
||||
try:
|
||||
net.download_file(url, local_filename=of)
|
||||
except requests.exceptions.HTTPError as e:
|
||||
raise FDroidException('downloading Binaries from %s failed' % url) from e
|
||||
|
||||
build_succeeded.append(app)
|
||||
wikilog = "Build succeeded"
|
||||
|
@ -26,7 +26,8 @@ def download_file(url, local_filename=None, dldir='tmp'):
|
||||
if local_filename is None:
|
||||
local_filename = os.path.join(dldir, filename)
|
||||
# the stream=True parameter keeps memory usage low
|
||||
r = requests.get(url, stream=True)
|
||||
r = requests.get(url, stream=True, allow_redirects=True)
|
||||
r.raise_for_status()
|
||||
with open(local_filename, 'wb') as f:
|
||||
for chunk in r.iter_content(chunk_size=1024):
|
||||
if chunk: # filter out keep-alive new chunks
|
||||
|
@ -19,6 +19,7 @@
|
||||
import sys
|
||||
import os
|
||||
import glob
|
||||
import requests
|
||||
from argparse import ArgumentParser
|
||||
import logging
|
||||
|
||||
@ -76,7 +77,10 @@ def main():
|
||||
os.remove(remoteapk)
|
||||
url = 'https://f-droid.org/repo/' + apkfilename
|
||||
logging.info("...retrieving " + url)
|
||||
net.download_file(url, dldir=tmp_dir)
|
||||
try:
|
||||
net.download_file(url, dldir=tmp_dir)
|
||||
except requests.exceptions.HTTPError as e:
|
||||
raise FDroidException('downloading %s failed', url) from e
|
||||
|
||||
compare_result = common.verify_apks(
|
||||
remoteapk,
|
||||
|
Loading…
Reference in New Issue
Block a user