1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-11-09 00:40:11 +01:00

Use build/srclib instead of build/extlib

This commit is contained in:
Daniel Martí 2013-05-20 13:34:03 +02:00
parent eb39d110d0
commit 9efa52276d
2 changed files with 15 additions and 12 deletions

View File

@ -260,12 +260,12 @@ 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, 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=False):
"""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, extlib_dir, sdk_path, ndk_path, build_dir, srclib_dir, extlib_dir, sdk_path, ndk_path,
javacc_path, mvn3, verbose) javacc_path, mvn3, verbose)
# Scan before building... # Scan before building...
@ -464,7 +464,7 @@ def build_local(app, thisbuild, vcs, build_dir, output_dir, extlib_dir, tmp_dir,
os.path.join(output_dir, tarfilename)) os.path.join(output_dir, tarfilename))
def trybuild(app, thisbuild, build_dir, output_dir, also_check_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=False):
""" """
Build a particular version of an application, if it needs building. Build a particular version of an application, if it needs building.
@ -498,7 +498,7 @@ def trybuild(app, thisbuild, build_dir, output_dir, also_check_dir, extlib_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, 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)
return True return True
@ -607,6 +607,7 @@ def main():
if not os.path.isdir(build_dir): if not os.path.isdir(build_dir):
print "Creating build directory" print "Creating build directory"
os.makedirs(build_dir) os.makedirs(build_dir)
srclib_dir = os.path.join(build_dir, 'srclib')
extlib_dir = os.path.join(build_dir, 'extlib') extlib_dir = os.path.join(build_dir, 'extlib')
# Filter apps and build versions according to command-line options, etc... # Filter apps and build versions according to command-line options, etc...
@ -648,7 +649,7 @@ def main():
wikilog = None wikilog = None
try: try:
if trybuild(app, thisbuild, build_dir, output_dir, also_check_dir, if trybuild(app, thisbuild, build_dir, output_dir, also_check_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):
build_succeeded.append(app) build_succeeded.append(app)

View File

@ -347,8 +347,7 @@ class vcs_srclib(vcs):
def gotorevisionx(self, rev): def gotorevisionx(self, rev):
# Yuk... srclib_dir = 'build/srclib'
extlib_dir = 'build/extlib'
if os.path.exists(self.local): if os.path.exists(self.local):
shutil.rmtree(self.local) shutil.rmtree(self.local)
@ -358,7 +357,7 @@ class vcs_srclib(vcs):
else: else:
srclib = self.remote srclib = self.remote
path = None path = None
libdir = getsrclib(srclib + '@' + rev, extlib_dir, self.sdk_path) libdir = getsrclib(srclib + '@' + rev, srclib_dir, self.sdk_path)
self.srclib = (srclib, libdir) self.srclib = (srclib, libdir)
if path: if path:
libdir = os.path.join(libdir, path) libdir = os.path.join(libdir, path)
@ -951,7 +950,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, extlib_dir, sdk_path, basepath=False): def getsrclib(spec, srclib_dir, sdk_path, basepath=False):
name, ref = spec.split('@') name, ref = spec.split('@')
@ -962,7 +961,8 @@ def getsrclib(spec, extlib_dir, sdk_path, basepath=False):
srclib = parse_srclib(srclib_path) srclib = parse_srclib(srclib_path)
sdir = os.path.join(extlib_dir, name) sdir = os.path.join(srclib_dir, name)
print sdir
vcs = getvcs(srclib["Repo Type"], srclib["Repo"], sdir, sdk_path) vcs = getvcs(srclib["Repo Type"], srclib["Repo"], sdir, sdk_path)
vcs.gotorevision(ref) vcs.gotorevision(ref)
@ -1002,6 +1002,8 @@ def getsrclib(spec, extlib_dir, sdk_path, basepath=False):
# 'build' - the build details from the metadata # 'build' - the build details from the metadata
# 'build_dir' - the path to the build directory, usually # 'build_dir' - the path to the build directory, usually
# 'build/app.id' # '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 # 'extlib_dir' - the path to the external libraries directory, usually
# 'build/extlib' # 'build/extlib'
# 'sdk_path' - the path to the Android SDK # 'sdk_path' - the path to the Android SDK
@ -1013,7 +1015,7 @@ def getsrclib(spec, extlib_dir, sdk_path, basepath=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, 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):
# 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:
@ -1190,7 +1192,7 @@ def prepare_source(vcs, app, build, build_dir, extlib_dir, sdk_path, ndk_path, j
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, extlib_dir, sdk_path))) srclibpaths.append((name, getsrclib(lib, srclib_dir, sdk_path)))
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: