mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-11-19 21:30:10 +01:00
remove dependency on wget for 'build' and 'verify'
To make the core tools portable to platforms like Mac OS X and Windows, remove the dependency on wget and instead use Python Requests, which probably has better performance anyway.
This commit is contained in:
parent
cef7553873
commit
f625005ec3
@ -1088,9 +1088,7 @@ def main():
|
|||||||
logging.info("...retrieving " + url)
|
logging.info("...retrieving " + url)
|
||||||
of = "{0}_{1}.apk.binary".format(app['id'], thisbuild['vercode'])
|
of = "{0}_{1}.apk.binary".format(app['id'], thisbuild['vercode'])
|
||||||
of = os.path.join(output_dir, of)
|
of = os.path.join(output_dir, of)
|
||||||
p = FDroidPopen(['wget', '-nv', '-O', of, url])
|
common.download_file(url, local_filename=of)
|
||||||
if p.returncode != 0 or not os.path.exists(of):
|
|
||||||
raise BuildException("...failed to retrieve " + url)
|
|
||||||
|
|
||||||
build_succeeded.append(app)
|
build_succeeded.append(app)
|
||||||
wikilog = "Build succeeded"
|
wikilog = "Build succeeded"
|
||||||
|
@ -22,6 +22,7 @@ import sys
|
|||||||
import re
|
import re
|
||||||
import shutil
|
import shutil
|
||||||
import glob
|
import glob
|
||||||
|
import requests
|
||||||
import stat
|
import stat
|
||||||
import subprocess
|
import subprocess
|
||||||
import time
|
import time
|
||||||
@ -2070,3 +2071,17 @@ def string_is_integer(string):
|
|||||||
return True
|
return True
|
||||||
except ValueError:
|
except ValueError:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
def download_file(url, local_filename=None, dldir='tmp'):
|
||||||
|
filename = url.split('/')[-1]
|
||||||
|
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)
|
||||||
|
with open(local_filename, 'wb') as f:
|
||||||
|
for chunk in r.iter_content(chunk_size=1024):
|
||||||
|
if chunk: # filter out keep-alive new chunks
|
||||||
|
f.write(chunk)
|
||||||
|
f.flush()
|
||||||
|
return local_filename
|
||||||
|
@ -24,7 +24,7 @@ from optparse import OptionParser
|
|||||||
import logging
|
import logging
|
||||||
|
|
||||||
import common
|
import common
|
||||||
from common import FDroidPopen, FDroidException
|
from common import FDroidException
|
||||||
|
|
||||||
options = None
|
options = None
|
||||||
config = None
|
config = None
|
||||||
@ -78,9 +78,7 @@ def main():
|
|||||||
os.remove(remoteapk)
|
os.remove(remoteapk)
|
||||||
url = 'https://f-droid.org/repo/' + apkfilename
|
url = 'https://f-droid.org/repo/' + apkfilename
|
||||||
logging.info("...retrieving " + url)
|
logging.info("...retrieving " + url)
|
||||||
p = FDroidPopen(['wget', '-nv', url], cwd=tmp_dir)
|
common.download_file(url, dldir=tmp_dir)
|
||||||
if p.returncode != 0:
|
|
||||||
raise FDroidException("Failed to get " + apkfilename)
|
|
||||||
|
|
||||||
compare_result = common.compare_apks(
|
compare_result = common.compare_apks(
|
||||||
os.path.join(unsigned_dir, apkfilename),
|
os.path.join(unsigned_dir, apkfilename),
|
||||||
|
Loading…
Reference in New Issue
Block a user