mirror of
https://gitlab.com/fdroid/fdroidserver.git
synced 2024-11-04 14:30:11 +01:00
Merge branch 'no-refresh' of https://gitlab.com/aelmahmoudy/fdroidserver
This commit is contained in:
commit
343c7de29f
@ -452,7 +452,7 @@ def capitalize_intact(string):
|
|||||||
return string[0].upper() + string[1:]
|
return string[0].upper() + string[1:]
|
||||||
|
|
||||||
|
|
||||||
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, refresh):
|
||||||
"""Do a build locally."""
|
"""Do a build locally."""
|
||||||
|
|
||||||
if thisbuild['buildjni'] and thisbuild['buildjni'] != ['no']:
|
if thisbuild['buildjni'] and thisbuild['buildjni'] != ['no']:
|
||||||
@ -479,7 +479,7 @@ 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,
|
build_dir, srclib_dir,
|
||||||
extlib_dir, onserver)
|
extlib_dir, onserver, refresh)
|
||||||
|
|
||||||
# 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
|
||||||
@ -876,7 +876,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, refresh):
|
||||||
"""
|
"""
|
||||||
Build a particular version of an application, if it needs building.
|
Build a particular version of an application, if it needs building.
|
||||||
|
|
||||||
@ -921,7 +921,7 @@ def trybuild(app, thisbuild, build_dir, output_dir, also_check_dir, srclib_dir,
|
|||||||
|
|
||||||
build_server(app, thisbuild, vcs, build_dir, output_dir, force)
|
build_server(app, thisbuild, vcs, build_dir, output_dir, force)
|
||||||
else:
|
else:
|
||||||
build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_dir, tmp_dir, force, onserver)
|
build_local(app, thisbuild, vcs, build_dir, output_dir, srclib_dir, extlib_dir, tmp_dir, force, onserver, refresh)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
@ -949,6 +949,8 @@ def parse_commandline():
|
|||||||
help="Skip scanning the source code for binaries and other problems")
|
help="Skip scanning the source code for binaries and other problems")
|
||||||
parser.add_option("--no-tarball", dest="notarball", action="store_true", default=False,
|
parser.add_option("--no-tarball", dest="notarball", action="store_true", default=False,
|
||||||
help="Don't create a source tarball, useful when testing a build")
|
help="Don't create a source tarball, useful when testing a build")
|
||||||
|
parser.add_option("--no-refresh", dest="refresh", action="store_false", default=True,
|
||||||
|
help="Don't refresh the repository, useful when testing a build with no internet connection")
|
||||||
parser.add_option("-f", "--force", action="store_true", default=False,
|
parser.add_option("-f", "--force", action="store_true", default=False,
|
||||||
help="Force build of disabled apps, and carries on regardless of scan problems. Only allowed in test mode.")
|
help="Force build of disabled apps, and carries on regardless of scan problems. Only allowed in test mode.")
|
||||||
parser.add_option("-a", "--all", action="store_true", default=False,
|
parser.add_option("-a", "--all", action="store_true", default=False,
|
||||||
@ -1074,7 +1076,7 @@ def main():
|
|||||||
also_check_dir, srclib_dir, extlib_dir,
|
also_check_dir, srclib_dir, extlib_dir,
|
||||||
tmp_dir, repo_dir, vcs, options.test,
|
tmp_dir, repo_dir, vcs, options.test,
|
||||||
options.server, options.force,
|
options.server, options.force,
|
||||||
options.onserver):
|
options.onserver, options.refresh):
|
||||||
|
|
||||||
if app.get('Binaries', None):
|
if app.get('Binaries', None):
|
||||||
# This is an app where we build from source, and
|
# This is an app where we build from source, and
|
||||||
|
@ -457,7 +457,7 @@ class vcs:
|
|||||||
# lifetime of the vcs object.
|
# lifetime of the vcs object.
|
||||||
# None is acceptable for 'rev' if you know you are cloning a clean copy of
|
# None is acceptable for 'rev' if you know you are cloning a clean copy of
|
||||||
# the repo - otherwise it must specify a valid revision.
|
# the repo - otherwise it must specify a valid revision.
|
||||||
def gotorevision(self, rev):
|
def gotorevision(self, rev, refresh=True):
|
||||||
|
|
||||||
if self.clone_failed:
|
if self.clone_failed:
|
||||||
raise VCSException("Downloading the repository already failed once, not trying again.")
|
raise VCSException("Downloading the repository already failed once, not trying again.")
|
||||||
@ -488,6 +488,8 @@ class vcs:
|
|||||||
shutil.rmtree(self.local)
|
shutil.rmtree(self.local)
|
||||||
|
|
||||||
exc = None
|
exc = None
|
||||||
|
if not refresh:
|
||||||
|
self.refreshed = True
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.gotorevisionx(rev)
|
self.gotorevisionx(rev)
|
||||||
@ -1095,7 +1097,7 @@ class BuildException(FDroidException):
|
|||||||
# 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, subdir=None, basepath=False,
|
def getsrclib(spec, srclib_dir, subdir=None, basepath=False,
|
||||||
raw=False, prepare=True, preponly=False):
|
raw=False, prepare=True, preponly=False, refresh=True):
|
||||||
|
|
||||||
number = None
|
number = None
|
||||||
subdir = None
|
subdir = None
|
||||||
@ -1120,7 +1122,7 @@ def getsrclib(spec, srclib_dir, subdir=None, basepath=False,
|
|||||||
vcs = getvcs(srclib["Repo Type"], srclib["Repo"], sdir)
|
vcs = getvcs(srclib["Repo Type"], srclib["Repo"], sdir)
|
||||||
vcs.srclib = (name, number, sdir)
|
vcs.srclib = (name, number, sdir)
|
||||||
if ref:
|
if ref:
|
||||||
vcs.gotorevision(ref)
|
vcs.gotorevision(ref, refresh)
|
||||||
|
|
||||||
if raw:
|
if raw:
|
||||||
return vcs
|
return vcs
|
||||||
@ -1171,7 +1173,7 @@ def getsrclib(spec, srclib_dir, subdir=None, 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, srclib_dir, extlib_dir, onserver=False):
|
def prepare_source(vcs, app, build, build_dir, srclib_dir, extlib_dir, onserver=False, refresh=True):
|
||||||
|
|
||||||
# Optionally, the actual app source can be in a subdirectory
|
# Optionally, the actual app source can be in a subdirectory
|
||||||
if build['subdir']:
|
if build['subdir']:
|
||||||
@ -1181,7 +1183,7 @@ def prepare_source(vcs, app, build, build_dir, srclib_dir, extlib_dir, onserver=
|
|||||||
|
|
||||||
# Get a working copy of the right revision
|
# Get a working copy of the right revision
|
||||||
logging.info("Getting source for revision " + build['commit'])
|
logging.info("Getting source for revision " + build['commit'])
|
||||||
vcs.gotorevision(build['commit'])
|
vcs.gotorevision(build['commit'], refresh)
|
||||||
|
|
||||||
# Initialise submodules if required
|
# Initialise submodules if required
|
||||||
if build['submodules']:
|
if build['submodules']:
|
||||||
@ -1219,7 +1221,7 @@ def prepare_source(vcs, app, build, build_dir, srclib_dir, extlib_dir, onserver=
|
|||||||
if build['srclibs']:
|
if build['srclibs']:
|
||||||
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, build, preponly=onserver))
|
srclibpaths.append(getsrclib(lib, srclib_dir, build, preponly=onserver, refresh=refresh))
|
||||||
|
|
||||||
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)
|
||||||
|
Loading…
Reference in New Issue
Block a user