1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-11-20 13:50:12 +01:00

Always clean and reset all submodules

This commit is contained in:
Daniel Martí 2015-06-28 19:37:28 -07:00
parent 3492ec6eff
commit b848b99bab

View File

@ -567,12 +567,14 @@ class vcs_git(vcs):
else: else:
self.checkrepo() self.checkrepo()
# Discard any working tree changes # Discard any working tree changes
p = FDroidPopen(['git', 'reset', '--hard'], cwd=self.local, output=False) p = FDroidPopen(['git', 'submodule', 'foreach', '--recursive',
'git', 'reset', '--hard'], cwd=self.local, output=False)
if p.returncode != 0: if p.returncode != 0:
raise VCSException("Git reset failed", p.output) raise VCSException("Git reset failed", p.output)
# Remove untracked files now, in case they're tracked in the target # Remove untracked files now, in case they're tracked in the target
# revision (it happens!) # revision (it happens!)
p = FDroidPopen(['git', 'clean', '-dffx'], cwd=self.local, output=False) p = FDroidPopen(['git', 'submodule', 'foreach', '--recursive',
'git', 'clean', '-dffx'], cwd=self.local, output=False)
if p.returncode != 0: if p.returncode != 0:
raise VCSException("Git clean failed", p.output) raise VCSException("Git clean failed", p.output)
if not self.refreshed: if not self.refreshed:
@ -620,13 +622,6 @@ class vcs_git(vcs):
line = line.replace('git@github.com:', 'https://github.com/') line = line.replace('git@github.com:', 'https://github.com/')
f.write(line) f.write(line)
for cmd in [
['git', 'reset', '--hard'],
['git', 'clean', '-dffx'],
]:
p = FDroidPopen(['git', 'submodule', 'foreach', '--recursive'] + cmd, cwd=self.local, output=False)
if p.returncode != 0:
raise VCSException("Git submodule reset failed", p.output)
p = FDroidPopen(['git', 'submodule', 'sync'], cwd=self.local, output=False) p = FDroidPopen(['git', 'submodule', 'sync'], cwd=self.local, output=False)
if p.returncode != 0: if p.returncode != 0:
raise VCSException("Git submodule sync failed", p.output) raise VCSException("Git submodule sync failed", p.output)
@ -1188,7 +1183,7 @@ def prepare_source(vcs, app, build, build_dir, srclib_dir, extlib_dir, onserver=
logging.info("Getting source for revision " + build['commit']) logging.info("Getting source for revision " + build['commit'])
vcs.gotorevision(build['commit']) vcs.gotorevision(build['commit'])
# Initialise submodules if requred # Initialise submodules if required
if build['submodules']: if build['submodules']:
logging.info("Initialising submodules") logging.info("Initialising submodules")
vcs.initsubmodules() vcs.initsubmodules()