summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/fetch2/gitsm.py
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/bb/fetch2/gitsm.py')
-rw-r--r--bitbake/lib/bb/fetch2/gitsm.py23
1 files changed, 10 insertions, 13 deletions
diff --git a/bitbake/lib/bb/fetch2/gitsm.py b/bitbake/lib/bb/fetch2/gitsm.py
index 752f1d3c15..6613762048 100644
--- a/bitbake/lib/bb/fetch2/gitsm.py
+++ b/bitbake/lib/bb/fetch2/gitsm.py
@@ -43,10 +43,10 @@ class GitSM(Git):
43 """ 43 """
44 return ud.type in ['gitsm'] 44 return ud.type in ['gitsm']
45 45
46 def uses_submodules(self, ud, d): 46 def uses_submodules(self, ud, d, wd):
47 for name in ud.names: 47 for name in ud.names:
48 try: 48 try:
49 runfetchcmd("%s show %s:.gitmodules" % (ud.basecmd, ud.revisions[name]), d, quiet=True) 49 runfetchcmd("%s show %s:.gitmodules" % (ud.basecmd, ud.revisions[name]), d, quiet=True, workdir=wd)
50 return True 50 return True
51 except bb.fetch.FetchError: 51 except bb.fetch.FetchError:
52 pass 52 pass
@@ -107,28 +107,25 @@ class GitSM(Git):
107 os.mkdir(tmpclonedir) 107 os.mkdir(tmpclonedir)
108 os.rename(ud.clonedir, gitdir) 108 os.rename(ud.clonedir, gitdir)
109 runfetchcmd("sed " + gitdir + "/config -i -e 's/bare.*=.*true/bare = false/'", d) 109 runfetchcmd("sed " + gitdir + "/config -i -e 's/bare.*=.*true/bare = false/'", d)
110 os.chdir(tmpclonedir) 110 runfetchcmd(ud.basecmd + " reset --hard", d, workdir=tmpclonedir)
111 runfetchcmd(ud.basecmd + " reset --hard", d) 111 runfetchcmd(ud.basecmd + " checkout " + ud.revisions[ud.names[0]], d, workdir=tmpclonedir)
112 runfetchcmd(ud.basecmd + " checkout " + ud.revisions[ud.names[0]], d) 112 runfetchcmd(ud.basecmd + " submodule update --init --recursive", d, workdir=tmpclonedir)
113 runfetchcmd(ud.basecmd + " submodule update --init --recursive", d)
114 self._set_relative_paths(tmpclonedir) 113 self._set_relative_paths(tmpclonedir)
115 runfetchcmd("sed " + gitdir + "/config -i -e 's/bare.*=.*false/bare = true/'", d) 114 runfetchcmd("sed " + gitdir + "/config -i -e 's/bare.*=.*false/bare = true/'", d, workdir=tmpclonedir)
116 os.rename(gitdir, ud.clonedir,) 115 os.rename(gitdir, ud.clonedir,)
117 bb.utils.remove(tmpclonedir, True) 116 bb.utils.remove(tmpclonedir, True)
118 117
119 def download(self, ud, d): 118 def download(self, ud, d):
120 Git.download(self, ud, d) 119 Git.download(self, ud, d)
121 120
122 os.chdir(ud.clonedir) 121 submodules = self.uses_submodules(ud, d, ud.clonedir)
123 submodules = self.uses_submodules(ud, d)
124 if submodules: 122 if submodules:
125 self.update_submodules(ud, d) 123 self.update_submodules(ud, d)
126 124
127 def unpack(self, ud, destdir, d): 125 def unpack(self, ud, destdir, d):
128 Git.unpack(self, ud, destdir, d) 126 Git.unpack(self, ud, destdir, d)
129 127
130 os.chdir(ud.destdir) 128 submodules = self.uses_submodules(ud, d, ud.destdir)
131 submodules = self.uses_submodules(ud, d)
132 if submodules: 129 if submodules:
133 runfetchcmd(ud.basecmd + " checkout " + ud.revisions[ud.names[0]], d) 130 runfetchcmd(ud.basecmd + " checkout " + ud.revisions[ud.names[0]], d, workdir=ud.destdir)
134 runfetchcmd(ud.basecmd + " submodule update --init --recursive", d) 131 runfetchcmd(ud.basecmd + " submodule update --init --recursive", d, workdir=ud.destdir)