mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-11-09 00:40:11 +01:00
Resolved some unpleasant global-scope usage and related issues
This commit is contained in:
parent
ee268c64ec
commit
e920a3ca58
33
build.py
33
build.py
@ -118,7 +118,7 @@ def build_server(app, thisbuild, build_dir, output_dir):
|
||||
raise BuildException("Failed to destroy")
|
||||
|
||||
|
||||
def build_local(app, thisbuild, build_dir, output_dir):
|
||||
def build_local(app, thisbuild, vcs, build_dir, output_dir, extlib_dir, tmp_dir, install):
|
||||
"""Do a build locally."""
|
||||
|
||||
# Prepare the source code...
|
||||
@ -156,8 +156,6 @@ def build_local(app, thisbuild, build_dir, output_dir):
|
||||
if p.returncode != 0:
|
||||
print output
|
||||
raise BuildException("NDK build failed for %s:%s" % (app['id'], thisbuild['version']))
|
||||
elif options.verbose:
|
||||
print output
|
||||
|
||||
# Build the release...
|
||||
if thisbuild.has_key('maven'):
|
||||
@ -165,7 +163,7 @@ def build_local(app, thisbuild, build_dir, output_dir):
|
||||
'-Dandroid.sdk.path=' + sdk_path],
|
||||
cwd=root_dir, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
else:
|
||||
if options.install:
|
||||
if install:
|
||||
antcommands = ['debug',' install']
|
||||
elif thisbuild.has_key('antcommand'):
|
||||
antcommands = [thisbuild['antcommand']]
|
||||
@ -176,8 +174,6 @@ def build_local(app, thisbuild, build_dir, output_dir):
|
||||
output, error = p.communicate()
|
||||
if p.returncode != 0:
|
||||
raise BuildException("Build failed for %s:%s" % (app['id'], thisbuild['version']), output.strip(), error.strip())
|
||||
elif options.verbose:
|
||||
print output
|
||||
print "Build successful"
|
||||
|
||||
# Find the apk name in the output...
|
||||
@ -241,6 +237,8 @@ def build_local(app, thisbuild, build_dir, output_dir):
|
||||
|
||||
# Copy the unsigned apk to our destination directory for further
|
||||
# processing (by publish.py)...
|
||||
dest = os.path.join(output_dir, app['id'] + '_' +
|
||||
thisbuild['vercode'] + '.apk')
|
||||
shutil.copyfile(src, dest)
|
||||
|
||||
# Move the source tarball into the output directory...
|
||||
@ -250,7 +248,8 @@ def build_local(app, thisbuild, build_dir, output_dir):
|
||||
os.path.join(output_dir, tarfilename))
|
||||
|
||||
|
||||
def trybuild(app, thisbuild, build_dir, output_dir, repo_dir, vcs, test):
|
||||
def trybuild(app, thisbuild, build_dir, output_dir, extlib_dir, tmp_dir,
|
||||
repo_dir, vcs, test, server, install):
|
||||
"""
|
||||
Build a particular version of an application, if it needs building.
|
||||
|
||||
@ -268,16 +267,12 @@ def trybuild(app, thisbuild, build_dir, output_dir, repo_dir, vcs, test):
|
||||
if thisbuild['commit'].startswith('!'):
|
||||
return False
|
||||
|
||||
if options.verbose:
|
||||
mstart = '.. building version '
|
||||
else:
|
||||
mstart = 'Building version '
|
||||
print mstart + thisbuild['version'] + ' of ' + app['id']
|
||||
print "Building version " + thisbuild['version'] + ' of ' + app['id']
|
||||
|
||||
if options.server:
|
||||
if server:
|
||||
build_server(app, thisbuild, build_dir, output_dir)
|
||||
else:
|
||||
build_local(app, thisbuild, build_dir, output_dir)
|
||||
build_local(app, thisbuild, vcs, build_dir, output_dir, extlib_dir, tmp_dir, install)
|
||||
return True
|
||||
|
||||
|
||||
@ -313,6 +308,9 @@ def parse_commandline():
|
||||
|
||||
# The --install option implies --test and --force...
|
||||
if options.install:
|
||||
if options.server:
|
||||
print "Can't install when building on a build server."
|
||||
sys.exit(1)
|
||||
options.force = True
|
||||
options.test = True
|
||||
|
||||
@ -322,7 +320,7 @@ def parse_commandline():
|
||||
def main():
|
||||
|
||||
# Read configuration...
|
||||
execfile('config.py')
|
||||
execfile('config.py', globals())
|
||||
options, args = parse_commandline()
|
||||
|
||||
# Get all apps...
|
||||
@ -382,8 +380,9 @@ def main():
|
||||
|
||||
for thisbuild in app['builds']:
|
||||
try:
|
||||
if trybuild(app, thisbuild, build_dir, output_dir, repo_dir,
|
||||
vcs, options.test):
|
||||
if trybuild(app, thisbuild, build_dir, output_dir, extlib_dir,
|
||||
tmp_dir, repo_dir, vcs, options.test, options.server,
|
||||
options.install):
|
||||
build_succeeded.append(app)
|
||||
except BuildException as be:
|
||||
if options.stop:
|
||||
|
@ -46,6 +46,7 @@ def check_market(app):
|
||||
|
||||
m = re.search('<dd itemprop="softwareVersion">([^>]+)</dd>', page)
|
||||
if m:
|
||||
html_parser = HTMLParser.HTMLParser()
|
||||
version = html_parser.unescape(m.group(1))
|
||||
|
||||
if version == 'Varies with device':
|
||||
@ -66,7 +67,7 @@ def check_market(app):
|
||||
def main():
|
||||
|
||||
#Read configuration...
|
||||
execfile('config.py')
|
||||
execfile('config.py', globals())
|
||||
|
||||
# Parse command line...
|
||||
parser = OptionParser()
|
||||
@ -79,8 +80,6 @@ def main():
|
||||
# Get all apps...
|
||||
apps = common.read_metadata(options.verbose)
|
||||
|
||||
html_parser = HTMLParser.HTMLParser()
|
||||
|
||||
for app in apps:
|
||||
|
||||
if options.package and options.package != app['id']:
|
||||
|
@ -28,11 +28,7 @@ from optparse import OptionParser
|
||||
def main():
|
||||
|
||||
# Read configuration...
|
||||
repo_name = None
|
||||
repo_description = None
|
||||
repo_icon = None
|
||||
repo_url = None
|
||||
execfile('config.py')
|
||||
execfile('config.py', globals())
|
||||
|
||||
import common
|
||||
|
||||
|
@ -34,7 +34,7 @@ from common import BuildException
|
||||
def main():
|
||||
|
||||
#Read configuration...
|
||||
execfile('config.py')
|
||||
execfile('config.py', globals())
|
||||
|
||||
# Parse command line...
|
||||
parser = OptionParser()
|
||||
|
@ -34,7 +34,7 @@ from common import VCSException
|
||||
def main():
|
||||
|
||||
# Read configuration...
|
||||
execfile('config.py')
|
||||
execfile('config.py', globals())
|
||||
|
||||
|
||||
# Parse command line...
|
||||
|
4
stats.py
4
stats.py
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# updatestats.py - part of the FDroid server tools
|
||||
# stats.py - part of the FDroid server tools
|
||||
# Copyright (C) 2010-12, Ciaran Gultnieks, ciaran@ciarang.com
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
@ -33,7 +33,7 @@ import common
|
||||
def main():
|
||||
|
||||
# Read configuration...
|
||||
execfile('config.py')
|
||||
execfile('config.py', globals())
|
||||
|
||||
# Parse command line...
|
||||
parser = OptionParser()
|
||||
|
13
update.py
13
update.py
@ -32,11 +32,7 @@ import time
|
||||
def main():
|
||||
|
||||
# Read configuration...
|
||||
repo_name = None
|
||||
repo_description = None
|
||||
repo_icon = None
|
||||
repo_url = None
|
||||
execfile('config.py')
|
||||
execfile('config.py', globals())
|
||||
|
||||
import common
|
||||
|
||||
@ -69,13 +65,6 @@ def main():
|
||||
|
||||
warnings = 0
|
||||
|
||||
# Make sure we have the repository description...
|
||||
if (repo_url is None or repo_name is None or
|
||||
repo_icon is None or repo_description is None):
|
||||
print "Repository description fields are required in config.py"
|
||||
print "See config.sample.py for details"
|
||||
sys.exit(1)
|
||||
|
||||
# Get all apps...
|
||||
apps = common.read_metadata(verbose=options.verbose)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user