From bd3ae8860804cc6f933da05887f8aa32fa9d36c6 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Wed, 15 Jul 2015 14:43:38 -0700 Subject: [PATCH 1/3] extend text char limits to match other app stores We should be compatible with other apps stores unless there is a specific reason not to be. * Google Play, Amazon, and iTunes all have 4000 char descriptions For the summary, we can just bump it up to the same as what Play has * Google Play allows an 80 char "Short Description" https://support.google.com/googleplay/android-developer/answer/113469?hl=en * Amazon allows a 1200 char "Short Description" https://developer.amazon.com/public/support/submitting-your-app/tech-docs/submitting-your-app#Add Metadata and Image Assets --- fdroidserver/common.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fdroidserver/common.py b/fdroidserver/common.py index 170f49ee..5dc98911 100644 --- a/fdroidserver/common.py +++ b/fdroidserver/common.py @@ -70,8 +70,8 @@ default_config = { 'keystore': 'keystore.jks', 'smartcardoptions': [], 'char_limits': { - 'Summary': 50, - 'Description': 1500 + 'Summary': 80, + 'Description': 4000 }, 'keyaliases': {}, 'repo_url': "https://MyFirstFDroidRepo.org/fdroid/repo", From cef755387302a081aefed7bb3a1292c33d26deb4 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Mon, 20 Jul 2015 16:42:40 -0700 Subject: [PATCH 2/3] update: warn if APK has a date that is newer than the system clock If the date in an APK is in the future, that could cause confusion. If the system clock is wrong, then the APK will also have a date in the future. This is most likely on offline signing machines, since they do not have a time source to sync to. --- fdroidserver/update.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/fdroidserver/update.py b/fdroidserver/update.py index 5afa8758..17694f0d 100644 --- a/fdroidserver/update.py +++ b/fdroidserver/update.py @@ -27,6 +27,7 @@ import socket import zipfile import hashlib import pickle +from datetime import datetime, timedelta from xml.dom.minidom import Document from optparse import OptionParser import time @@ -542,6 +543,19 @@ def scan_apks(apps, apkcache, repodir, knownapks): apk = zipfile.ZipFile(apkfile, 'r') + # if an APK has files newer than the system time, suggest updating + # the system clock. This is useful for offline systems, used for + # signing, which do not have another source of clock sync info. It + # has to be more than 24 hours newer because ZIP/APK files do not + # store timezone info + info = apk.getinfo('AndroidManifest.xml') + dt_obj = datetime(*info.date_time) + checkdt = dt_obj - timedelta(1) + if datetime.today() < checkdt: + logging.warn('System clock is older than manifest in: ' + + apkfilename + '\nSet clock to that time using:\n' + + 'sudo date -s "' + str(dt_obj) + '"') + iconfilename = "%s.%s.png" % ( thisinfo['id'], thisinfo['versioncode']) From f625005ec3a7caaff6db4ae9be58946e877f5d6d Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Thu, 23 Jul 2015 21:42:21 -0700 Subject: [PATCH 3/3] 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. --- fdroidserver/build.py | 4 +--- fdroidserver/common.py | 15 +++++++++++++++ fdroidserver/verify.py | 6 ++---- setup.py | 1 + 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/fdroidserver/build.py b/fdroidserver/build.py index 7514e81a..e6ac3399 100644 --- a/fdroidserver/build.py +++ b/fdroidserver/build.py @@ -1088,9 +1088,7 @@ def main(): logging.info("...retrieving " + url) of = "{0}_{1}.apk.binary".format(app['id'], thisbuild['vercode']) of = os.path.join(output_dir, of) - p = FDroidPopen(['wget', '-nv', '-O', of, url]) - if p.returncode != 0 or not os.path.exists(of): - raise BuildException("...failed to retrieve " + url) + common.download_file(url, local_filename=of) build_succeeded.append(app) wikilog = "Build succeeded" diff --git a/fdroidserver/common.py b/fdroidserver/common.py index 5dc98911..9daddb9c 100644 --- a/fdroidserver/common.py +++ b/fdroidserver/common.py @@ -22,6 +22,7 @@ import sys import re import shutil import glob +import requests import stat import subprocess import time @@ -2070,3 +2071,17 @@ def string_is_integer(string): return True except ValueError: 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 diff --git a/fdroidserver/verify.py b/fdroidserver/verify.py index 9139d37a..fd0464eb 100644 --- a/fdroidserver/verify.py +++ b/fdroidserver/verify.py @@ -24,7 +24,7 @@ from optparse import OptionParser import logging import common -from common import FDroidPopen, FDroidException +from common import FDroidException options = None config = None @@ -78,9 +78,7 @@ def main(): os.remove(remoteapk) url = 'https://f-droid.org/repo/' + apkfilename logging.info("...retrieving " + url) - p = FDroidPopen(['wget', '-nv', url], cwd=tmp_dir) - if p.returncode != 0: - raise FDroidException("Failed to get " + apkfilename) + common.download_file(url, dldir=tmp_dir) compare_result = common.compare_apks( os.path.join(unsigned_dir, apkfilename), diff --git a/setup.py b/setup.py index 49281d9e..bfd5d106 100644 --- a/setup.py +++ b/setup.py @@ -28,6 +28,7 @@ setup(name='fdroidserver', 'apache-libcloud >= 0.14.1', 'pyasn1', 'pyasn1-modules', + 'requests', ], classifiers=[ 'Development Status :: 3 - Alpha',