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

Merge branch 'deinit' into 'master'

deinit git submodule

See merge request fdroid/fdroidserver!1404
This commit is contained in:
Jochen Sprickerhof 2023-11-15 14:02:14 +00:00
commit 5751a50f21
3 changed files with 21 additions and 0 deletions

View File

@ -1174,6 +1174,10 @@ class vcs:
def initsubmodules(self):
raise VCSException('Submodules not supported for this vcs type')
# Deinitialise and update submodules
def deinitsubmodules(self):
pass
# Get a list of all known tags
def gettags(self):
if not self._gettags:
@ -1338,6 +1342,12 @@ class vcs_git(vcs):
if p.returncode != 0:
raise VCSException(_("Git submodule update failed"), p.output)
def deinitsubmodules(self):
self.checkrepo()
p = FDroidPopen(['git', 'submodule', 'deinit', '--all'], cwd=self.local, output=False)
if p.returncode != 0:
raise VCSException(_("Git submodule deinit failed"), p.output)
def _gettags(self):
self.checkrepo()
p = FDroidPopen(['git', 'tag'], cwd=self.local, output=False)
@ -2188,6 +2198,8 @@ def prepare_source(vcs, app, build, build_dir, srclib_dir, extlib_dir, onserver=
if build.submodules:
logging.info(_("Initialising submodules"))
vcs.initsubmodules()
else:
vcs.deinitsubmodules()
# Check that a subdir (if we're using one) exists. This has to happen
# after the checkout, since it might not exist elsewhere

View File

@ -586,6 +586,9 @@ class BuildTest(unittest.TestCase):
def getsrclib(self):
return None
def deinitsubmodules(self):
pass
# Test we trigger a scanner error without extlibs
build.extlibs = []
os.makedirs('build/libs')

View File

@ -315,6 +315,9 @@ class CommonTest(unittest.TestCase):
def getsrclib(self):
return None
def deinitsubmodules(self):
pass
fdroidserver.common.prepare_source(FakeVcs(), app, build,
fdroidclient_testdir, fdroidclient_testdir, fdroidclient_testdir)
@ -385,6 +388,9 @@ class CommonTest(unittest.TestCase):
def getsrclib(self):
return None
def deinitsubmodules(self):
pass
fdroidserver.common.prepare_source(FakeVcs(), app, build,
app_build_dir, srclib_testdir, app_build_dir,
onserver=True, refresh=False) # do not clone in this test