mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-11-05 06:50:29 +03:00
Merge branch 'master' into 'master'
last PEP8 fixes (everything but E501 line too long and E123 close bracket indent) These two commits fix all the rest of the PEP8 errors and warnings except for: * E123 closing bracket does not match indentation of opening bracket's line * E501 line too long (x > 79 characters) Almost all of the fixed issues were these errors: * E124 closing bracket does not match visual indentation * E125 continuation line does not distinguish itself from next logical line * E126 continuation line over-indented for hanging indent * E127 continuation line over-indented for visual indent * E128 continuation line under-indented for visual indent * E226 missing whitespace around arithmetic operator If you would like to make it run as part of the automated builds, it would just be a matter of adding this line to `jenkins-build`: ``` pep8 --ignore=E123,E501,W fdroid fdroidserver/*.py examples/*.py ```
This commit is contained in:
commit
7a699e4a48
15 changed files with 374 additions and 359 deletions
32
fdroid
32
fdroid
|
|
@ -22,21 +22,21 @@ import sys
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
commands = {
|
commands = {
|
||||||
"build": "Build a package from source",
|
"build": "Build a package from source",
|
||||||
"init": "Quickly start a new repository",
|
"init": "Quickly start a new repository",
|
||||||
"publish": "Sign and place packages in the repo",
|
"publish": "Sign and place packages in the repo",
|
||||||
"update": "Update repo information for new packages",
|
"update": "Update repo information for new packages",
|
||||||
"verify": "Verify the integrity of downloaded packages",
|
"verify": "Verify the integrity of downloaded packages",
|
||||||
"checkupdates": "Check for updates to applications",
|
"checkupdates": "Check for updates to applications",
|
||||||
"import": "Add a new application from its source code",
|
"import": "Add a new application from its source code",
|
||||||
"install": "Install built packages on devices",
|
"install": "Install built packages on devices",
|
||||||
"readmeta": "Read all the metadata files and exit",
|
"readmeta": "Read all the metadata files and exit",
|
||||||
"rewritemeta": "Rewrite all the metadata files",
|
"rewritemeta": "Rewrite all the metadata files",
|
||||||
"lint": "Warn about possible metadata errors",
|
"lint": "Warn about possible metadata errors",
|
||||||
"scanner": "Scan the source code of a package",
|
"scanner": "Scan the source code of a package",
|
||||||
"stats": "Update the stats of the repo",
|
"stats": "Update the stats of the repo",
|
||||||
"server": "Interact with the repo HTTP server",
|
"server": "Interact with the repo HTTP server",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def print_help():
|
def print_help():
|
||||||
|
|
@ -44,7 +44,7 @@ def print_help():
|
||||||
print
|
print
|
||||||
print "Valid commands are:"
|
print "Valid commands are:"
|
||||||
for cmd, summary in commands.items():
|
for cmd, summary in commands.items():
|
||||||
print " " + cmd + ' '*(15-len(cmd)) + summary
|
print " " + cmd + ' ' * (15 - len(cmd)) + summary
|
||||||
print
|
print
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -432,8 +432,8 @@ def adapt_gradle(build_dir):
|
||||||
logging.info("Adapting build.gradle at %s" % path)
|
logging.info("Adapting build.gradle at %s" % path)
|
||||||
|
|
||||||
FDroidPopen(['sed', '-i',
|
FDroidPopen(['sed', '-i',
|
||||||
r's@buildToolsVersion\([ =]*\)["\'][0-9\.]*["\']@buildToolsVersion\1"'
|
r's@buildToolsVersion\([ =]*\)["\'][0-9\.]*["\']@buildToolsVersion\1"'
|
||||||
+ config['build_tools'] + '"@g', path])
|
+ config['build_tools'] + '"@g', path])
|
||||||
|
|
||||||
|
|
||||||
def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_dir, tmp_dir, force, onserver):
|
def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_dir, tmp_dir, force, onserver):
|
||||||
|
|
@ -449,7 +449,8 @@ def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_d
|
||||||
|
|
||||||
# Prepare the source code...
|
# Prepare the source code...
|
||||||
root_dir, srclibpaths = common.prepare_source(vcs, app, thisbuild,
|
root_dir, srclibpaths = common.prepare_source(vcs, app, thisbuild,
|
||||||
build_dir, srclib_dir, extlib_dir, onserver)
|
build_dir, srclib_dir,
|
||||||
|
extlib_dir, onserver)
|
||||||
|
|
||||||
# We need to clean via the build tool in case the binary dirs are
|
# We need to clean via the build tool in case the binary dirs are
|
||||||
# different from the default ones
|
# different from the default ones
|
||||||
|
|
@ -492,7 +493,7 @@ def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_d
|
||||||
|
|
||||||
if p is not None and p.returncode != 0:
|
if p is not None and p.returncode != 0:
|
||||||
raise BuildException("Error cleaning %s:%s" %
|
raise BuildException("Error cleaning %s:%s" %
|
||||||
(app['id'], thisbuild['version']), p.stdout)
|
(app['id'], thisbuild['version']), p.stdout)
|
||||||
|
|
||||||
logging.info("Getting rid of Gradle wrapper binaries...")
|
logging.info("Getting rid of Gradle wrapper binaries...")
|
||||||
for root, dirs, files in os.walk(build_dir):
|
for root, dirs, files in os.walk(build_dir):
|
||||||
|
|
@ -536,9 +537,11 @@ def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_d
|
||||||
with open(manifest, 'r') as f:
|
with open(manifest, 'r') as f:
|
||||||
manifestcontent = f.read()
|
manifestcontent = f.read()
|
||||||
manifestcontent = manifestcontent.replace('</manifest>',
|
manifestcontent = manifestcontent.replace('</manifest>',
|
||||||
'<fdroid buildserverid="' + buildserverid + '"' +
|
'<fdroid buildserverid="'
|
||||||
' fdroidserverid="' + fdroidserverid + '"' +
|
+ buildserverid + '"'
|
||||||
'/></manifest>')
|
+ ' fdroidserverid="'
|
||||||
|
+ fdroidserverid + '"'
|
||||||
|
+ '/></manifest>')
|
||||||
with open(manifest, 'w') as f:
|
with open(manifest, 'w') as f:
|
||||||
f.write(manifestcontent)
|
f.write(manifestcontent)
|
||||||
|
|
||||||
|
|
@ -555,7 +558,7 @@ def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_d
|
||||||
|
|
||||||
if p.returncode != 0:
|
if p.returncode != 0:
|
||||||
raise BuildException("Error running build command for %s:%s" %
|
raise BuildException("Error running build command for %s:%s" %
|
||||||
(app['id'], thisbuild['version']), p.stdout)
|
(app['id'], thisbuild['version']), p.stdout)
|
||||||
|
|
||||||
# Build native stuff if required...
|
# Build native stuff if required...
|
||||||
if thisbuild.get('buildjni') not in (None, ['no']):
|
if thisbuild.get('buildjni') not in (None, ['no']):
|
||||||
|
|
@ -595,18 +598,22 @@ def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_d
|
||||||
maven_dir = root_dir
|
maven_dir = root_dir
|
||||||
|
|
||||||
mvncmd = [config['mvn3'], '-Dandroid.sdk.path=' + config['sdk_path'],
|
mvncmd = [config['mvn3'], '-Dandroid.sdk.path=' + config['sdk_path'],
|
||||||
'-Dmaven.jar.sign.skip=true', '-Dmaven.test.skip=true',
|
'-Dmaven.jar.sign.skip=true', '-Dmaven.test.skip=true',
|
||||||
'-Dandroid.sign.debug=false', '-Dandroid.release=true',
|
'-Dandroid.sign.debug=false', '-Dandroid.release=true',
|
||||||
'package']
|
'package']
|
||||||
if 'target' in thisbuild:
|
if 'target' in thisbuild:
|
||||||
target = thisbuild["target"].split('-')[1]
|
target = thisbuild["target"].split('-')[1]
|
||||||
FDroidPopen(['sed', '-i',
|
FDroidPopen(['sed', '-i',
|
||||||
's@<platform>[0-9]*</platform>@<platform>'+target+'</platform>@g',
|
's@<platform>[0-9]*</platform>@<platform>'
|
||||||
'pom.xml'], cwd=root_dir)
|
+ target + '</platform>@g',
|
||||||
|
'pom.xml'],
|
||||||
|
cwd=root_dir)
|
||||||
if '@' in thisbuild['maven']:
|
if '@' in thisbuild['maven']:
|
||||||
FDroidPopen(['sed', '-i',
|
FDroidPopen(['sed', '-i',
|
||||||
's@<platform>[0-9]*</platform>@<platform>'+target+'</platform>@g',
|
's@<platform>[0-9]*</platform>@<platform>'
|
||||||
'pom.xml'], cwd=maven_dir)
|
+ target + '</platform>@g',
|
||||||
|
'pom.xml'],
|
||||||
|
cwd=maven_dir)
|
||||||
|
|
||||||
if 'mvnflags' in thisbuild:
|
if 'mvnflags' in thisbuild:
|
||||||
mvncmd += thisbuild['mvnflags']
|
mvncmd += thisbuild['mvnflags']
|
||||||
|
|
@ -621,7 +628,7 @@ def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_d
|
||||||
spec = os.path.join(root_dir, 'buildozer.spec')
|
spec = os.path.join(root_dir, 'buildozer.spec')
|
||||||
if not os.path.exists(spec):
|
if not os.path.exists(spec):
|
||||||
raise BuildException("Expected to find buildozer-compatible spec at {0}"
|
raise BuildException("Expected to find buildozer-compatible spec at {0}"
|
||||||
.format(spec))
|
.format(spec))
|
||||||
|
|
||||||
defaults = {'orientation': 'landscape', 'icon': '',
|
defaults = {'orientation': 'landscape', 'icon': '',
|
||||||
'permissions': '', 'android.api': "18"}
|
'permissions': '', 'android.api': "18"}
|
||||||
|
|
@ -660,7 +667,7 @@ def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_d
|
||||||
'--package', app['id'],
|
'--package', app['id'],
|
||||||
'--version', bconfig.get('app', 'version'),
|
'--version', bconfig.get('app', 'version'),
|
||||||
'--orientation', orientation
|
'--orientation', orientation
|
||||||
]
|
]
|
||||||
|
|
||||||
perms = bconfig.get('app', 'permissions')
|
perms = bconfig.get('app', 'permissions')
|
||||||
for perm in perms.split(','):
|
for perm in perms.split(','):
|
||||||
|
|
@ -697,7 +704,7 @@ def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_d
|
||||||
if flavours_cmd:
|
if flavours_cmd:
|
||||||
flavours_cmd = flavours_cmd[0].upper() + flavours_cmd[1:]
|
flavours_cmd = flavours_cmd[0].upper() + flavours_cmd[1:]
|
||||||
|
|
||||||
commands += ['assemble'+flavours_cmd+'Release']
|
commands += ['assemble' + flavours_cmd + 'Release']
|
||||||
|
|
||||||
p = FDroidPopen(commands, cwd=gradle_dir)
|
p = FDroidPopen(commands, cwd=gradle_dir)
|
||||||
|
|
||||||
|
|
@ -720,20 +727,20 @@ def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_d
|
||||||
stdout_apk = '\n'.join([
|
stdout_apk = '\n'.join([
|
||||||
line for line in p.stdout.splitlines() if any(a in line for a in ('.apk', '.ap_'))])
|
line for line in p.stdout.splitlines() if any(a in line for a in ('.apk', '.ap_'))])
|
||||||
m = re.match(r".*^\[INFO\] .*apkbuilder.*/([^/]*)\.apk",
|
m = re.match(r".*^\[INFO\] .*apkbuilder.*/([^/]*)\.apk",
|
||||||
stdout_apk, re.S | re.M)
|
stdout_apk, re.S | re.M)
|
||||||
if not m:
|
if not m:
|
||||||
m = re.match(r".*^\[INFO\] Creating additional unsigned apk file .*/([^/]+)\.apk[^l]",
|
m = re.match(r".*^\[INFO\] Creating additional unsigned apk file .*/([^/]+)\.apk[^l]",
|
||||||
stdout_apk, re.S | re.M)
|
stdout_apk, re.S | re.M)
|
||||||
if not m:
|
if not m:
|
||||||
m = re.match(r'.*^\[INFO\] [^$]*aapt \[package,[^$]*' + bindir + r'/([^/]+)\.ap[_k][,\]]',
|
m = re.match(r'.*^\[INFO\] [^$]*aapt \[package,[^$]*' + bindir + r'/([^/]+)\.ap[_k][,\]]',
|
||||||
stdout_apk, re.S | re.M)
|
stdout_apk, re.S | re.M)
|
||||||
if not m:
|
if not m:
|
||||||
raise BuildException('Failed to find output')
|
raise BuildException('Failed to find output')
|
||||||
src = m.group(1)
|
src = m.group(1)
|
||||||
src = os.path.join(bindir, src) + '.apk'
|
src = os.path.join(bindir, src) + '.apk'
|
||||||
elif thisbuild['type'] == 'kivy':
|
elif thisbuild['type'] == 'kivy':
|
||||||
src = 'python-for-android/dist/default/bin/{0}-{1}-release.apk'.format(
|
src = 'python-for-android/dist/default/bin/{0}-{1}-release.apk'.format(
|
||||||
bconfig.get('app', 'title'), bconfig.get('app', 'version'))
|
bconfig.get('app', 'title'), bconfig.get('app', 'version'))
|
||||||
elif thisbuild['type'] == 'gradle':
|
elif thisbuild['type'] == 'gradle':
|
||||||
basename = app['id']
|
basename = app['id']
|
||||||
dd = build_dir
|
dd = build_dir
|
||||||
|
|
@ -748,12 +755,12 @@ def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_d
|
||||||
else:
|
else:
|
||||||
name = '-'.join([basename, '-'.join(flavours), 'release', 'unsigned'])
|
name = '-'.join([basename, '-'.join(flavours), 'release', 'unsigned'])
|
||||||
dd = os.path.normpath(dd)
|
dd = os.path.normpath(dd)
|
||||||
src = os.path.join(dd, 'build', 'apk', name+'.apk')
|
src = os.path.join(dd, 'build', 'apk', name + '.apk')
|
||||||
elif thisbuild['type'] == 'ant':
|
elif thisbuild['type'] == 'ant':
|
||||||
stdout_apk = '\n'.join([
|
stdout_apk = '\n'.join([
|
||||||
line for line in p.stdout.splitlines() if '.apk' in line])
|
line for line in p.stdout.splitlines() if '.apk' in line])
|
||||||
src = re.match(r".*^.*Creating (.+) for release.*$.*", stdout_apk,
|
src = re.match(r".*^.*Creating (.+) for release.*$.*", stdout_apk,
|
||||||
re.S | re.M).group(1)
|
re.S | re.M).group(1)
|
||||||
src = os.path.join(bindir, src)
|
src = os.path.join(bindir, src)
|
||||||
elif thisbuild['type'] == 'raw':
|
elif thisbuild['type'] == 'raw':
|
||||||
src = os.path.join(root_dir, thisbuild['output'])
|
src = os.path.join(root_dir, thisbuild['output'])
|
||||||
|
|
@ -769,9 +776,9 @@ def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_d
|
||||||
if not os.path.exists(src):
|
if not os.path.exists(src):
|
||||||
raise BuildException("Unsigned apk is not at expected location of " + src)
|
raise BuildException("Unsigned apk is not at expected location of " + src)
|
||||||
|
|
||||||
p = SilentPopen([os.path.join(config['sdk_path'],
|
p = SilentPopen([os.path.join(config['sdk_path'], 'build-tools',
|
||||||
'build-tools', config['build_tools'], 'aapt'),
|
config['build_tools'], 'aapt'),
|
||||||
'dump', 'badging', src])
|
'dump', 'badging', src])
|
||||||
|
|
||||||
vercode = None
|
vercode = None
|
||||||
version = None
|
version = None
|
||||||
|
|
@ -818,10 +825,11 @@ def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_d
|
||||||
if (version != thisbuild['version'] or
|
if (version != thisbuild['version'] or
|
||||||
vercode != thisbuild['vercode']):
|
vercode != thisbuild['vercode']):
|
||||||
raise BuildException(("Unexpected version/version code in output;"
|
raise BuildException(("Unexpected version/version code in output;"
|
||||||
" APK: '%s' / '%s', "
|
" APK: '%s' / '%s', "
|
||||||
" Expected: '%s' / '%s'")
|
" Expected: '%s' / '%s'")
|
||||||
% (version, str(vercode), thisbuild['version'], str(thisbuild['vercode']))
|
% (version, str(vercode), thisbuild['version'],
|
||||||
)
|
str(thisbuild['vercode']))
|
||||||
|
)
|
||||||
|
|
||||||
# Copy the unsigned apk to our destination directory for further
|
# Copy the unsigned apk to our destination directory for further
|
||||||
# processing (by publish.py)...
|
# processing (by publish.py)...
|
||||||
|
|
@ -835,7 +843,7 @@ def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_d
|
||||||
|
|
||||||
|
|
||||||
def trybuild(app, thisbuild, build_dir, output_dir, also_check_dir, srclib_dir, extlib_dir,
|
def trybuild(app, thisbuild, build_dir, output_dir, also_check_dir, srclib_dir, extlib_dir,
|
||||||
tmp_dir, repo_dir, vcs, test, server, force, onserver):
|
tmp_dir, repo_dir, vcs, test, server, force, onserver):
|
||||||
"""
|
"""
|
||||||
Build a particular version of an application, if it needs building.
|
Build a particular version of an application, if it needs building.
|
||||||
|
|
||||||
|
|
@ -996,7 +1004,7 @@ def main():
|
||||||
if options.wiki:
|
if options.wiki:
|
||||||
import mwclient
|
import mwclient
|
||||||
site = mwclient.Site((config['wiki_protocol'], config['wiki_server']),
|
site = mwclient.Site((config['wiki_protocol'], config['wiki_server']),
|
||||||
path=config['wiki_path'])
|
path=config['wiki_path'])
|
||||||
site.login(config['wiki_user'], config['wiki_password'])
|
site.login(config['wiki_user'], config['wiki_password'])
|
||||||
|
|
||||||
# Build applications...
|
# Build applications...
|
||||||
|
|
@ -1020,16 +1028,18 @@ def main():
|
||||||
build_dir = os.path.join('build', app['id'])
|
build_dir = os.path.join('build', app['id'])
|
||||||
|
|
||||||
# Set up vcs interface and make sure we have the latest code...
|
# Set up vcs interface and make sure we have the latest code...
|
||||||
logging.debug("Getting {0} vcs interface for {1}".format(
|
logging.debug("Getting {0} vcs interface for {1}"
|
||||||
app['Repo Type'], app['Repo']))
|
.format(app['Repo Type'], app['Repo']))
|
||||||
vcs = common.getvcs(app['Repo Type'], app['Repo'], build_dir)
|
vcs = common.getvcs(app['Repo Type'], app['Repo'], build_dir)
|
||||||
|
|
||||||
first = False
|
first = False
|
||||||
|
|
||||||
logging.debug("Checking " + thisbuild['version'])
|
logging.debug("Checking " + thisbuild['version'])
|
||||||
if trybuild(app, thisbuild, build_dir, output_dir, also_check_dir,
|
if trybuild(app, thisbuild, build_dir, output_dir,
|
||||||
srclib_dir, extlib_dir, tmp_dir, repo_dir, vcs, options.test,
|
also_check_dir, srclib_dir, extlib_dir,
|
||||||
options.server, options.force, options.onserver):
|
tmp_dir, repo_dir, vcs, options.test,
|
||||||
|
options.server, options.force,
|
||||||
|
options.onserver):
|
||||||
build_succeeded.append(app)
|
build_succeeded.append(app)
|
||||||
wikilog = "Build succeeded"
|
wikilog = "Build succeeded"
|
||||||
except BuildException as be:
|
except BuildException as be:
|
||||||
|
|
|
||||||
|
|
@ -138,8 +138,8 @@ def check_tags(app, pattern):
|
||||||
if not package or package != appid or not version or not vercode:
|
if not package or package != appid or not version or not vercode:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
logging.debug("Manifest exists. Found version {0} ({1})".format(
|
logging.debug("Manifest exists. Found version {0} ({1})"
|
||||||
version, vercode))
|
.format(version, vercode))
|
||||||
if int(vercode) > int(hcode):
|
if int(vercode) > int(hcode):
|
||||||
htag = tag
|
htag = tag
|
||||||
hcode = str(int(vercode))
|
hcode = str(int(vercode))
|
||||||
|
|
@ -183,7 +183,7 @@ def check_repomanifest(app, branch=None):
|
||||||
|
|
||||||
if repotype == 'git':
|
if repotype == 'git':
|
||||||
if branch:
|
if branch:
|
||||||
branch = 'origin/'+branch
|
branch = 'origin/' + branch
|
||||||
vcs.gotorevision(branch)
|
vcs.gotorevision(branch)
|
||||||
elif repotype == 'git-svn':
|
elif repotype == 'git-svn':
|
||||||
vcs.gotorevision(branch)
|
vcs.gotorevision(branch)
|
||||||
|
|
@ -340,18 +340,18 @@ def main():
|
||||||
if version is not None:
|
if version is not None:
|
||||||
stored = app['Current Version']
|
stored = app['Current Version']
|
||||||
if not stored:
|
if not stored:
|
||||||
logging.info("{0} has no Current Version but has version {1} on the Play Store".format(
|
logging.info("{0} has no Current Version but has version {1} on the Play Store"
|
||||||
common.getappname(app), version))
|
.format(common.getappname(app), version))
|
||||||
elif LooseVersion(stored) < LooseVersion(version):
|
elif LooseVersion(stored) < LooseVersion(version):
|
||||||
logging.info("{0} has version {1} on the Play Store, which is bigger than {2}".format(
|
logging.info("{0} has version {1} on the Play Store, which is bigger than {2}"
|
||||||
common.getappname(app), version, stored))
|
.format(common.getappname(app), version, stored))
|
||||||
else:
|
else:
|
||||||
if stored != version:
|
if stored != version:
|
||||||
logging.info("{0} has version {1} on the Play Store, which differs from {2}".format(
|
logging.info("{0} has version {1} on the Play Store, which differs from {2}"
|
||||||
common.getappname(app), version, stored))
|
.format(common.getappname(app), version, stored))
|
||||||
else:
|
else:
|
||||||
logging.info("{0} has the same version {1} on the Play Store".format(
|
logging.info("{0} has the same version {1} on the Play Store"
|
||||||
common.getappname(app), version))
|
.format(common.getappname(app), version))
|
||||||
return
|
return
|
||||||
|
|
||||||
for app in apps:
|
for app in apps:
|
||||||
|
|
@ -437,7 +437,7 @@ def main():
|
||||||
flavour = None
|
flavour = None
|
||||||
|
|
||||||
logging.debug("...fetch auto name from " + app_dir +
|
logging.debug("...fetch auto name from " + app_dir +
|
||||||
((" (flavour: %s)" % flavour) if flavour else ""))
|
((" (flavour: %s)" % flavour) if flavour else ""))
|
||||||
new_name = common.fetch_real_name(app_dir, flavour)
|
new_name = common.fetch_real_name(app_dir, flavour)
|
||||||
if new_name:
|
if new_name:
|
||||||
logging.debug("...got autoname '" + new_name + "'")
|
logging.debug("...got autoname '" + new_name + "'")
|
||||||
|
|
@ -507,8 +507,7 @@ def main():
|
||||||
metadata.write_metadata(metafile, app)
|
metadata.write_metadata(metafile, app)
|
||||||
if options.commit:
|
if options.commit:
|
||||||
logging.info("Commiting update for " + metafile)
|
logging.info("Commiting update for " + metafile)
|
||||||
gitcmd = ["git", "commit", "-m",
|
gitcmd = ["git", "commit", "-m", commitmsg]
|
||||||
commitmsg]
|
|
||||||
if 'auto_author' in config:
|
if 'auto_author' in config:
|
||||||
gitcmd.extend(['--author', config['auto_author']])
|
gitcmd.extend(['--author', config['auto_author']])
|
||||||
gitcmd.extend(["--", metafile])
|
gitcmd.extend(["--", metafile])
|
||||||
|
|
|
||||||
|
|
@ -319,7 +319,7 @@ class vcs:
|
||||||
# and remote that directory was created from, allowing us to drop it
|
# and remote that directory was created from, allowing us to drop it
|
||||||
# automatically if either of those things changes.
|
# automatically if either of those things changes.
|
||||||
fdpath = os.path.join(self.local, '..',
|
fdpath = os.path.join(self.local, '..',
|
||||||
'.fdroidvcs-' + os.path.basename(self.local))
|
'.fdroidvcs-' + os.path.basename(self.local))
|
||||||
cdata = self.repotype() + ' ' + self.remote
|
cdata = self.repotype() + ' ' + self.remote
|
||||||
writeback = True
|
writeback = True
|
||||||
deleterepo = False
|
deleterepo = False
|
||||||
|
|
@ -460,10 +460,10 @@ class vcs_git(vcs):
|
||||||
|
|
||||||
def latesttags(self, alltags, number):
|
def latesttags(self, alltags, number):
|
||||||
self.checkrepo()
|
self.checkrepo()
|
||||||
p = SilentPopen(['echo "'+'\n'.join(alltags)+'" | \
|
p = SilentPopen(['echo "' + '\n'.join(alltags) + '" | \
|
||||||
xargs -I@ git log --format=format:"%at @%n" -1 @ | \
|
xargs -I@ git log --format=format:"%at @%n" -1 @ | \
|
||||||
sort -n | awk \'{print $2}\''],
|
sort -n | awk \'{print $2}\''],
|
||||||
cwd=self.local, shell=True)
|
cwd=self.local, shell=True)
|
||||||
return p.stdout.splitlines()[-number:]
|
return p.stdout.splitlines()[-number:]
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -653,7 +653,7 @@ class vcs_hg(vcs):
|
||||||
p = SilentPopen(['hg', 'purge', '--all'], cwd=self.local)
|
p = SilentPopen(['hg', 'purge', '--all'], cwd=self.local)
|
||||||
# Also delete untracked files, we have to enable purge extension for that:
|
# Also delete untracked files, we have to enable purge extension for that:
|
||||||
if "'purge' is provided by the following extension" in p.stdout:
|
if "'purge' is provided by the following extension" in p.stdout:
|
||||||
with open(self.local+"/.hg/hgrc", "a") as myfile:
|
with open(self.local + "/.hg/hgrc", "a") as myfile:
|
||||||
myfile.write("\n[extensions]\nhgext.purge=\n")
|
myfile.write("\n[extensions]\nhgext.purge=\n")
|
||||||
p = SilentPopen(['hg', 'purge', '--all'], cwd=self.local)
|
p = SilentPopen(['hg', 'purge', '--all'], cwd=self.local)
|
||||||
if p.returncode != 0:
|
if p.returncode != 0:
|
||||||
|
|
@ -700,9 +700,9 @@ class vcs_bzr(vcs):
|
||||||
def retrieve_string(app_dir, string, xmlfiles=None):
|
def retrieve_string(app_dir, string, xmlfiles=None):
|
||||||
|
|
||||||
res_dirs = [
|
res_dirs = [
|
||||||
os.path.join(app_dir, 'res'),
|
os.path.join(app_dir, 'res'),
|
||||||
os.path.join(app_dir, 'src/main'),
|
os.path.join(app_dir, 'src/main'),
|
||||||
]
|
]
|
||||||
|
|
||||||
if xmlfiles is None:
|
if xmlfiles is None:
|
||||||
xmlfiles = []
|
xmlfiles = []
|
||||||
|
|
@ -713,9 +713,9 @@ def retrieve_string(app_dir, string, xmlfiles=None):
|
||||||
|
|
||||||
string_search = None
|
string_search = None
|
||||||
if string.startswith('@string/'):
|
if string.startswith('@string/'):
|
||||||
string_search = re.compile(r'.*"'+string[8:]+'".*?>([^<]+?)<.*').search
|
string_search = re.compile(r'.*"' + string[8:] + '".*?>([^<]+?)<.*').search
|
||||||
elif string.startswith('&') and string.endswith(';'):
|
elif string.startswith('&') and string.endswith(';'):
|
||||||
string_search = re.compile(r'.*<!ENTITY.*'+string[1:-1]+'.*?"([^"]+?)".*>').search
|
string_search = re.compile(r'.*<!ENTITY.*' + string[1:-1] + '.*?"([^"]+?)".*>').search
|
||||||
|
|
||||||
if string_search is not None:
|
if string_search is not None:
|
||||||
for xmlfile in xmlfiles:
|
for xmlfile in xmlfiles:
|
||||||
|
|
@ -731,14 +731,15 @@ def retrieve_string(app_dir, string, xmlfiles=None):
|
||||||
# Return list of existing files that will be used to find the highest vercode
|
# Return list of existing files that will be used to find the highest vercode
|
||||||
def manifest_paths(app_dir, flavour):
|
def manifest_paths(app_dir, flavour):
|
||||||
|
|
||||||
possible_manifests = [os.path.join(app_dir, 'AndroidManifest.xml'),
|
possible_manifests = \
|
||||||
os.path.join(app_dir, 'src', 'main', 'AndroidManifest.xml'),
|
[os.path.join(app_dir, 'AndroidManifest.xml'),
|
||||||
os.path.join(app_dir, 'src', 'AndroidManifest.xml'),
|
os.path.join(app_dir, 'src', 'main', 'AndroidManifest.xml'),
|
||||||
os.path.join(app_dir, 'build.gradle')]
|
os.path.join(app_dir, 'src', 'AndroidManifest.xml'),
|
||||||
|
os.path.join(app_dir, 'build.gradle')]
|
||||||
|
|
||||||
if flavour:
|
if flavour:
|
||||||
possible_manifests.append(
|
possible_manifests.append(
|
||||||
os.path.join(app_dir, 'src', flavour, 'AndroidManifest.xml'))
|
os.path.join(app_dir, 'src', flavour, 'AndroidManifest.xml'))
|
||||||
|
|
||||||
return [path for path in possible_manifests if os.path.isfile(path)]
|
return [path for path in possible_manifests if os.path.isfile(path)]
|
||||||
|
|
||||||
|
|
@ -920,7 +921,7 @@ class VCSException(Exception):
|
||||||
# it, which may be a subdirectory of the actual project. If you want the base
|
# it, which may be a subdirectory of the actual project. If you want the base
|
||||||
# directory of the project, pass 'basepath=True'.
|
# directory of the project, pass 'basepath=True'.
|
||||||
def getsrclib(spec, srclib_dir, srclibpaths=[], subdir=None,
|
def getsrclib(spec, srclib_dir, srclibpaths=[], subdir=None,
|
||||||
basepath=False, raw=False, prepare=True, preponly=False):
|
basepath=False, raw=False, prepare=True, preponly=False):
|
||||||
|
|
||||||
number = None
|
number = None
|
||||||
subdir = None
|
subdir = None
|
||||||
|
|
@ -990,7 +991,7 @@ def getsrclib(spec, srclib_dir, srclibpaths=[], subdir=None,
|
||||||
p = FDroidPopen(['bash', '-x', '-c', cmd], cwd=libdir)
|
p = FDroidPopen(['bash', '-x', '-c', cmd], cwd=libdir)
|
||||||
if p.returncode != 0:
|
if p.returncode != 0:
|
||||||
raise BuildException("Error running prepare command for srclib %s"
|
raise BuildException("Error running prepare command for srclib %s"
|
||||||
% name, p.stdout)
|
% name, p.stdout)
|
||||||
|
|
||||||
if basepath:
|
if basepath:
|
||||||
libdir = sdir
|
libdir = sdir
|
||||||
|
|
@ -1042,7 +1043,7 @@ def prepare_source(vcs, app, build, build_dir, srclib_dir, extlib_dir, onserver=
|
||||||
p = FDroidPopen(['bash', '-x', '-c', cmd], cwd=root_dir)
|
p = FDroidPopen(['bash', '-x', '-c', cmd], cwd=root_dir)
|
||||||
if p.returncode != 0:
|
if p.returncode != 0:
|
||||||
raise BuildException("Error running init command for %s:%s" %
|
raise BuildException("Error running init command for %s:%s" %
|
||||||
(app['id'], build['version']), p.stdout)
|
(app['id'], build['version']), p.stdout)
|
||||||
|
|
||||||
# Apply patches if any
|
# Apply patches if any
|
||||||
if 'patch' in build:
|
if 'patch' in build:
|
||||||
|
|
@ -1060,7 +1061,7 @@ def prepare_source(vcs, app, build, build_dir, srclib_dir, extlib_dir, onserver=
|
||||||
logging.info("Collecting source libraries")
|
logging.info("Collecting source libraries")
|
||||||
for lib in build['srclibs']:
|
for lib in build['srclibs']:
|
||||||
srclibpaths.append(getsrclib(lib, srclib_dir, srclibpaths,
|
srclibpaths.append(getsrclib(lib, srclib_dir, srclibpaths,
|
||||||
preponly=onserver))
|
preponly=onserver))
|
||||||
|
|
||||||
for name, number, libpath in srclibpaths:
|
for name, number, libpath in srclibpaths:
|
||||||
place_srclib(root_dir, int(number) if number else None, libpath)
|
place_srclib(root_dir, int(number) if number else None, libpath)
|
||||||
|
|
@ -1086,7 +1087,7 @@ def prepare_source(vcs, app, build, build_dir, srclib_dir, extlib_dir, onserver=
|
||||||
# from sdk.dir, if necessary
|
# from sdk.dir, if necessary
|
||||||
if build['oldsdkloc']:
|
if build['oldsdkloc']:
|
||||||
sdkloc = re.match(r".*^sdk.dir=(\S+)$.*", props,
|
sdkloc = re.match(r".*^sdk.dir=(\S+)$.*", props,
|
||||||
re.S | re.M).group(1)
|
re.S | re.M).group(1)
|
||||||
props += "sdk-location=%s\n" % sdkloc
|
props += "sdk-location=%s\n" % sdkloc
|
||||||
else:
|
else:
|
||||||
props += "sdk.dir=%s\n" % config['sdk_path']
|
props += "sdk.dir=%s\n" % config['sdk_path']
|
||||||
|
|
@ -1111,14 +1112,16 @@ def prepare_source(vcs, app, build, build_dir, srclib_dir, extlib_dir, onserver=
|
||||||
if 'target' in build:
|
if 'target' in build:
|
||||||
n = build["target"].split('-')[1]
|
n = build["target"].split('-')[1]
|
||||||
FDroidPopen(['sed', '-i',
|
FDroidPopen(['sed', '-i',
|
||||||
's@compileSdkVersion *[0-9]*@compileSdkVersion '+n+'@g',
|
's@compileSdkVersion *[0-9]*@compileSdkVersion ' + n + '@g',
|
||||||
'build.gradle'], cwd=root_dir)
|
'build.gradle'],
|
||||||
|
cwd=root_dir)
|
||||||
if '@' in build['gradle']:
|
if '@' in build['gradle']:
|
||||||
gradle_dir = os.path.join(root_dir, build['gradle'].split('@', 1)[1])
|
gradle_dir = os.path.join(root_dir, build['gradle'].split('@', 1)[1])
|
||||||
gradle_dir = os.path.normpath(gradle_dir)
|
gradle_dir = os.path.normpath(gradle_dir)
|
||||||
FDroidPopen(['sed', '-i',
|
FDroidPopen(['sed', '-i',
|
||||||
's@compileSdkVersion *[0-9]*@compileSdkVersion '+n+'@g',
|
's@compileSdkVersion *[0-9]*@compileSdkVersion ' + n + '@g',
|
||||||
'build.gradle'], cwd=gradle_dir)
|
'build.gradle'],
|
||||||
|
cwd=gradle_dir)
|
||||||
|
|
||||||
# Remove forced debuggable flags
|
# Remove forced debuggable flags
|
||||||
remove_debuggable_flags(root_dir)
|
remove_debuggable_flags(root_dir)
|
||||||
|
|
@ -1131,14 +1134,16 @@ def prepare_source(vcs, app, build, build_dir, srclib_dir, extlib_dir, onserver=
|
||||||
continue
|
continue
|
||||||
if has_extension(path, 'xml'):
|
if has_extension(path, 'xml'):
|
||||||
p = SilentPopen(['sed', '-i',
|
p = SilentPopen(['sed', '-i',
|
||||||
's/android:versionName="[^"]*"/android:versionName="' + build['version'] + '"/g',
|
's/android:versionName="[^"]*"/android:versionName="'
|
||||||
path])
|
+ build['version'] + '"/g',
|
||||||
|
path])
|
||||||
if p.returncode != 0:
|
if p.returncode != 0:
|
||||||
raise BuildException("Failed to amend manifest")
|
raise BuildException("Failed to amend manifest")
|
||||||
elif has_extension(path, 'gradle'):
|
elif has_extension(path, 'gradle'):
|
||||||
p = SilentPopen(['sed', '-i',
|
p = SilentPopen(['sed', '-i',
|
||||||
's/versionName *=* *"[^"]*"/versionName = "' + build['version'] + '"/g',
|
's/versionName *=* *"[^"]*"/versionName = "'
|
||||||
path])
|
+ build['version'] + '"/g',
|
||||||
|
path])
|
||||||
if p.returncode != 0:
|
if p.returncode != 0:
|
||||||
raise BuildException("Failed to amend build.gradle")
|
raise BuildException("Failed to amend build.gradle")
|
||||||
if build['forcevercode']:
|
if build['forcevercode']:
|
||||||
|
|
@ -1148,14 +1153,16 @@ def prepare_source(vcs, app, build, build_dir, srclib_dir, extlib_dir, onserver=
|
||||||
continue
|
continue
|
||||||
if has_extension(path, 'xml'):
|
if has_extension(path, 'xml'):
|
||||||
p = SilentPopen(['sed', '-i',
|
p = SilentPopen(['sed', '-i',
|
||||||
's/android:versionCode="[^"]*"/android:versionCode="' + build['vercode'] + '"/g',
|
's/android:versionCode="[^"]*"/android:versionCode="'
|
||||||
path])
|
+ build['vercode'] + '"/g',
|
||||||
|
path])
|
||||||
if p.returncode != 0:
|
if p.returncode != 0:
|
||||||
raise BuildException("Failed to amend manifest")
|
raise BuildException("Failed to amend manifest")
|
||||||
elif has_extension(path, 'gradle'):
|
elif has_extension(path, 'gradle'):
|
||||||
p = SilentPopen(['sed', '-i',
|
p = SilentPopen(['sed', '-i',
|
||||||
's/versionCode *=* *[0-9]*/versionCode = ' + build['vercode'] + '/g',
|
's/versionCode *=* *[0-9]*/versionCode = '
|
||||||
path])
|
+ build['vercode'] + '/g',
|
||||||
|
path])
|
||||||
if p.returncode != 0:
|
if p.returncode != 0:
|
||||||
raise BuildException("Failed to amend build.gradle")
|
raise BuildException("Failed to amend build.gradle")
|
||||||
|
|
||||||
|
|
@ -1203,7 +1210,7 @@ def prepare_source(vcs, app, build, build_dir, srclib_dir, extlib_dir, onserver=
|
||||||
p = FDroidPopen(['bash', '-x', '-c', cmd], cwd=root_dir)
|
p = FDroidPopen(['bash', '-x', '-c', cmd], cwd=root_dir)
|
||||||
if p.returncode != 0:
|
if p.returncode != 0:
|
||||||
raise BuildException("Error running prebuild command for %s:%s" %
|
raise BuildException("Error running prebuild command for %s:%s" %
|
||||||
(app['id'], build['version']), p.stdout)
|
(app['id'], build['version']), p.stdout)
|
||||||
|
|
||||||
updatemode = build.get('update', ['auto'])
|
updatemode = build.get('update', ['auto'])
|
||||||
# Generate (or update) the ant build file, build.xml...
|
# Generate (or update) the ant build file, build.xml...
|
||||||
|
|
@ -1251,7 +1258,7 @@ def getpaths(build_dir, build, field):
|
||||||
p = p.strip()
|
p = p.strip()
|
||||||
full_path = os.path.join(build_dir, p)
|
full_path = os.path.join(build_dir, p)
|
||||||
full_path = os.path.normpath(full_path)
|
full_path = os.path.normpath(full_path)
|
||||||
paths += [r[len(build_dir)+1:] for r in glob.glob(full_path)]
|
paths += [r[len(build_dir) + 1:] for r in glob.glob(full_path)]
|
||||||
return paths
|
return paths
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1263,21 +1270,21 @@ def scan_source(build_dir, root_dir, thisbuild):
|
||||||
|
|
||||||
# Common known non-free blobs (always lower case):
|
# Common known non-free blobs (always lower case):
|
||||||
usual_suspects = [
|
usual_suspects = [
|
||||||
re.compile(r'flurryagent', re.IGNORECASE),
|
re.compile(r'flurryagent', re.IGNORECASE),
|
||||||
re.compile(r'paypal.*mpl', re.IGNORECASE),
|
re.compile(r'paypal.*mpl', re.IGNORECASE),
|
||||||
re.compile(r'libgoogleanalytics', re.IGNORECASE),
|
re.compile(r'libgoogleanalytics', re.IGNORECASE),
|
||||||
re.compile(r'admob.*sdk.*android', re.IGNORECASE),
|
re.compile(r'admob.*sdk.*android', re.IGNORECASE),
|
||||||
re.compile(r'googleadview', re.IGNORECASE),
|
re.compile(r'googleadview', re.IGNORECASE),
|
||||||
re.compile(r'googleadmobadssdk', re.IGNORECASE),
|
re.compile(r'googleadmobadssdk', re.IGNORECASE),
|
||||||
re.compile(r'google.*play.*services', re.IGNORECASE),
|
re.compile(r'google.*play.*services', re.IGNORECASE),
|
||||||
re.compile(r'crittercism', re.IGNORECASE),
|
re.compile(r'crittercism', re.IGNORECASE),
|
||||||
re.compile(r'heyzap', re.IGNORECASE),
|
re.compile(r'heyzap', re.IGNORECASE),
|
||||||
re.compile(r'jpct.*ae', re.IGNORECASE),
|
re.compile(r'jpct.*ae', re.IGNORECASE),
|
||||||
re.compile(r'youtubeandroidplayerapi', re.IGNORECASE),
|
re.compile(r'youtubeandroidplayerapi', re.IGNORECASE),
|
||||||
re.compile(r'bugsense', re.IGNORECASE),
|
re.compile(r'bugsense', re.IGNORECASE),
|
||||||
re.compile(r'crashlytics', re.IGNORECASE),
|
re.compile(r'crashlytics', re.IGNORECASE),
|
||||||
re.compile(r'ouya.*sdk', re.IGNORECASE),
|
re.compile(r'ouya.*sdk', re.IGNORECASE),
|
||||||
]
|
]
|
||||||
|
|
||||||
scanignore = getpaths(build_dir, thisbuild, 'scanignore')
|
scanignore = getpaths(build_dir, thisbuild, 'scanignore')
|
||||||
scandelete = getpaths(build_dir, thisbuild, 'scandelete')
|
scandelete = getpaths(build_dir, thisbuild, 'scandelete')
|
||||||
|
|
@ -1328,7 +1335,7 @@ def scan_source(build_dir, root_dir, thisbuild):
|
||||||
|
|
||||||
# Path (relative) to the file
|
# Path (relative) to the file
|
||||||
fp = os.path.join(r, curfile)
|
fp = os.path.join(r, curfile)
|
||||||
fd = fp[len(build_dir)+1:]
|
fd = fp[len(build_dir) + 1:]
|
||||||
|
|
||||||
# Check if this file has been explicitly excluded from scanning
|
# Check if this file has been explicitly excluded from scanning
|
||||||
if toignore(fd):
|
if toignore(fd):
|
||||||
|
|
@ -1460,9 +1467,9 @@ def isApkDebuggable(apkfile, config):
|
||||||
|
|
||||||
:param apkfile: full path to the apk to check"""
|
:param apkfile: full path to the apk to check"""
|
||||||
|
|
||||||
p = SilentPopen([os.path.join(config['sdk_path'],
|
p = SilentPopen([os.path.join(config['sdk_path'], 'build-tools',
|
||||||
'build-tools', config['build_tools'], 'aapt'),
|
config['build_tools'], 'aapt'),
|
||||||
'dump', 'xmltree', apkfile, 'AndroidManifest.xml'])
|
'dump', 'xmltree', apkfile, 'AndroidManifest.xml'])
|
||||||
if p.returncode != 0:
|
if p.returncode != 0:
|
||||||
logging.critical("Failed to get apk manifest information")
|
logging.critical("Failed to get apk manifest information")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
@ -1522,7 +1529,7 @@ def FDroidPopen(commands, cwd=None, shell=False, output=True):
|
||||||
|
|
||||||
result = PopenResult()
|
result = PopenResult()
|
||||||
p = subprocess.Popen(commands, cwd=cwd, shell=shell,
|
p = subprocess.Popen(commands, cwd=cwd, shell=shell,
|
||||||
stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||||
|
|
||||||
stdout_queue = Queue.Queue()
|
stdout_queue = Queue.Queue()
|
||||||
stdout_reader = AsynchronousFileReader(p.stdout, stdout_queue)
|
stdout_reader = AsynchronousFileReader(p.stdout, stdout_queue)
|
||||||
|
|
@ -1549,11 +1556,11 @@ def remove_signing_keys(build_dir):
|
||||||
comment = re.compile(r'[ ]*//')
|
comment = re.compile(r'[ ]*//')
|
||||||
signing_configs = re.compile(r'^[\t ]*signingConfigs[ \t]*{[ \t]*$')
|
signing_configs = re.compile(r'^[\t ]*signingConfigs[ \t]*{[ \t]*$')
|
||||||
line_matches = [
|
line_matches = [
|
||||||
re.compile(r'^[\t ]*signingConfig [^ ]*$'),
|
re.compile(r'^[\t ]*signingConfig [^ ]*$'),
|
||||||
re.compile(r'.*android\.signingConfigs\..*'),
|
re.compile(r'.*android\.signingConfigs\..*'),
|
||||||
re.compile(r'.*variant\.outputFile = .*'),
|
re.compile(r'.*variant\.outputFile = .*'),
|
||||||
re.compile(r'.*\.readLine\(.*'),
|
re.compile(r'.*\.readLine\(.*'),
|
||||||
]
|
]
|
||||||
for root, dirs, files in os.walk(build_dir):
|
for root, dirs, files in os.walk(build_dir):
|
||||||
if 'build.gradle' in files:
|
if 'build.gradle' in files:
|
||||||
path = os.path.join(root, 'build.gradle')
|
path = os.path.join(root, 'build.gradle')
|
||||||
|
|
|
||||||
|
|
@ -253,7 +253,7 @@ def main():
|
||||||
spec = os.path.join(root_dir, 'buildozer.spec')
|
spec = os.path.join(root_dir, 'buildozer.spec')
|
||||||
if os.path.exists(spec):
|
if os.path.exists(spec):
|
||||||
defaults = {'orientation': 'landscape', 'icon': '',
|
defaults = {'orientation': 'landscape', 'icon': '',
|
||||||
'permissions': '', 'android.api': "18"}
|
'permissions': '', 'android.api': "18"}
|
||||||
bconfig = ConfigParser(defaults, allow_no_value=True)
|
bconfig = ConfigParser(defaults, allow_no_value=True)
|
||||||
bconfig.read(spec)
|
bconfig.read(spec)
|
||||||
package = bconfig.get('app', 'package.domain') + '.' + bconfig.get('app', 'package.name')
|
package = bconfig.get('app', 'package.domain') + '.' + bconfig.get('app', 'package.name')
|
||||||
|
|
|
||||||
|
|
@ -72,13 +72,13 @@ def genkey(keystore, repo_keyalias, password, keydname):
|
||||||
common.write_password_file("keystorepass", password)
|
common.write_password_file("keystorepass", password)
|
||||||
common.write_password_file("keypass", password)
|
common.write_password_file("keypass", password)
|
||||||
p = FDroidPopen(['keytool', '-genkey',
|
p = FDroidPopen(['keytool', '-genkey',
|
||||||
'-keystore', keystore, '-alias', repo_keyalias,
|
'-keystore', keystore, '-alias', repo_keyalias,
|
||||||
'-keyalg', 'RSA', '-keysize', '4096',
|
'-keyalg', 'RSA', '-keysize', '4096',
|
||||||
'-sigalg', 'SHA256withRSA',
|
'-sigalg', 'SHA256withRSA',
|
||||||
'-validity', '10000',
|
'-validity', '10000',
|
||||||
'-storepass:file', config['keystorepassfile'],
|
'-storepass:file', config['keystorepassfile'],
|
||||||
'-keypass:file', config['keypassfile'],
|
'-keypass:file', config['keypassfile'],
|
||||||
'-dname', keydname])
|
'-dname', keydname])
|
||||||
# TODO keypass should be sent via stdin
|
# TODO keypass should be sent via stdin
|
||||||
if p.returncode != 0:
|
if p.returncode != 0:
|
||||||
raise BuildException("Failed to generate key", p.stdout)
|
raise BuildException("Failed to generate key", p.stdout)
|
||||||
|
|
@ -265,8 +265,7 @@ def main():
|
||||||
if repo_keyalias is not None:
|
if repo_keyalias is not None:
|
||||||
logging.info(' Alias for key in store:\t' + repo_keyalias)
|
logging.info(' Alias for key in store:\t' + repo_keyalias)
|
||||||
logging.info('\nTo complete the setup, add your APKs to "' +
|
logging.info('\nTo complete the setup, add your APKs to "' +
|
||||||
os.path.join(fdroiddir, 'repo') + '"' +
|
os.path.join(fdroiddir, 'repo') + '"' + '''
|
||||||
'''
|
|
||||||
then run "fdroid update -c; fdroid update". You might also want to edit
|
then run "fdroid update -c; fdroid update". You might also want to edit
|
||||||
"config.py" to set the URL, repo name, and more. You should also set up
|
"config.py" to set the URL, repo name, and more. You should also set up
|
||||||
a signing key (a temporary one might have been automatically generated).
|
a signing key (a temporary one might have been automatically generated).
|
||||||
|
|
|
||||||
|
|
@ -27,97 +27,96 @@ config = None
|
||||||
options = None
|
options = None
|
||||||
|
|
||||||
regex_warnings = {
|
regex_warnings = {
|
||||||
'Web Site': [
|
'Web Site': [
|
||||||
(re.compile(r'.*[^sS]://github\.com/.*'),
|
(re.compile(r'.*[^sS]://github\.com/.*'),
|
||||||
"github URLs should always use https:// not http://"),
|
"github URLs should always use https:// not http://"),
|
||||||
(re.compile(r'.*[^sS]://code\.google\.com/.*'),
|
(re.compile(r'.*[^sS]://code\.google\.com/.*'),
|
||||||
"code.google.com URLs should always use https:// not http://"),
|
"code.google.com URLs should always use https:// not http://"),
|
||||||
],
|
],
|
||||||
'Source Code': [
|
'Source Code': [
|
||||||
(re.compile(r'.*[^sS]://github\.com/.*'),
|
(re.compile(r'.*[^sS]://github\.com/.*'),
|
||||||
"github URLs should always use https:// (not http://, git://, or git@)"),
|
"github URLs should always use https:// (not http://, git://, or git@)"),
|
||||||
(re.compile(r'.*code\.google\.com/p/[^/]+[/]*$'),
|
(re.compile(r'.*code\.google\.com/p/[^/]+[/]*$'),
|
||||||
"/source is missing"),
|
"/source is missing"),
|
||||||
(re.compile(r'.*[^sS]://code\.google\.com/.*'),
|
(re.compile(r'.*[^sS]://code\.google\.com/.*'),
|
||||||
"code.google.com URLs should always use https:// not http://"),
|
"code.google.com URLs should always use https:// not http://"),
|
||||||
(re.compile(r'.*[^sS]://dl\.google\.com/.*'),
|
(re.compile(r'.*[^sS]://dl\.google\.com/.*'),
|
||||||
"dl.google.com URLs should always use https:// not http://"),
|
"dl.google.com URLs should always use https:// not http://"),
|
||||||
(re.compile(r'.*[^sS]://gitorious\.org/.*'),
|
(re.compile(r'.*[^sS]://gitorious\.org/.*'),
|
||||||
"gitorious URLs should always use https:// (not http://, git://, or git@)"),
|
"gitorious URLs should always use https:// (not http://, git://, or git@)"),
|
||||||
],
|
],
|
||||||
'Repo': [
|
'Repo': [
|
||||||
(re.compile(r'.*[^sS]://code\.google\.com/.*'),
|
(re.compile(r'.*[^sS]://code\.google\.com/.*'),
|
||||||
"code.google.com URLs should always use https:// not http://"),
|
"code.google.com URLs should always use https:// not http://"),
|
||||||
(re.compile(r'.*[^sS]://dl\.google\.com/.*'),
|
(re.compile(r'.*[^sS]://dl\.google\.com/.*'),
|
||||||
"dl.google.com URLs should always use https:// not http://"),
|
"dl.google.com URLs should always use https:// not http://"),
|
||||||
(re.compile(r'.*[^sS]://github\.com/.*'),
|
(re.compile(r'.*[^sS]://github\.com/.*'),
|
||||||
"github URLs should always use https:// (not http://, git://, or git@)"),
|
"github URLs should always use https:// (not http://, git://, or git@)"),
|
||||||
(re.compile(r'.*[^sS]://gitorious\.org/.*'),
|
(re.compile(r'.*[^sS]://gitorious\.org/.*'),
|
||||||
"gitorious URLs should always use https:// (not http://, git://, or git@)"),
|
"gitorious URLs should always use https:// (not http://, git://, or git@)"),
|
||||||
(re.compile(r'.*[^sS]://[^.]*\.googlecode\.com/svn/?.*'),
|
(re.compile(r'.*[^sS]://[^.]*\.googlecode\.com/svn/?.*'),
|
||||||
"Google Code SVN URLs should always use https:// (not http:// or svn://)"),
|
"Google Code SVN URLs should always use https:// (not http:// or svn://)"),
|
||||||
(re.compile(r'.*[^sS]://svn\.apache\.org/repos/?.*'),
|
(re.compile(r'.*[^sS]://svn\.apache\.org/repos/?.*'),
|
||||||
"Apache SVN URLs should always use https:// (not http:// or svn://)"),
|
"Apache SVN URLs should always use https:// (not http:// or svn://)"),
|
||||||
(re.compile(r'.*[^sS]://svn\.code\.sf\.net/.*'),
|
(re.compile(r'.*[^sS]://svn\.code\.sf\.net/.*'),
|
||||||
"Sourceforge SVN URLs should always use https:// (not http:// or svn://)"),
|
"Sourceforge SVN URLs should always use https:// (not http:// or svn://)"),
|
||||||
],
|
],
|
||||||
'Issue Tracker': [
|
'Issue Tracker': [
|
||||||
(re.compile(r'.*code\.google\.com/p/[^/]+[/]*$'),
|
(re.compile(r'.*code\.google\.com/p/[^/]+[/]*$'),
|
||||||
"/issues is missing"),
|
"/issues is missing"),
|
||||||
(re.compile(r'.*[^sS]://code\.google\.com/.*'),
|
(re.compile(r'.*[^sS]://code\.google\.com/.*'),
|
||||||
"code.google.com URLs should always use https:// not http://"),
|
"code.google.com URLs should always use https:// not http://"),
|
||||||
(re.compile(r'.*github\.com/[^/]+/[^/]+[/]*$'),
|
(re.compile(r'.*github\.com/[^/]+/[^/]+[/]*$'),
|
||||||
"/issues is missing"),
|
"/issues is missing"),
|
||||||
(re.compile(r'.*[^sS]://github\.com/.*'),
|
(re.compile(r'.*[^sS]://github\.com/.*'),
|
||||||
"github URLs should always use https:// not http://"),
|
"github URLs should always use https:// not http://"),
|
||||||
(re.compile(r'.*[^sS]://gitorious\.org/.*'),
|
(re.compile(r'.*[^sS]://gitorious\.org/.*'),
|
||||||
"gitorious URLs should always use https:// not http://"),
|
"gitorious URLs should always use https:// not http://"),
|
||||||
],
|
],
|
||||||
'Description': [
|
'Description': [
|
||||||
(re.compile(r'[ ]*[*#][^ .]'),
|
(re.compile(r'[ ]*[*#][^ .]'),
|
||||||
"Invalid bulleted list"),
|
"Invalid bulleted list"),
|
||||||
(re.compile(r'^ '),
|
(re.compile(r'^ '),
|
||||||
"Unnecessary leading space"),
|
"Unnecessary leading space"),
|
||||||
],
|
],
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
regex_pedantic = {
|
regex_pedantic = {
|
||||||
'Web Site': [
|
'Web Site': [
|
||||||
(re.compile(r'.*github\.com/[^/]+/[^/]+\.git'),
|
(re.compile(r'.*github\.com/[^/]+/[^/]+\.git'),
|
||||||
"Appending .git is not necessary"),
|
"Appending .git is not necessary"),
|
||||||
(re.compile(r'.*code\.google\.com/p/[^/]+/[^w]'),
|
(re.compile(r'.*code\.google\.com/p/[^/]+/[^w]'),
|
||||||
"Possible incorrect path appended to google code project site"),
|
"Possible incorrect path appended to google code project site"),
|
||||||
],
|
],
|
||||||
'Source Code': [
|
'Source Code': [
|
||||||
(re.compile(r'.*github\.com/[^/]+/[^/]+\.git'),
|
(re.compile(r'.*github\.com/[^/]+/[^/]+\.git'),
|
||||||
"Appending .git is not necessary"),
|
"Appending .git is not necessary"),
|
||||||
(re.compile(r'.*code\.google\.com/p/[^/]+/source/.*'),
|
(re.compile(r'.*code\.google\.com/p/[^/]+/source/.*'),
|
||||||
"/source is often enough on its own"),
|
"/source is often enough on its own"),
|
||||||
],
|
],
|
||||||
'Repo': [
|
'Repo': [
|
||||||
(re.compile(r'^http://.*'),
|
(re.compile(r'^http://.*'),
|
||||||
"if https:// is available, use it instead of http://"),
|
"if https:// is available, use it instead of http://"),
|
||||||
(re.compile(r'^svn://.*'),
|
(re.compile(r'^svn://.*'),
|
||||||
"if https:// is available, use it instead of svn://"),
|
"if https:// is available, use it instead of svn://"),
|
||||||
],
|
],
|
||||||
'Issue Tracker': [
|
'Issue Tracker': [
|
||||||
(re.compile(r'.*code\.google\.com/p/[^/]+/issues/.*'),
|
(re.compile(r'.*code\.google\.com/p/[^/]+/issues/.*'),
|
||||||
"/issues is often enough on its own"),
|
"/issues is often enough on its own"),
|
||||||
(re.compile(r'.*github\.com/[^/]+/[^/]+/issues/.*'),
|
(re.compile(r'.*github\.com/[^/]+/[^/]+/issues/.*'),
|
||||||
"/issues is often enough on its own"),
|
"/issues is often enough on its own"),
|
||||||
],
|
],
|
||||||
'Summary': [
|
'Summary': [
|
||||||
(re.compile(r'.*\bandroid\b.*', re.IGNORECASE),
|
(re.compile(r'.*\bandroid\b.*', re.IGNORECASE),
|
||||||
"No need to specify that the app is for Android"),
|
"No need to specify that the app is for Android"),
|
||||||
(re.compile(r'.*\b(app|application)\b.*', re.IGNORECASE),
|
(re.compile(r'.*\b(app|application)\b.*', re.IGNORECASE),
|
||||||
"No need to specify that the app is... an app"),
|
"No need to specify that the app is... an app"),
|
||||||
(re.compile(r'.*\b(free software|open source)\b.*', re.IGNORECASE),
|
(re.compile(r'.*\b(free software|open source)\b.*', re.IGNORECASE),
|
||||||
"No need to specify that the app is Free Software"),
|
"No need to specify that the app is Free Software"),
|
||||||
(re.compile(r'.*[a-z0-9][.,!?][ $]'),
|
(re.compile(r'.*[a-z0-9][.,!?][ $]'),
|
||||||
"Punctuation should be avoided"),
|
"Punctuation should be avoided"),
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
@ -194,7 +193,6 @@ def main():
|
||||||
pwarn("Summary '%s' probably contains redundant info already in app name '%s'" % (
|
pwarn("Summary '%s' probably contains redundant info already in app name '%s'" % (
|
||||||
summary, name))
|
summary, name))
|
||||||
|
|
||||||
|
|
||||||
# Description size limit
|
# Description size limit
|
||||||
desc_chars = sum(len(l) for l in app['Description'])
|
desc_chars = sum(len(l) for l in app['Description'])
|
||||||
if desc_chars > config['char_limits']['Description']:
|
if desc_chars > config['char_limits']['Description']:
|
||||||
|
|
@ -213,7 +211,6 @@ def main():
|
||||||
if m.match(l):
|
if m.match(l):
|
||||||
warn("%s at line '%s': %s" % (f, l, r))
|
warn("%s at line '%s': %s" % (f, l, r))
|
||||||
|
|
||||||
|
|
||||||
# Regex pedantic checks in all kinds of fields
|
# Regex pedantic checks in all kinds of fields
|
||||||
if options.pedantic:
|
if options.pedantic:
|
||||||
for f in regex_pedantic:
|
for f in regex_pedantic:
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ app_defaults = {
|
||||||
'Repo': '',
|
'Repo': '',
|
||||||
'Requires Root': False,
|
'Requires Root': False,
|
||||||
'No Source Since': ''
|
'No Source Since': ''
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# This defines the preferred order for the build items - as in the
|
# This defines the preferred order for the build items - as in the
|
||||||
|
|
@ -73,7 +73,7 @@ ordered_flags = [
|
||||||
'extlibs', 'srclibs', 'patch', 'prebuild', 'scanignore',
|
'extlibs', 'srclibs', 'patch', 'prebuild', 'scanignore',
|
||||||
'scandelete', 'build', 'buildjni', 'preassemble', 'bindir',
|
'scandelete', 'build', 'buildjni', 'preassemble', 'bindir',
|
||||||
'antcommand', 'novcheck'
|
'antcommand', 'novcheck'
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
# Designates a metadata field type and checks that it matches
|
# Designates a metadata field type and checks that it matches
|
||||||
|
|
@ -98,15 +98,15 @@ class FieldType():
|
||||||
for v in values:
|
for v in values:
|
||||||
if not self.compiled.match(v):
|
if not self.compiled.match(v):
|
||||||
raise MetaDataException("'%s' is not a valid %s in %s. "
|
raise MetaDataException("'%s' is not a valid %s in %s. "
|
||||||
% (v, self.name, appid) +
|
% (v, self.name, appid) +
|
||||||
"Regex pattern: %s" % (self.matching))
|
"Regex pattern: %s" % (self.matching))
|
||||||
|
|
||||||
def _assert_list(self, values, appid):
|
def _assert_list(self, values, appid):
|
||||||
for v in values:
|
for v in values:
|
||||||
if v not in self.matching:
|
if v not in self.matching:
|
||||||
raise MetaDataException("'%s' is not a valid %s in %s. "
|
raise MetaDataException("'%s' is not a valid %s in %s. "
|
||||||
% (v, self.name, appid) +
|
% (v, self.name, appid) +
|
||||||
"Possible values: %s" % (", ".join(self.matching)))
|
"Possible values: %s" % (", ".join(self.matching)))
|
||||||
|
|
||||||
def check(self, value, appid):
|
def check(self, value, appid):
|
||||||
if type(value) is not str or not value:
|
if type(value) is not str or not value:
|
||||||
|
|
@ -124,65 +124,65 @@ class FieldType():
|
||||||
# Generic value types
|
# Generic value types
|
||||||
valuetypes = {
|
valuetypes = {
|
||||||
'int': FieldType("Integer",
|
'int': FieldType("Integer",
|
||||||
r'^[1-9][0-9]*$', None,
|
r'^[1-9][0-9]*$', None,
|
||||||
['FlattrID'],
|
['FlattrID'],
|
||||||
['vercode']),
|
['vercode']),
|
||||||
|
|
||||||
'http': FieldType("HTTP link",
|
'http': FieldType("HTTP link",
|
||||||
r'^http[s]?://', None,
|
r'^http[s]?://', None,
|
||||||
["Web Site", "Source Code", "Issue Tracker", "Donate"], []),
|
["Web Site", "Source Code", "Issue Tracker", "Donate"], []),
|
||||||
|
|
||||||
'bitcoin': FieldType("Bitcoin address",
|
'bitcoin': FieldType("Bitcoin address",
|
||||||
r'^[a-zA-Z0-9]{27,34}$', None,
|
r'^[a-zA-Z0-9]{27,34}$', None,
|
||||||
["Bitcoin"],
|
["Bitcoin"],
|
||||||
[]),
|
[]),
|
||||||
|
|
||||||
'litecoin': FieldType("Litecoin address",
|
'litecoin': FieldType("Litecoin address",
|
||||||
r'^L[a-zA-Z0-9]{33}$', None,
|
r'^L[a-zA-Z0-9]{33}$', None,
|
||||||
["Litecoin"],
|
["Litecoin"],
|
||||||
[]),
|
[]),
|
||||||
|
|
||||||
'dogecoin': FieldType("Dogecoin address",
|
'dogecoin': FieldType("Dogecoin address",
|
||||||
r'^D[a-zA-Z0-9]{33}$', None,
|
r'^D[a-zA-Z0-9]{33}$', None,
|
||||||
["Dogecoin"],
|
["Dogecoin"],
|
||||||
[]),
|
[]),
|
||||||
|
|
||||||
'Bool': FieldType("Boolean",
|
'Bool': FieldType("Boolean",
|
||||||
['Yes', 'No'], None,
|
['Yes', 'No'], None,
|
||||||
["Requires Root"],
|
["Requires Root"],
|
||||||
[]),
|
[]),
|
||||||
|
|
||||||
'bool': FieldType("Boolean",
|
'bool': FieldType("Boolean",
|
||||||
['yes', 'no'], None,
|
['yes', 'no'], None,
|
||||||
[],
|
[],
|
||||||
['submodules', 'oldsdkloc', 'forceversion', 'forcevercode',
|
['submodules', 'oldsdkloc', 'forceversion', 'forcevercode',
|
||||||
'novcheck']),
|
'novcheck']),
|
||||||
|
|
||||||
'Repo Type': FieldType("Repo Type",
|
'Repo Type': FieldType("Repo Type",
|
||||||
['git', 'git-svn', 'svn', 'hg', 'bzr', 'srclib'], None,
|
['git', 'git-svn', 'svn', 'hg', 'bzr', 'srclib'], None,
|
||||||
["Repo Type"],
|
["Repo Type"],
|
||||||
[]),
|
[]),
|
||||||
|
|
||||||
'archive': FieldType("Archive Policy",
|
'archive': FieldType("Archive Policy",
|
||||||
r'^[0-9]+ versions$', None,
|
r'^[0-9]+ versions$', None,
|
||||||
["Archive Policy"],
|
["Archive Policy"],
|
||||||
[]),
|
[]),
|
||||||
|
|
||||||
'antifeatures': FieldType("Anti-Feature",
|
'antifeatures': FieldType("Anti-Feature",
|
||||||
["Ads", "Tracking", "NonFreeNet", "NonFreeDep", "NonFreeAdd", "UpstreamNonFree"], ',',
|
["Ads", "Tracking", "NonFreeNet", "NonFreeDep", "NonFreeAdd", "UpstreamNonFree"], ',',
|
||||||
["AntiFeatures"],
|
["AntiFeatures"],
|
||||||
[]),
|
[]),
|
||||||
|
|
||||||
'autoupdatemodes': FieldType("Auto Update Mode",
|
'autoupdatemodes': FieldType("Auto Update Mode",
|
||||||
r"^(Version .+|None)$", None,
|
r"^(Version .+|None)$", None,
|
||||||
["Auto Update Mode"],
|
["Auto Update Mode"],
|
||||||
[]),
|
[]),
|
||||||
|
|
||||||
'updatecheckmodes': FieldType("Update Check Mode",
|
'updatecheckmodes': FieldType("Update Check Mode",
|
||||||
r"^(Tags|Tags .+|RepoManifest|RepoManifest/.+|RepoTrunk|HTTP|Static|None)$", None,
|
r"^(Tags|Tags .+|RepoManifest|RepoManifest/.+|RepoTrunk|HTTP|Static|None)$", None,
|
||||||
["Update Check Mode"],
|
["Update Check Mode"],
|
||||||
[])
|
[])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Check an app's metadata information for integrity errors
|
# Check an app's metadata information for integrity errors
|
||||||
|
|
@ -293,7 +293,7 @@ class DescriptionFormatter:
|
||||||
urltext = url
|
urltext = url
|
||||||
linkified_html += '<a href="' + url + '">' + cgi.escape(urltext) + '</a>'
|
linkified_html += '<a href="' + url + '">' + cgi.escape(urltext) + '</a>'
|
||||||
linkified_plain += urltext
|
linkified_plain += urltext
|
||||||
txt = txt[index+2:]
|
txt = txt[index + 2:]
|
||||||
else:
|
else:
|
||||||
index = txt.find("]")
|
index = txt.find("]")
|
||||||
if index == -1:
|
if index == -1:
|
||||||
|
|
@ -309,7 +309,7 @@ class DescriptionFormatter:
|
||||||
linkified_plain += urltxt
|
linkified_plain += urltxt
|
||||||
if urltxt != url:
|
if urltxt != url:
|
||||||
linkified_plain += ' (' + url + ')'
|
linkified_plain += ' (' + url + ')'
|
||||||
txt = txt[index+1:]
|
txt = txt[index + 1:]
|
||||||
|
|
||||||
def addtext(self, txt):
|
def addtext(self, txt):
|
||||||
p, h = self.linkify(txt)
|
p, h = self.linkify(txt)
|
||||||
|
|
@ -447,7 +447,7 @@ def read_metadata(xref=True, package=None, store=True):
|
||||||
description_html(app['Description'], linkres)
|
description_html(app['Description'], linkres)
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
raise MetaDataException("Problem with description of " + app['id'] +
|
raise MetaDataException("Problem with description of " + app['id'] +
|
||||||
" - " + str(e))
|
" - " + str(e))
|
||||||
|
|
||||||
return apps
|
return apps
|
||||||
|
|
||||||
|
|
@ -471,7 +471,7 @@ def metafieldtype(name):
|
||||||
|
|
||||||
def flagtype(name):
|
def flagtype(name):
|
||||||
if name in ['extlibs', 'srclibs', 'patch', 'rm', 'buildjni',
|
if name in ['extlibs', 'srclibs', 'patch', 'rm', 'buildjni',
|
||||||
'update', 'scanignore', 'scandelete']:
|
'update', 'scanignore', 'scandelete']:
|
||||||
return 'list'
|
return 'list'
|
||||||
if name in ['init', 'prebuild', 'build']:
|
if name in ['init', 'prebuild', 'build']:
|
||||||
return 'script'
|
return 'script'
|
||||||
|
|
@ -510,17 +510,17 @@ def parse_metadata(metafile):
|
||||||
def add_buildflag(p, thisbuild):
|
def add_buildflag(p, thisbuild):
|
||||||
bv = p.split('=', 1)
|
bv = p.split('=', 1)
|
||||||
if len(bv) != 2:
|
if len(bv) != 2:
|
||||||
raise MetaDataException("Invalid build flag at {0} in {1}".
|
raise MetaDataException("Invalid build flag at {0} in {1}"
|
||||||
format(buildlines[0], linedesc))
|
.format(buildlines[0], linedesc))
|
||||||
pk, pv = bv
|
pk, pv = bv
|
||||||
if pk in thisbuild:
|
if pk in thisbuild:
|
||||||
raise MetaDataException("Duplicate definition on {0} in version {1} of {2}".
|
raise MetaDataException("Duplicate definition on {0} in version {1} of {2}"
|
||||||
format(pk, thisbuild['version'], linedesc))
|
.format(pk, thisbuild['version'], linedesc))
|
||||||
|
|
||||||
pk = pk.lstrip()
|
pk = pk.lstrip()
|
||||||
if pk not in ordered_flags:
|
if pk not in ordered_flags:
|
||||||
raise MetaDataException("Unrecognised build flag at {0} in {1}".
|
raise MetaDataException("Unrecognised build flag at {0} in {1}"
|
||||||
format(p, linedesc))
|
.format(p, linedesc))
|
||||||
t = flagtype(pk)
|
t = flagtype(pk)
|
||||||
if t == 'list':
|
if t == 'list':
|
||||||
# Port legacy ';' separators
|
# Port legacy ';' separators
|
||||||
|
|
@ -530,8 +530,8 @@ def parse_metadata(metafile):
|
||||||
elif t == 'script':
|
elif t == 'script':
|
||||||
thisbuild[pk] = pv
|
thisbuild[pk] = pv
|
||||||
else:
|
else:
|
||||||
raise MetaDataException("Unrecognised build flag type '%s' at %s in %s" % (
|
raise MetaDataException("Unrecognised build flag type '%s' at %s in %s"
|
||||||
t, p, linedesc))
|
% (t, p, linedesc))
|
||||||
|
|
||||||
def parse_buildline(lines):
|
def parse_buildline(lines):
|
||||||
value = "".join(lines)
|
value = "".join(lines)
|
||||||
|
|
@ -550,7 +550,7 @@ def parse_metadata(metafile):
|
||||||
commit = 'unknown - see disabled'
|
commit = 'unknown - see disabled'
|
||||||
index = parts[2].rfind('at ')
|
index = parts[2].rfind('at ')
|
||||||
if index != -1:
|
if index != -1:
|
||||||
commit = parts[2][index+3:]
|
commit = parts[2][index + 3:]
|
||||||
if commit.endswith(')'):
|
if commit.endswith(')'):
|
||||||
commit = commit[:-1]
|
commit = commit[:-1]
|
||||||
thisbuild['commit'] = commit
|
thisbuild['commit'] = commit
|
||||||
|
|
@ -606,8 +606,8 @@ def parse_metadata(metafile):
|
||||||
if mode == 3:
|
if mode == 3:
|
||||||
if not any(line.startswith(s) for s in (' ', '\t')):
|
if not any(line.startswith(s) for s in (' ', '\t')):
|
||||||
if 'commit' not in curbuild and 'disable' not in curbuild:
|
if 'commit' not in curbuild and 'disable' not in curbuild:
|
||||||
raise MetaDataException("No commit specified for {0} in {1}".format(
|
raise MetaDataException("No commit specified for {0} in {1}"
|
||||||
curbuild['version'], linedesc))
|
.format(curbuild['version'], linedesc))
|
||||||
thisinfo['builds'].append(curbuild)
|
thisinfo['builds'].append(curbuild)
|
||||||
add_comments('build:' + curbuild['version'])
|
add_comments('build:' + curbuild['version'])
|
||||||
mode = 0
|
mode = 0
|
||||||
|
|
@ -629,9 +629,9 @@ def parse_metadata(metafile):
|
||||||
try:
|
try:
|
||||||
field, value = line.split(':', 1)
|
field, value = line.split(':', 1)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
raise MetaDataException("Invalid metadata in "+linedesc)
|
raise MetaDataException("Invalid metadata in " + linedesc)
|
||||||
if field != field.strip() or value != value.strip():
|
if field != field.strip() or value != value.strip():
|
||||||
raise MetaDataException("Extra spacing found in "+linedesc)
|
raise MetaDataException("Extra spacing found in " + linedesc)
|
||||||
|
|
||||||
# Translate obsolete fields...
|
# Translate obsolete fields...
|
||||||
if field == 'Market Version':
|
if field == 'Market Version':
|
||||||
|
|
@ -662,8 +662,8 @@ def parse_metadata(metafile):
|
||||||
curbuild = {}
|
curbuild = {}
|
||||||
vv = value.split(',')
|
vv = value.split(',')
|
||||||
if len(vv) != 2:
|
if len(vv) != 2:
|
||||||
raise MetaDataException('Build should have comma-separated version and vercode, not "{0}", in {1}'.
|
raise MetaDataException('Build should have comma-separated version and vercode, not "{0}", in {1}'
|
||||||
format(value, linedesc))
|
.format(value, linedesc))
|
||||||
curbuild['version'] = vv[0]
|
curbuild['version'] = vv[0]
|
||||||
curbuild['vercode'] = vv[1]
|
curbuild['vercode'] = vv[1]
|
||||||
buildlines = []
|
buildlines = []
|
||||||
|
|
|
||||||
|
|
@ -128,35 +128,36 @@ def main():
|
||||||
# See if we already have a key for this application, and
|
# See if we already have a key for this application, and
|
||||||
# if not generate one...
|
# if not generate one...
|
||||||
p = FDroidPopen(['keytool', '-list',
|
p = FDroidPopen(['keytool', '-list',
|
||||||
'-alias', keyalias, '-keystore', config['keystore'],
|
'-alias', keyalias, '-keystore', config['keystore'],
|
||||||
'-storepass:file', config['keystorepassfile']])
|
'-storepass:file', config['keystorepassfile']])
|
||||||
if p.returncode != 0:
|
if p.returncode != 0:
|
||||||
logging.info("Key does not exist - generating...")
|
logging.info("Key does not exist - generating...")
|
||||||
p = FDroidPopen(['keytool', '-genkey',
|
p = FDroidPopen(['keytool', '-genkey',
|
||||||
'-keystore', config['keystore'], '-alias', keyalias,
|
'-keystore', config['keystore'],
|
||||||
'-keyalg', 'RSA', '-keysize', '2048',
|
'-alias', keyalias,
|
||||||
'-validity', '10000',
|
'-keyalg', 'RSA', '-keysize', '2048',
|
||||||
'-storepass:file', config['keystorepassfile'],
|
'-validity', '10000',
|
||||||
'-keypass:file', config['keypassfile'],
|
'-storepass:file', config['keystorepassfile'],
|
||||||
'-dname', config['keydname']])
|
'-keypass:file', config['keypassfile'],
|
||||||
|
'-dname', config['keydname']])
|
||||||
# TODO keypass should be sent via stdin
|
# TODO keypass should be sent via stdin
|
||||||
if p.returncode != 0:
|
if p.returncode != 0:
|
||||||
raise BuildException("Failed to generate key")
|
raise BuildException("Failed to generate key")
|
||||||
|
|
||||||
# Sign the application...
|
# Sign the application...
|
||||||
p = FDroidPopen(['jarsigner', '-keystore', config['keystore'],
|
p = FDroidPopen(['jarsigner', '-keystore', config['keystore'],
|
||||||
'-storepass:file', config['keystorepassfile'],
|
'-storepass:file', config['keystorepassfile'],
|
||||||
'-keypass:file', config['keypassfile'], '-sigalg',
|
'-keypass:file', config['keypassfile'], '-sigalg',
|
||||||
'MD5withRSA', '-digestalg', 'SHA1',
|
'MD5withRSA', '-digestalg', 'SHA1',
|
||||||
apkfile, keyalias])
|
apkfile, keyalias])
|
||||||
# TODO keypass should be sent via stdin
|
# TODO keypass should be sent via stdin
|
||||||
if p.returncode != 0:
|
if p.returncode != 0:
|
||||||
raise BuildException("Failed to sign application")
|
raise BuildException("Failed to sign application")
|
||||||
|
|
||||||
# Zipalign it...
|
# Zipalign it...
|
||||||
p = FDroidPopen([os.path.join(config['sdk_path'], 'tools', 'zipalign'),
|
p = FDroidPopen([os.path.join(config['sdk_path'], 'tools', 'zipalign'),
|
||||||
'-v', '4', apkfile,
|
'-v', '4', apkfile,
|
||||||
os.path.join(output_dir, apkfilename)])
|
os.path.join(output_dir, apkfilename)])
|
||||||
if p.returncode != 0:
|
if p.returncode != 0:
|
||||||
raise BuildException("Failed to align application")
|
raise BuildException("Failed to align application")
|
||||||
os.remove(apkfile)
|
os.remove(apkfile)
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ def main():
|
||||||
|
|
||||||
for app in apps:
|
for app in apps:
|
||||||
logging.info("Writing " + app['id'])
|
logging.info("Writing " + app['id'])
|
||||||
metadata.write_metadata(os.path.join('metadata', app['id'])+'.txt', app)
|
metadata.write_metadata(os.path.join('metadata', app['id']) + '.txt', app)
|
||||||
|
|
||||||
logging.info("Finished.")
|
logging.info("Finished.")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -90,13 +90,14 @@ def main():
|
||||||
|
|
||||||
# Prepare the source code...
|
# Prepare the source code...
|
||||||
root_dir, _ = common.prepare_source(vcs, app, thisbuild,
|
root_dir, _ = common.prepare_source(vcs, app, thisbuild,
|
||||||
build_dir, srclib_dir, extlib_dir, False)
|
build_dir, srclib_dir,
|
||||||
|
extlib_dir, False)
|
||||||
|
|
||||||
# Do the scan...
|
# Do the scan...
|
||||||
buildprobs = common.scan_source(build_dir, root_dir, thisbuild)
|
buildprobs = common.scan_source(build_dir, root_dir, thisbuild)
|
||||||
for problem in buildprobs:
|
for problem in buildprobs:
|
||||||
problems.append(problem +
|
problems.append(problem + ' in ' + app['id']
|
||||||
' in ' + app['id'] + ' ' + thisbuild['version'])
|
+ ' ' + thisbuild['version'])
|
||||||
|
|
||||||
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)
|
||||||
|
|
|
||||||
|
|
@ -127,8 +127,8 @@ def main():
|
||||||
appscount = Counter()
|
appscount = Counter()
|
||||||
appsvercount = Counter()
|
appsvercount = Counter()
|
||||||
logexpr = '(?P<ip>[.:0-9a-fA-F]+) - - \[(?P<time>.*?)\] ' + \
|
logexpr = '(?P<ip>[.:0-9a-fA-F]+) - - \[(?P<time>.*?)\] ' + \
|
||||||
'"GET (?P<uri>.*?) HTTP/1.\d" (?P<statuscode>\d+) ' + \
|
'"GET (?P<uri>.*?) HTTP/1.\d" (?P<statuscode>\d+) ' + \
|
||||||
'\d+ "(?P<referral>.*?)" "(?P<useragent>.*?)"'
|
'\d+ "(?P<referral>.*?)" "(?P<useragent>.*?)"'
|
||||||
logsearch = re.compile(logexpr).search
|
logsearch = re.compile(logexpr).search
|
||||||
for logfile in glob.glob(os.path.join(logsdir, 'access-*.log.gz')):
|
for logfile in glob.glob(os.path.join(logsdir, 'access-*.log.gz')):
|
||||||
logging.debug('...' + logfile)
|
logging.debug('...' + logfile)
|
||||||
|
|
|
||||||
|
|
@ -73,7 +73,7 @@ def update_wiki(apps, apks):
|
||||||
wikiredircat = 'App Redirects'
|
wikiredircat = 'App Redirects'
|
||||||
import mwclient
|
import mwclient
|
||||||
site = mwclient.Site((config['wiki_protocol'], config['wiki_server']),
|
site = mwclient.Site((config['wiki_protocol'], config['wiki_server']),
|
||||||
path=config['wiki_path'])
|
path=config['wiki_path'])
|
||||||
site.login(config['wiki_user'], config['wiki_password'])
|
site.login(config['wiki_user'], config['wiki_password'])
|
||||||
generated_pages = {}
|
generated_pages = {}
|
||||||
generated_redirects = {}
|
generated_redirects = {}
|
||||||
|
|
@ -85,20 +85,20 @@ def update_wiki(apps, apks):
|
||||||
for af in app['AntiFeatures'].split(','):
|
for af in app['AntiFeatures'].split(','):
|
||||||
wikidata += '{{AntiFeature|' + af + '}}\n'
|
wikidata += '{{AntiFeature|' + af + '}}\n'
|
||||||
wikidata += '{{App|id=%s|name=%s|added=%s|lastupdated=%s|source=%s|tracker=%s|web=%s|donate=%s|flattr=%s|bitcoin=%s|litecoin=%s|dogecoin=%s|license=%s|root=%s}}\n' % (
|
wikidata += '{{App|id=%s|name=%s|added=%s|lastupdated=%s|source=%s|tracker=%s|web=%s|donate=%s|flattr=%s|bitcoin=%s|litecoin=%s|dogecoin=%s|license=%s|root=%s}}\n' % (
|
||||||
app['id'],
|
app['id'],
|
||||||
app['Name'],
|
app['Name'],
|
||||||
time.strftime('%Y-%m-%d', app['added']) if 'added' in app else '',
|
time.strftime('%Y-%m-%d', app['added']) if 'added' in app else '',
|
||||||
time.strftime('%Y-%m-%d', app['lastupdated']) if 'lastupdated' in app else '',
|
time.strftime('%Y-%m-%d', app['lastupdated']) if 'lastupdated' in app else '',
|
||||||
app['Source Code'],
|
app['Source Code'],
|
||||||
app['Issue Tracker'],
|
app['Issue Tracker'],
|
||||||
app['Web Site'],
|
app['Web Site'],
|
||||||
app['Donate'],
|
app['Donate'],
|
||||||
app['FlattrID'],
|
app['FlattrID'],
|
||||||
app['Bitcoin'],
|
app['Bitcoin'],
|
||||||
app['Litecoin'],
|
app['Litecoin'],
|
||||||
app['Dogecoin'],
|
app['Dogecoin'],
|
||||||
app['License'],
|
app['License'],
|
||||||
app.get('Requires Root', 'No'))
|
app.get('Requires Root', 'No'))
|
||||||
|
|
||||||
if app['Provides']:
|
if app['Provides']:
|
||||||
wikidata += "This app provides: %s" % ', '.join(app['Summary'].split(','))
|
wikidata += "This app provides: %s" % ', '.join(app['Summary'].split(','))
|
||||||
|
|
@ -129,12 +129,11 @@ def update_wiki(apps, apks):
|
||||||
if 'disable' in thisbuild:
|
if 'disable' in thisbuild:
|
||||||
if thisbuild['vercode'] == app['Current Version Code']:
|
if thisbuild['vercode'] == app['Current Version Code']:
|
||||||
cantupdate = True
|
cantupdate = True
|
||||||
apklist.append({
|
#TODO: Nasty: vercode is a string in the build, and an int elsewhere
|
||||||
#TODO: Nasty: vercode is a string in the build, and an int elsewhere
|
apklist.append({'versioncode': int(thisbuild['vercode']),
|
||||||
'versioncode': int(thisbuild['vercode']),
|
'version': thisbuild['version'],
|
||||||
'version': thisbuild['version'],
|
'buildproblem': thisbuild['disable']
|
||||||
'buildproblem': thisbuild['disable']
|
})
|
||||||
})
|
|
||||||
else:
|
else:
|
||||||
builtit = False
|
builtit = False
|
||||||
for apk in apklist:
|
for apk in apklist:
|
||||||
|
|
@ -143,11 +142,10 @@ def update_wiki(apps, apks):
|
||||||
break
|
break
|
||||||
if not builtit:
|
if not builtit:
|
||||||
buildfails = True
|
buildfails = True
|
||||||
apklist.append({
|
apklist.append({'versioncode': int(thisbuild['vercode']),
|
||||||
'versioncode': int(thisbuild['vercode']),
|
'version': thisbuild['version'],
|
||||||
'version': thisbuild['version'],
|
'buildproblem': "The build for this version appears to have failed. Check the [[{0}/lastbuild|build log]].".format(app['id'])
|
||||||
'buildproblem': "The build for this version appears to have failed. Check the [[{0}/lastbuild|build log]].".format(app['id'])
|
})
|
||||||
})
|
|
||||||
if app['Current Version Code'] == '0':
|
if app['Current Version Code'] == '0':
|
||||||
cantupdate = True
|
cantupdate = True
|
||||||
# Sort with most recent first...
|
# Sort with most recent first...
|
||||||
|
|
@ -221,7 +219,8 @@ def update_wiki(apps, apks):
|
||||||
# Drop double spaces caused mostly by replacing ':' above
|
# Drop double spaces caused mostly by replacing ':' above
|
||||||
apppagename = apppagename.replace(' ', ' ')
|
apppagename = apppagename.replace(' ', ' ')
|
||||||
for expagename in site.allpages(prefix=apppagename,
|
for expagename in site.allpages(prefix=apppagename,
|
||||||
filterredir='nonredirects', generator=False):
|
filterredir='nonredirects',
|
||||||
|
generator=False):
|
||||||
if expagename == apppagename:
|
if expagename == apppagename:
|
||||||
noclobber = True
|
noclobber = True
|
||||||
# Another reason not to make the redirect page is if the app name
|
# Another reason not to make the redirect page is if the app name
|
||||||
|
|
@ -235,7 +234,7 @@ def update_wiki(apps, apks):
|
||||||
generated_redirects[apppagename] = "#REDIRECT [[" + pagename + "]]\n[[Category:" + wikiredircat + "]]"
|
generated_redirects[apppagename] = "#REDIRECT [[" + pagename + "]]\n[[Category:" + wikiredircat + "]]"
|
||||||
|
|
||||||
for tcat, genp in [(wikicat, generated_pages),
|
for tcat, genp in [(wikicat, generated_pages),
|
||||||
(wikiredircat, generated_redirects)]:
|
(wikiredircat, generated_redirects)]:
|
||||||
catpages = site.Pages['Category:' + tcat]
|
catpages = site.Pages['Category:' + tcat]
|
||||||
existingpages = []
|
existingpages = []
|
||||||
for page in catpages:
|
for page in catpages:
|
||||||
|
|
@ -379,9 +378,9 @@ def scan_apks(apps, apkcache, repodir, knownapks):
|
||||||
thisinfo['features'] = []
|
thisinfo['features'] = []
|
||||||
thisinfo['icons_src'] = {}
|
thisinfo['icons_src'] = {}
|
||||||
thisinfo['icons'] = {}
|
thisinfo['icons'] = {}
|
||||||
p = FDroidPopen([os.path.join(config['sdk_path'],
|
p = FDroidPopen([os.path.join(config['sdk_path'], 'build-tools',
|
||||||
'build-tools', config['build_tools'], 'aapt'),
|
config['build_tools'], 'aapt'),
|
||||||
'dump', 'badging', apkfile])
|
'dump', 'badging', apkfile])
|
||||||
if p.returncode != 0:
|
if p.returncode != 0:
|
||||||
logging.critical("Failed to get apk information")
|
logging.critical("Failed to get apk information")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
@ -430,8 +429,8 @@ def scan_apks(apps, apkcache, repodir, knownapks):
|
||||||
perm = re.match(string_pat, line).group(1)
|
perm = re.match(string_pat, line).group(1)
|
||||||
#Filter out this, it's only added with the latest SDK tools and
|
#Filter out this, it's only added with the latest SDK tools and
|
||||||
#causes problems for lots of apps.
|
#causes problems for lots of apps.
|
||||||
if (perm != "android.hardware.screen.portrait" and
|
if perm != "android.hardware.screen.portrait" \
|
||||||
perm != "android.hardware.screen.landscape"):
|
and perm != "android.hardware.screen.landscape":
|
||||||
if perm.startswith("android.feature."):
|
if perm.startswith("android.feature."):
|
||||||
perm = perm[16:]
|
perm = perm[16:]
|
||||||
thisinfo['features'].append(perm)
|
thisinfo['features'].append(perm)
|
||||||
|
|
@ -460,7 +459,7 @@ def scan_apks(apps, apkcache, repodir, knownapks):
|
||||||
logging.critical("getsig.class not found. To fix: cd '%s' && ./make.sh" % getsig_dir)
|
logging.critical("getsig.class not found. To fix: cd '%s' && ./make.sh" % getsig_dir)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
p = FDroidPopen(['java', '-cp', os.path.join(os.path.dirname(__file__), 'getsig'),
|
p = FDroidPopen(['java', '-cp', os.path.join(os.path.dirname(__file__), 'getsig'),
|
||||||
'getsig', os.path.join(os.getcwd(), apkfile)])
|
'getsig', os.path.join(os.getcwd(), apkfile)])
|
||||||
if p.returncode != 0 or not p.stdout.startswith('Result:'):
|
if p.returncode != 0 or not p.stdout.startswith('Result:'):
|
||||||
logging.critical("Failed to get apk signature")
|
logging.critical("Failed to get apk signature")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
@ -469,8 +468,8 @@ def scan_apks(apps, apkcache, repodir, knownapks):
|
||||||
apk = zipfile.ZipFile(apkfile, 'r')
|
apk = zipfile.ZipFile(apkfile, 'r')
|
||||||
|
|
||||||
iconfilename = "%s.%s.png" % (
|
iconfilename = "%s.%s.png" % (
|
||||||
thisinfo['id'],
|
thisinfo['id'],
|
||||||
thisinfo['versioncode'])
|
thisinfo['versioncode'])
|
||||||
|
|
||||||
# Extract the icon file...
|
# Extract the icon file...
|
||||||
densities = get_densities()
|
densities = get_densities()
|
||||||
|
|
@ -498,7 +497,7 @@ def scan_apks(apps, apkcache, repodir, knownapks):
|
||||||
if '-1' in thisinfo['icons_src']:
|
if '-1' in thisinfo['icons_src']:
|
||||||
iconsrc = thisinfo['icons_src']['-1']
|
iconsrc = thisinfo['icons_src']['-1']
|
||||||
iconpath = os.path.join(
|
iconpath = os.path.join(
|
||||||
get_icon_dir(repodir, None), iconfilename)
|
get_icon_dir(repodir, None), iconfilename)
|
||||||
iconfile = open(iconpath, 'wb')
|
iconfile = open(iconpath, 'wb')
|
||||||
iconfile.write(apk.read(iconsrc))
|
iconfile.write(apk.read(iconsrc))
|
||||||
iconfile.close()
|
iconfile.close()
|
||||||
|
|
@ -511,7 +510,7 @@ def scan_apks(apps, apkcache, repodir, knownapks):
|
||||||
if density == densities[-1] or dpi >= int(density):
|
if density == densities[-1] or dpi >= int(density):
|
||||||
thisinfo['icons'][density] = iconfilename
|
thisinfo['icons'][density] = iconfilename
|
||||||
shutil.move(iconpath,
|
shutil.move(iconpath,
|
||||||
os.path.join(get_icon_dir(repodir, density), iconfilename))
|
os.path.join(get_icon_dir(repodir, density), iconfilename))
|
||||||
empty_densities.remove(density)
|
empty_densities.remove(density)
|
||||||
break
|
break
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
|
|
@ -530,13 +529,13 @@ def scan_apks(apps, apkcache, repodir, knownapks):
|
||||||
continue
|
continue
|
||||||
if last_density is None:
|
if last_density is None:
|
||||||
continue
|
continue
|
||||||
logging.info("Density %s not available, resizing down from %s" % (
|
logging.info("Density %s not available, resizing down from %s"
|
||||||
density, last_density))
|
% (density, last_density))
|
||||||
|
|
||||||
last_iconpath = os.path.join(
|
last_iconpath = os.path.join(
|
||||||
get_icon_dir(repodir, last_density), iconfilename)
|
get_icon_dir(repodir, last_density), iconfilename)
|
||||||
iconpath = os.path.join(
|
iconpath = os.path.join(
|
||||||
get_icon_dir(repodir, density), iconfilename)
|
get_icon_dir(repodir, density), iconfilename)
|
||||||
try:
|
try:
|
||||||
im = Image.open(last_iconpath)
|
im = Image.open(last_iconpath)
|
||||||
except:
|
except:
|
||||||
|
|
@ -557,12 +556,12 @@ def scan_apks(apps, apkcache, repodir, knownapks):
|
||||||
continue
|
continue
|
||||||
if last_density is None:
|
if last_density is None:
|
||||||
continue
|
continue
|
||||||
logging.info("Density %s not available, copying from lower density %s" % (
|
logging.info("Density %s not available, copying from lower density %s"
|
||||||
density, last_density))
|
% (density, last_density))
|
||||||
|
|
||||||
shutil.copyfile(
|
shutil.copyfile(
|
||||||
os.path.join(get_icon_dir(repodir, last_density), iconfilename),
|
os.path.join(get_icon_dir(repodir, last_density), iconfilename),
|
||||||
os.path.join(get_icon_dir(repodir, density), iconfilename))
|
os.path.join(get_icon_dir(repodir, density), iconfilename))
|
||||||
|
|
||||||
empty_densities.remove(density)
|
empty_densities.remove(density)
|
||||||
|
|
||||||
|
|
@ -575,7 +574,7 @@ def scan_apks(apps, apkcache, repodir, knownapks):
|
||||||
baseline = os.path.join(get_icon_dir(repodir, '160'), iconfilename)
|
baseline = os.path.join(get_icon_dir(repodir, '160'), iconfilename)
|
||||||
if os.path.isfile(baseline):
|
if os.path.isfile(baseline):
|
||||||
shutil.copyfile(baseline,
|
shutil.copyfile(baseline,
|
||||||
os.path.join(get_icon_dir(repodir, None), iconfilename))
|
os.path.join(get_icon_dir(repodir, None), iconfilename))
|
||||||
|
|
||||||
# Record in known apks, getting the added date at the same time..
|
# Record in known apks, getting the added date at the same time..
|
||||||
added = knownapks.recordapk(thisinfo['apkname'], thisinfo['id'])
|
added = knownapks.recordapk(thisinfo['apkname'], thisinfo['id'])
|
||||||
|
|
@ -652,9 +651,9 @@ def make_index(apps, apks, repodir, archive, categories):
|
||||||
|
|
||||||
def extract_pubkey():
|
def extract_pubkey():
|
||||||
p = FDroidPopen(['keytool', '-exportcert',
|
p = FDroidPopen(['keytool', '-exportcert',
|
||||||
'-alias', config['repo_keyalias'],
|
'-alias', config['repo_keyalias'],
|
||||||
'-keystore', config['keystore'],
|
'-keystore', config['keystore'],
|
||||||
'-storepass:file', config['keystorepassfile']]
|
'-storepass:file', config['keystorepassfile']]
|
||||||
+ config['smartcardoptions'])
|
+ config['smartcardoptions'])
|
||||||
if p.returncode != 0:
|
if p.returncode != 0:
|
||||||
msg = "Failed to get repo pubkey!"
|
msg = "Failed to get repo pubkey!"
|
||||||
|
|
@ -704,7 +703,8 @@ def make_index(apps, apks, repodir, archive, categories):
|
||||||
return ("fdroid.app:" + link, app['Name'])
|
return ("fdroid.app:" + link, app['Name'])
|
||||||
raise MetaDataException("Cannot resolve app id " + link)
|
raise MetaDataException("Cannot resolve app id " + link)
|
||||||
addElement('desc',
|
addElement('desc',
|
||||||
metadata.description_html(app['Description'], linkres), doc, apel)
|
metadata.description_html(app['Description'], linkres),
|
||||||
|
doc, apel)
|
||||||
addElement('license', app['License'], doc, apel)
|
addElement('license', app['License'], doc, apel)
|
||||||
if 'Categories' in app:
|
if 'Categories' in app:
|
||||||
addElement('categories', ','.join(app["Categories"]), doc, apel)
|
addElement('categories', ','.join(app["Categories"]), doc, apel)
|
||||||
|
|
@ -754,9 +754,9 @@ def make_index(apps, apks, repodir, archive, categories):
|
||||||
|
|
||||||
# Check for duplicates - they will make the client unhappy...
|
# Check for duplicates - they will make the client unhappy...
|
||||||
for i in range(len(apklist) - 1):
|
for i in range(len(apklist) - 1):
|
||||||
if apklist[i]['versioncode'] == apklist[i+1]['versioncode']:
|
if apklist[i]['versioncode'] == apklist[i + 1]['versioncode']:
|
||||||
logging.critical("duplicate versions: '%s' - '%s'" % (
|
logging.critical("duplicate versions: '%s' - '%s'" % (
|
||||||
apklist[i]['apkname'], apklist[i+1]['apkname']))
|
apklist[i]['apkname'], apklist[i + 1]['apkname']))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
for apk in apklist:
|
for apk in apklist:
|
||||||
|
|
@ -862,10 +862,10 @@ def archive_old_apks(apps, apks, archapks, repodir, archivedir, defaultkeepversi
|
||||||
for apk in apklist[keepversions:]:
|
for apk in apklist[keepversions:]:
|
||||||
logging.info("Moving " + apk['apkname'] + " to archive")
|
logging.info("Moving " + apk['apkname'] + " to archive")
|
||||||
shutil.move(os.path.join(repodir, apk['apkname']),
|
shutil.move(os.path.join(repodir, apk['apkname']),
|
||||||
os.path.join(archivedir, apk['apkname']))
|
os.path.join(archivedir, apk['apkname']))
|
||||||
if 'srcname' in apk:
|
if 'srcname' in apk:
|
||||||
shutil.move(os.path.join(repodir, apk['srcname']),
|
shutil.move(os.path.join(repodir, apk['srcname']),
|
||||||
os.path.join(archivedir, apk['srcname']))
|
os.path.join(archivedir, apk['srcname']))
|
||||||
archapks.append(apk)
|
archapks.append(apk)
|
||||||
apks.remove(apk)
|
apks.remove(apk)
|
||||||
|
|
||||||
|
|
@ -894,7 +894,7 @@ def main():
|
||||||
help="Resize all the icons exceeding the max pixel size and exit")
|
help="Resize all the icons exceeding the max pixel size and exit")
|
||||||
parser.add_option("-e", "--editor", default="/etc/alternatives/editor",
|
parser.add_option("-e", "--editor", default="/etc/alternatives/editor",
|
||||||
help="Specify editor to use in interactive mode. Default " +
|
help="Specify editor to use in interactive mode. Default " +
|
||||||
"is /etc/alternatives/editor")
|
"is /etc/alternatives/editor")
|
||||||
parser.add_option("-w", "--wiki", default=False, action="store_true",
|
parser.add_option("-w", "--wiki", default=False, action="store_true",
|
||||||
help="Update the wiki")
|
help="Update the wiki")
|
||||||
parser.add_option("", "--pretty", action="store_true", default=False,
|
parser.add_option("", "--pretty", action="store_true", default=False,
|
||||||
|
|
|
||||||
|
|
@ -92,11 +92,12 @@ def main():
|
||||||
os.mkdir(d)
|
os.mkdir(d)
|
||||||
|
|
||||||
if subprocess.call(['jar', 'xf',
|
if subprocess.call(['jar', 'xf',
|
||||||
os.path.join("..", "..", unsigned_dir, apkfilename)],
|
os.path.join("..", "..", unsigned_dir, apkfilename)],
|
||||||
cwd=thisdir) != 0:
|
cwd=thisdir) != 0:
|
||||||
raise Exception("Failed to unpack local build of " + apkfilename)
|
raise Exception("Failed to unpack local build of " + apkfilename)
|
||||||
if subprocess.call(['jar', 'xf', os.path.join("..", "..", remoteapk)],
|
if subprocess.call(['jar', 'xf',
|
||||||
cwd=thatdir) != 0:
|
os.path.join("..", "..", remoteapk)],
|
||||||
|
cwd=thatdir) != 0:
|
||||||
raise Exception("Failed to unpack remote build of " + apkfilename)
|
raise Exception("Failed to unpack remote build of " + apkfilename)
|
||||||
|
|
||||||
p = FDroidPopen(['diff', '-r', 'this_apk', 'that_apk'], cwd=tmp_dir)
|
p = FDroidPopen(['diff', '-r', 'this_apk', 'that_apk'], cwd=tmp_dir)
|
||||||
|
|
|
||||||
2
setup.py
2
setup.py
|
|
@ -20,7 +20,7 @@ setup(name='fdroidserver',
|
||||||
scripts=['fdroid', 'fd-commit'],
|
scripts=['fdroid', 'fd-commit'],
|
||||||
data_files=[
|
data_files=[
|
||||||
(sys.prefix + '/share/doc/fdroidserver/examples',
|
(sys.prefix + '/share/doc/fdroidserver/examples',
|
||||||
[ 'buildserver/config.buildserver.py',
|
['buildserver/config.buildserver.py',
|
||||||
'examples/config.py',
|
'examples/config.py',
|
||||||
'examples/makebs.config.py',
|
'examples/makebs.config.py',
|
||||||
'examples/opensc-fdroid.cfg',
|
'examples/opensc-fdroid.cfg',
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue