mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-09-15 15:32:30 +03:00
Transfer srclibs properly
This commit is contained in:
parent
6c64632f48
commit
cfa2646b8f
2 changed files with 32 additions and 25 deletions
|
@ -220,7 +220,9 @@ def build_server(app, thisbuild, vcs, build_dir, output_dir, sdk_path, force):
|
||||||
if 'srclibs' in thisbuild:
|
if 'srclibs' in thisbuild:
|
||||||
for lib in thisbuild['srclibs'].split(';'):
|
for lib in thisbuild['srclibs'].split(';'):
|
||||||
name, _ = lib.split('@')
|
name, _ = lib.split('@')
|
||||||
srclibpaths.append((name, common.getsrclib(lib, 'build/srclib', sdk_path, basepath=True)))
|
if options.verbose:
|
||||||
|
print "Processing srclib '" + name + "'"
|
||||||
|
srclibpaths.append((name, common.getsrclib(lib, 'build/srclib', sdk_path, basepath=True, prepare=False)))
|
||||||
# If one was used for the main source, add that too.
|
# If one was used for the main source, add that too.
|
||||||
basesrclib = vcs.getsrclib()
|
basesrclib = vcs.getsrclib()
|
||||||
if basesrclib:
|
if basesrclib:
|
||||||
|
@ -283,13 +285,13 @@ def build_server(app, thisbuild, vcs, build_dir, output_dir, sdk_path, force):
|
||||||
subprocess.call(['vagrant', 'suspend'], cwd='builder')
|
subprocess.call(['vagrant', 'suspend'], cwd='builder')
|
||||||
|
|
||||||
|
|
||||||
def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_dir, tmp_dir, install, force, verbose=False):
|
def build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_dir, tmp_dir, install, force, verbose, onserver):
|
||||||
"""Do a build locally."""
|
"""Do a build locally."""
|
||||||
|
|
||||||
# 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, sdk_path, ndk_path,
|
build_dir, srclib_dir, extlib_dir, sdk_path, ndk_path,
|
||||||
javacc_path, mvn3, verbose)
|
javacc_path, mvn3, verbose, onserver)
|
||||||
|
|
||||||
# Scan before building...
|
# Scan before building...
|
||||||
buildprobs = common.scan_source(build_dir, root_dir, thisbuild)
|
buildprobs = common.scan_source(build_dir, root_dir, thisbuild)
|
||||||
|
@ -488,7 +490,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, install, force, verbose=False):
|
tmp_dir, repo_dir, vcs, test, server, install, force, verbose, onserver):
|
||||||
"""
|
"""
|
||||||
Build a particular version of an application, if it needs building.
|
Build a particular version of an application, if it needs building.
|
||||||
|
|
||||||
|
@ -521,7 +523,7 @@ def trybuild(app, thisbuild, build_dir, output_dir, also_check_dir, srclib_dir,
|
||||||
|
|
||||||
build_server(app, thisbuild, vcs, build_dir, output_dir, sdk_path, force)
|
build_server(app, thisbuild, vcs, build_dir, output_dir, sdk_path, force)
|
||||||
else:
|
else:
|
||||||
build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_dir, tmp_dir, install, force, verbose)
|
build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_dir, tmp_dir, install, force, verbose, onserver)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
@ -688,7 +690,7 @@ def main():
|
||||||
if trybuild(app, thisbuild, build_dir, output_dir, also_check_dir,
|
if trybuild(app, thisbuild, build_dir, output_dir, also_check_dir,
|
||||||
srclib_dir, extlib_dir, tmp_dir, repo_dir, vcs, options.test,
|
srclib_dir, extlib_dir, tmp_dir, repo_dir, vcs, options.test,
|
||||||
options.server, options.install, options.force,
|
options.server, options.install, options.force,
|
||||||
options.verbose):
|
options.verbose, options.onserver):
|
||||||
build_succeeded.append(app)
|
build_succeeded.append(app)
|
||||||
wikilog = "Build succeeded"
|
wikilog = "Build succeeded"
|
||||||
except BuildException as be:
|
except BuildException as be:
|
||||||
|
|
|
@ -981,7 +981,7 @@ def parse_srclib(metafile, **kw):
|
||||||
# Returns the path to it. Normally this is the path to be used when referencing
|
# Returns the path to it. Normally this is the path to be used when referencing
|
||||||
# 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, sdk_path, basepath=False, raw=False):
|
def getsrclib(spec, srclib_dir, sdk_path, basepath=False, raw=False, prepare=True, preponly=False):
|
||||||
|
|
||||||
if raw:
|
if raw:
|
||||||
name = spec
|
name = spec
|
||||||
|
@ -997,11 +997,13 @@ def getsrclib(spec, srclib_dir, sdk_path, basepath=False, raw=False):
|
||||||
srclib = parse_srclib(srclib_path)
|
srclib = parse_srclib(srclib_path)
|
||||||
|
|
||||||
sdir = os.path.join(srclib_dir, name)
|
sdir = os.path.join(srclib_dir, name)
|
||||||
vcs = getvcs(srclib["Repo Type"], srclib["Repo"], sdir, sdk_path)
|
|
||||||
vcs.gotorevision(ref)
|
|
||||||
|
|
||||||
if raw:
|
if not preponly:
|
||||||
return vcs
|
vcs = getvcs(srclib["Repo Type"], srclib["Repo"], sdir, sdk_path)
|
||||||
|
vcs.gotorevision(ref)
|
||||||
|
|
||||||
|
if raw:
|
||||||
|
return vcs
|
||||||
|
|
||||||
libdir = None
|
libdir = None
|
||||||
|
|
||||||
|
@ -1015,18 +1017,21 @@ def getsrclib(spec, srclib_dir, sdk_path, basepath=False, raw=False):
|
||||||
if libdir is None:
|
if libdir is None:
|
||||||
libdir = sdir
|
libdir = sdir
|
||||||
|
|
||||||
if srclib["Prepare"] is not None:
|
if prepare:
|
||||||
p = subprocess.Popen(srclib["Prepare"], cwd=libdir, shell=True,
|
|
||||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
|
||||||
out, err = p.communicate()
|
|
||||||
if p.returncode != 0:
|
|
||||||
raise BuildException("Error running prepare command for srclib "
|
|
||||||
+ name, out, err)
|
|
||||||
|
|
||||||
if srclib["Update Project"] == "Yes":
|
if srclib["Prepare"] is not None:
|
||||||
if subprocess.call([os.path.join(sdk_path, 'tools', 'android'),
|
print "******************************* PREPARE " + srclib["Prepare"] + " **************"
|
||||||
'update', 'project', '-p', libdir]) != 0:
|
p = subprocess.Popen(['bash', '-c', srclib["Prepare"]], cwd=libdir,
|
||||||
raise BuildException( 'Error updating ' + name + ' project')
|
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
|
out, err = p.communicate()
|
||||||
|
if p.returncode != 0:
|
||||||
|
raise BuildException("Error running prepare command for srclib "
|
||||||
|
+ name, out, err)
|
||||||
|
|
||||||
|
if srclib["Update Project"] == "Yes":
|
||||||
|
if subprocess.call([os.path.join(sdk_path, 'tools', 'android'),
|
||||||
|
'update', 'project', '-p', libdir]) != 0:
|
||||||
|
raise BuildException( 'Error updating ' + name + ' project')
|
||||||
|
|
||||||
if basepath:
|
if basepath:
|
||||||
return sdir
|
return sdir
|
||||||
|
@ -1052,7 +1057,7 @@ def getsrclib(spec, srclib_dir, sdk_path, basepath=False, raw=False):
|
||||||
# 'root' is the root directory, which may be the same as 'build_dir' or may
|
# 'root' is the root directory, which may be the same as 'build_dir' or may
|
||||||
# be a subdirectory of it.
|
# be a subdirectory of it.
|
||||||
# 'srclibpaths' is information on the srclibs being used
|
# 'srclibpaths' is information on the srclibs being used
|
||||||
def prepare_source(vcs, app, build, build_dir, srclib_dir, extlib_dir, sdk_path, ndk_path, javacc_path, mvn3, verbose=False):
|
def prepare_source(vcs, app, build, build_dir, srclib_dir, extlib_dir, sdk_path, ndk_path, javacc_path, mvn3, verbose=False, onserver=False):
|
||||||
|
|
||||||
# Optionally, the actual app source can be in a subdirectory...
|
# Optionally, the actual app source can be in a subdirectory...
|
||||||
if 'subdir' in build:
|
if 'subdir' in build:
|
||||||
|
@ -1229,7 +1234,7 @@ def prepare_source(vcs, app, build, build_dir, srclib_dir, extlib_dir, sdk_path,
|
||||||
if 'srclibs' in build:
|
if 'srclibs' in build:
|
||||||
for lib in build['srclibs'].split(';'):
|
for lib in build['srclibs'].split(';'):
|
||||||
name, _ = lib.split('@')
|
name, _ = lib.split('@')
|
||||||
srclibpaths.append((name, getsrclib(lib, srclib_dir, sdk_path)))
|
srclibpaths.append((name, getsrclib(lib, srclib_dir, sdk_path, preponly=onserver)))
|
||||||
basesrclib = vcs.getsrclib()
|
basesrclib = vcs.getsrclib()
|
||||||
# If one was used for the main source, add that too.
|
# If one was used for the main source, add that too.
|
||||||
if basesrclib:
|
if basesrclib:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue