[rtems-source-builder commit] sb: Add git clean to the supported git commands.
Chris Johns
chrisj at rtems.org
Fri May 8 04:34:21 UTC 2020
Module: rtems-source-builder
Branch: master
Commit: 1f972c21082108aad6afe78a2a09ac6dbe97f97e
Changeset: http://git.rtems.org/rtems-source-builder/commit/?id=1f972c21082108aad6afe78a2a09ac6dbe97f97e
Author: Chris Johns <chrisj at rtems.org>
Date: Fri May 8 14:28:04 2020 +1000
sb: Add git clean to the supported git commands.
---
source-builder/sb/download.py | 9 +++++++++
source-builder/sb/git.py | 8 ++++++++
2 files changed, 17 insertions(+)
diff --git a/source-builder/sb/download.py b/source-builder/sb/download.py
index e197879..3aaa701 100644
--- a/source-builder/sb/download.py
+++ b/source-builder/sb/download.py
@@ -515,6 +515,15 @@ def _git_downloader(url, local, config, opts):
log.notice('git: reset: %s' % (us[0]))
if _do_download(opts):
repo.reset(arg)
+ repo.submodule_foreach(['reset'] + arg)
+ elif _as[0] == 'clean':
+ arg = []
+ if len(_as) > 1:
+ arg = ['--%s' % (_as[1])]
+ log.notice('git: clean: %s' % (us[0]))
+ if _do_download(opts):
+ repo.clean(arg)
+ repo.submodule_foreach(['clean'] + arg)
elif _as[0] == 'protocol':
pass
else:
diff --git a/source-builder/sb/git.py b/source-builder/sb/git.py
index be23396..52bcb83 100644
--- a/source-builder/sb/git.py
+++ b/source-builder/sb/git.py
@@ -105,6 +105,14 @@ class repo:
def submodule(self, module):
ec, output = self._run(['submodule', 'update', '--init', module], check = True)
+ def submodule_foreach(self, args = []):
+ if type(args) == str:
+ args = [args.split(args)]
+ ec, output = self._run(['submodule',
+ 'foreach',
+ '--recursive',
+ self.git] + args, check = True)
+
def submodules(self):
smodules = {}
ec, output = self._run(['submodule'], check = True)
More information about the vc
mailing list