mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-09-15 15:32:30 +03:00
Merge branch 'master' of git://gitorious.org/f-droid/fdroidserver
Conflicts: fdroidserver/common.py
This commit is contained in:
commit
25c6c4abd4
4 changed files with 43 additions and 16 deletions
|
@ -270,11 +270,11 @@ been built.
|
||||||
@end enumerate
|
@end enumerate
|
||||||
|
|
||||||
|
|
||||||
@section More about build.py
|
@section More about "fdroid build"
|
||||||
|
|
||||||
When run without any parameters, @code{fdroid build} will build any and all
|
When run without any parameters, @code{fdroid build} will build any and all
|
||||||
versions of applications that you don't already have in the @code{repo}
|
versions of applications that you don't already have in the @code{repo}
|
||||||
directory (or more accurately, the @code{unsigned} directory. There are various
|
directory (or more accurately, the @code{unsigned} directory). There are various
|
||||||
other things you can do. As with all the tools, the @code{--help} option is
|
other things you can do. As with all the tools, the @code{--help} option is
|
||||||
your friend, but a few annotated examples and discussion of the more common
|
your friend, but a few annotated examples and discussion of the more common
|
||||||
usage modes follows:
|
usage modes follows:
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
#
|
#
|
||||||
# checkupdates.py - part of the FDroid server tools
|
# checkupdates.py - part of the FDroid server tools
|
||||||
# Copyright (C) 2010-12, Ciaran Gultnieks, ciaran@ciarang.com
|
# Copyright (C) 2010-13, Ciaran Gultnieks, ciaran@ciarang.com
|
||||||
#
|
#
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU Affero General Public License as published by
|
# it under the terms of the GNU Affero General Public License as published by
|
||||||
|
@ -21,8 +21,9 @@ import sys
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
import re
|
import re
|
||||||
import urllib
|
import urllib2
|
||||||
import time
|
import time
|
||||||
|
import subprocess
|
||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
import traceback
|
import traceback
|
||||||
import HTMLParser
|
import HTMLParser
|
||||||
|
@ -68,7 +69,7 @@ def check_tags(app, sdk_path):
|
||||||
version, vercode, package = common.parse_androidmanifest(manifest)
|
version, vercode, package = common.parse_androidmanifest(manifest)
|
||||||
if package and package == app['id'] and version and vercode:
|
if package and package == app['id'] and version and vercode:
|
||||||
if int(vercode) > int(hcode):
|
if int(vercode) > int(hcode):
|
||||||
hcode = vercode
|
hcode = str(int(vercode))
|
||||||
hver = version
|
hver = version
|
||||||
|
|
||||||
if hver:
|
if hver:
|
||||||
|
@ -122,7 +123,7 @@ def check_repomanifest(app, sdk_path):
|
||||||
if not vercode:
|
if not vercode:
|
||||||
return (None,"Couldn't find latest version code")
|
return (None,"Couldn't find latest version code")
|
||||||
|
|
||||||
return (version, vercode)
|
return (version, str(int(vercode)))
|
||||||
|
|
||||||
except BuildException as be:
|
except BuildException as be:
|
||||||
msg = "Could not scan app %s due to BuildException: %s" % (app['id'], be)
|
msg = "Could not scan app %s due to BuildException: %s" % (app['id'], be)
|
||||||
|
@ -139,14 +140,21 @@ def check_repomanifest(app, sdk_path):
|
||||||
# Returns (None, "a message") if this didn't work, or (version, vercode) for
|
# Returns (None, "a message") if this didn't work, or (version, vercode) for
|
||||||
# the details of the current version.
|
# the details of the current version.
|
||||||
def check_market(app):
|
def check_market(app):
|
||||||
time.sleep(10)
|
time.sleep(15)
|
||||||
url = 'http://market.android.com/details?id=' + app['id']
|
url = 'https://play.google.com/store/apps/details?id=' + app['id']
|
||||||
req = urllib.urlopen(url)
|
headers = {'User-Agent' : 'Mozilla/5.0 (X11; Linux i686; rv:18.0) Gecko/20100101 Firefox/18.0'}
|
||||||
if req.getcode() == 404:
|
req = urllib2.Request(url, None, headers)
|
||||||
return (None, 'Not in market')
|
try:
|
||||||
elif req.getcode() != 200:
|
resp = urllib2.urlopen(req)
|
||||||
return (None, 'Return code ' + str(req.getcode()))
|
except urllib2.HTTPError, e:
|
||||||
page = req.read()
|
if e.code == 404:
|
||||||
|
return (None, 'Not in market')
|
||||||
|
elif e.code == 503:
|
||||||
|
print "Whoops"
|
||||||
|
sys.exit(1)
|
||||||
|
else:
|
||||||
|
return (None, 'Failed with HTTP status' + str(req.getcode()))
|
||||||
|
page = resp.read()
|
||||||
|
|
||||||
version = None
|
version = None
|
||||||
vercode = None
|
vercode = None
|
||||||
|
@ -167,7 +175,7 @@ def check_market(app):
|
||||||
return (None, "Couldn't find version code")
|
return (None, "Couldn't find version code")
|
||||||
if not version:
|
if not version:
|
||||||
return (None, "Couldn't find version")
|
return (None, "Couldn't find version")
|
||||||
return (version, vercode)
|
return (version, str(int(vercode)))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -184,6 +192,8 @@ def main():
|
||||||
help="Check only the specified package")
|
help="Check only the specified package")
|
||||||
parser.add_option("--auto", action="store_true", default=False,
|
parser.add_option("--auto", action="store_true", default=False,
|
||||||
help="Process auto-updates")
|
help="Process auto-updates")
|
||||||
|
parser.add_option("--commit", action="store_true", default=False,
|
||||||
|
help="Commit changes")
|
||||||
(options, args) = parser.parse_args()
|
(options, args) = parser.parse_args()
|
||||||
|
|
||||||
# Get all apps...
|
# Get all apps...
|
||||||
|
@ -200,6 +210,7 @@ def main():
|
||||||
print "Processing " + app['id'] + '...'
|
print "Processing " + app['id'] + '...'
|
||||||
|
|
||||||
writeit = False
|
writeit = False
|
||||||
|
logmsg = None
|
||||||
|
|
||||||
mode = app['Update Check Mode']
|
mode = app['Update Check Mode']
|
||||||
if mode == 'Market':
|
if mode == 'Market':
|
||||||
|
@ -224,6 +235,7 @@ def main():
|
||||||
app['Current Version'] = version
|
app['Current Version'] = version
|
||||||
app['Current Version Code'] = str(int(vercode))
|
app['Current Version Code'] = str(int(vercode))
|
||||||
writeit = True
|
writeit = True
|
||||||
|
logmsg = "Update current version of " + app['id'] + " to " + version
|
||||||
|
|
||||||
if options.auto:
|
if options.auto:
|
||||||
mode = app['Auto Update Mode']
|
mode = app['Auto Update Mode']
|
||||||
|
@ -255,12 +267,20 @@ def main():
|
||||||
newbuild['commit'] = commit
|
newbuild['commit'] = commit
|
||||||
app['builds'].append(newbuild)
|
app['builds'].append(newbuild)
|
||||||
writeit = True
|
writeit = True
|
||||||
|
logmsg = "Update " + app['id'] + " to " + newbuild['version']
|
||||||
else:
|
else:
|
||||||
print 'Invalid auto update mode'
|
print 'Invalid auto update mode'
|
||||||
|
|
||||||
if writeit:
|
if writeit:
|
||||||
metafile = os.path.join('metadata', app['id'] + '.txt')
|
metafile = os.path.join('metadata', app['id'] + '.txt')
|
||||||
common.write_metadata(metafile, app)
|
common.write_metadata(metafile, app)
|
||||||
|
if options.commit:
|
||||||
|
if subprocess.call("git add " + metafile, shell=True) != 0:
|
||||||
|
print "Git add failed"
|
||||||
|
sys.exit(1)
|
||||||
|
if subprocess.call('git commit -m \"' + logmsg + '\"', shell=True) != 0:
|
||||||
|
print "Git commit failed"
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
print "Finished."
|
print "Finished."
|
||||||
|
|
||||||
|
|
|
@ -1511,6 +1511,13 @@ def getsrclib(spec, extlib_dir, sdk_path, basepath=False):
|
||||||
raise BuildException('Error updating AndrozicLib project')
|
raise BuildException('Error updating AndrozicLib project')
|
||||||
return sdir
|
return sdir
|
||||||
|
|
||||||
|
if name == 'Otr4j':
|
||||||
|
sdir = os.path.join(extlib_dir, 'Otr4j')
|
||||||
|
vcs = getvcs('git',
|
||||||
|
'https://github.com/redsolution/otr4j.git', sdir, sdk_path)
|
||||||
|
vcs.gotorevision(ref)
|
||||||
|
return sdir
|
||||||
|
|
||||||
if name == 'AnySoftKeyboardTools':
|
if name == 'AnySoftKeyboardTools':
|
||||||
sdir = os.path.join(extlib_dir, 'AnySoftKeyboardTools')
|
sdir = os.path.join(extlib_dir, 'AnySoftKeyboardTools')
|
||||||
vcs = getvcs('git',
|
vcs = getvcs('git',
|
||||||
|
|
|
@ -476,7 +476,7 @@ class FDroid
|
||||||
|
|
||||||
private function human_readable_size($size, $minDiv=0) {
|
private function human_readable_size($size, $minDiv=0) {
|
||||||
$si_prefix = array('bytes','kB','MB');
|
$si_prefix = array('bytes','kB','MB');
|
||||||
$div = 1000;
|
$div = 1024;
|
||||||
|
|
||||||
for($i=0;(abs($size) > $div && $i < count($si_prefix)) || $i<$minDiv;$i++) {
|
for($i=0;(abs($size) > $div && $i < count($si_prefix)) || $i<$minDiv;$i++) {
|
||||||
$size /= $div;
|
$size /= $div;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue