mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-11-09 08:50:28 +03:00
support configing buildserver VM per-build with sudo=
This adds the 'sudo' build field, which is just a script that is run as root. For more info, see the issue that this closes: refs #318 closes #317
This commit is contained in:
parent
747ac52a62
commit
dfb07808d3
9 changed files with 138 additions and 14 deletions
|
|
@ -393,10 +393,23 @@ def build_local(app, build, vcs, build_dir, output_dir, log_dir, srclib_dir, ext
|
|||
|
||||
# create ..._toolsversion.log when running in builder vm
|
||||
if onserver:
|
||||
# before doing anything, run the sudo commands to setup the VM
|
||||
if build.sudo:
|
||||
logging.info("Running 'sudo' commands in %s" % os.getcwd())
|
||||
|
||||
p = FDroidPopen(['sudo', 'bash', '-x', '-c', build.sudo])
|
||||
if p.returncode != 0:
|
||||
raise BuildException("Error running sudo command for %s:%s" %
|
||||
(app.id, build.versionName), p.output)
|
||||
|
||||
log_path = os.path.join(log_dir,
|
||||
common.get_toolsversion_logname(app, build))
|
||||
with open(log_path, 'w') as f:
|
||||
f.write(get_android_tools_version_log(build.ndk_path()))
|
||||
else:
|
||||
if build.sudo:
|
||||
logging.warning('%s:%s runs this on the buildserver with sudo:\n\t%s'
|
||||
% (app.id, build.versionName, build.sudo))
|
||||
|
||||
# Prepare the source code...
|
||||
root_dir, srclibpaths = common.prepare_source(vcs, app, build,
|
||||
|
|
|
|||
|
|
@ -1317,21 +1317,21 @@ def getsrclib(spec, srclib_dir, subdir=None, basepath=False,
|
|||
gradle_version_regex = re.compile(r"[^/]*'com\.android\.tools\.build:gradle:([^\.]+\.[^\.]+).*'.*")
|
||||
|
||||
|
||||
# Prepare the source code for a particular build
|
||||
# 'vcs' - the appropriate vcs object for the application
|
||||
# 'app' - the application details from the metadata
|
||||
# 'build' - the build details from the metadata
|
||||
# 'build_dir' - the path to the build directory, usually
|
||||
# 'build/app.id'
|
||||
# 'srclib_dir' - the path to the source libraries directory, usually
|
||||
# 'build/srclib'
|
||||
# 'extlib_dir' - the path to the external libraries directory, usually
|
||||
# 'build/extlib'
|
||||
# Returns the (root, srclibpaths) where:
|
||||
# 'root' is the root directory, which may be the same as 'build_dir' or may
|
||||
# be a subdirectory of it.
|
||||
# 'srclibpaths' is information on the srclibs being used
|
||||
def prepare_source(vcs, app, build, build_dir, srclib_dir, extlib_dir, onserver=False, refresh=True):
|
||||
""" Prepare the source code for a particular build
|
||||
|
||||
:param vcs: the appropriate vcs object for the application
|
||||
:param app: the application details from the metadata
|
||||
:param build: the build details from the metadata
|
||||
:param build_dir: the path to the build directory, usually 'build/app.id'
|
||||
:param srclib_dir: the path to the source libraries directory, usually 'build/srclib'
|
||||
:param extlib_dir: the path to the external libraries directory, usually 'build/extlib'
|
||||
|
||||
Returns the (root, srclibpaths) where:
|
||||
:param root: is the root directory, which may be the same as 'build_dir' or may
|
||||
be a subdirectory of it.
|
||||
:param srclibpaths: is information on the srclibs being used
|
||||
"""
|
||||
|
||||
# Optionally, the actual app source can be in a subdirectory
|
||||
if build.subdir:
|
||||
|
|
|
|||
|
|
@ -204,6 +204,7 @@ build_flags_order = [
|
|||
'commit',
|
||||
'subdir',
|
||||
'submodules',
|
||||
'sudo',
|
||||
'init',
|
||||
'patch',
|
||||
'gradle',
|
||||
|
|
@ -246,6 +247,7 @@ class Build(dict):
|
|||
self.commit = None
|
||||
self.subdir = None
|
||||
self.submodules = False
|
||||
self.sudo = ''
|
||||
self.init = ''
|
||||
self.patch = []
|
||||
self.gradle = []
|
||||
|
|
@ -333,6 +335,7 @@ flagtypes = {
|
|||
'gradle': TYPE_LIST,
|
||||
'antcommands': TYPE_LIST,
|
||||
'gradleprops': TYPE_LIST,
|
||||
'sudo': TYPE_SCRIPT,
|
||||
'init': TYPE_SCRIPT,
|
||||
'prebuild': TYPE_SCRIPT,
|
||||
'build': TYPE_SCRIPT,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue