aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony G. Basile <blueness@gentoo.org>2018-02-06 05:55:41 -0500
committerAnthony G. Basile <blueness@gentoo.org>2018-02-06 05:55:41 -0500
commitad2f9b41833ff60223030dc826106a99a5c52221 (patch)
treea4f07bc6a21def0b3bda58c5ba25dbdac6a3b98e
parentgrs/Kernel.py: use scripts/busybox-config if provided (diff)
downloadgrss-ad2f9b41833ff60223030dc826106a99a5c52221.tar.gz
grss-ad2f9b41833ff60223030dc826106a99a5c52221.tar.bz2
grss-ad2f9b41833ff60223030dc826106a99a5c52221.zip
grs/Synchronize.py: add git submodules support
-rw-r--r--grs/Synchronize.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/grs/Synchronize.py b/grs/Synchronize.py
index 3ce7d5c..199928b 100644
--- a/grs/Synchronize.py
+++ b/grs/Synchronize.py
@@ -30,6 +30,9 @@ class Synchronize():
self.logfile = logfile
def sync(self):
+ # If there is a .gitmodules, then update the submodules
+ git_modulesfile = os.path.join(self.local_repo, '.gitmodules')
+
if self.isgitdir():
# If the local repo exists, then make it pristine an pull
cmd = 'git -C %s reset HEAD --hard' % self.local_repo
@@ -38,14 +41,24 @@ class Synchronize():
Execute(cmd, timeout=60, logfile=self.logfile)
cmd = 'git -C %s pull' % self.local_repo
Execute(cmd, timeout=60, logfile=self.logfile)
+ if os.path.isfile(git_modulesfile):
+ cmd = 'git -C %s submodule update' % self.local_repo
+ Execute(cmd, timeout=60, logfile=self.logfile)
else:
# else clone afresh.
cmd = 'git clone %s %s' % (self.remote_repo, self.local_repo)
Execute(cmd, timeout=60, logfile=self.logfile)
+ if os.path.isfile(git_modulesfile):
+ cmd = 'git -C %s submodule init' % self.local_repo
+ Execute(cmd, timeout=60, logfile=self.logfile)
+ cmd = 'git -C %s submodule update' % self.local_repo
+ Execute(cmd, timeout=60, logfile=self.logfile)
+
# Make sure we're on the correct branch for the desired GRS system.
cmd = 'git -C %s checkout %s' % (self.local_repo, self.branch)
Execute(cmd, timeout=60, logfile=self.logfile)
+
def isgitdir(self):
""" If there is a .git/config file, assume its a local git repository. """
git_configdir = os.path.join(self.local_repo, '.git')