summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/fetch2/git.py31
1 files changed, 17 insertions, 14 deletions
diff --git a/bitbake/lib/bb/fetch2/git.py b/bitbake/lib/bb/fetch2/git.py
index 0fd9beee19..4cc5811937 100644
--- a/bitbake/lib/bb/fetch2/git.py
+++ b/bitbake/lib/bb/fetch2/git.py
@@ -178,11 +178,6 @@ class Git(FetchMethod):
178 def download(self, ud, d): 178 def download(self, ud, d):
179 """Fetch url""" 179 """Fetch url"""
180 180
181 if ud.user:
182 username = ud.user + '@'
183 else:
184 username = ""
185
186 ud.repochanged = not os.path.exists(ud.fullmirror) 181 ud.repochanged = not os.path.exists(ud.fullmirror)
187 182
188 # If the checkout doesn't exist and the mirror tarball does, extract it 183 # If the checkout doesn't exist and the mirror tarball does, extract it
@@ -191,7 +186,7 @@ class Git(FetchMethod):
191 os.chdir(ud.clonedir) 186 os.chdir(ud.clonedir)
192 runfetchcmd("tar -xzf %s" % (ud.fullmirror), d) 187 runfetchcmd("tar -xzf %s" % (ud.fullmirror), d)
193 188
194 repourl = "%s://%s%s%s" % (ud.proto, username, ud.host, ud.path) 189 repourl = self._get_repo_url(ud)
195 190
196 # If the repo still doesn't exist, fallback to cloning it 191 # If the repo still doesn't exist, fallback to cloning it
197 if not os.path.exists(ud.clonedir): 192 if not os.path.exists(ud.clonedir):
@@ -277,8 +272,10 @@ class Git(FetchMethod):
277 clonedir = indirectiondir 272 clonedir = indirectiondir
278 273
279 runfetchcmd("%s clone %s %s/ %s" % (ud.basecmd, cloneflags, clonedir, destdir), d) 274 runfetchcmd("%s clone %s %s/ %s" % (ud.basecmd, cloneflags, clonedir, destdir), d)
275 os.chdir(destdir)
276 repourl = self._get_repo_url(ud)
277 runfetchcmd("%s remote set-url origin %s" % (ud.basecmd, repourl), d)
280 if not ud.nocheckout: 278 if not ud.nocheckout:
281 os.chdir(destdir)
282 if subdir != "": 279 if subdir != "":
283 runfetchcmd("%s read-tree %s%s" % (ud.basecmd, ud.revisions[ud.names[0]], readpathspec), d) 280 runfetchcmd("%s read-tree %s%s" % (ud.basecmd, ud.revisions[ud.names[0]], readpathspec), d)
284 runfetchcmd("%s checkout-index -q -f -a" % ud.basecmd, d) 281 runfetchcmd("%s checkout-index -q -f -a" % ud.basecmd, d)
@@ -312,6 +309,16 @@ class Git(FetchMethod):
312 raise bb.fetch2.FetchError("The command '%s' gave output with more then 1 line unexpectedly, output: '%s'" % (cmd, output)) 309 raise bb.fetch2.FetchError("The command '%s' gave output with more then 1 line unexpectedly, output: '%s'" % (cmd, output))
313 return output.split()[0] != "0" 310 return output.split()[0] != "0"
314 311
312 def _get_repo_url(self, ud):
313 """
314 Return the repository URL
315 """
316 if ud.user:
317 username = ud.user + '@'
318 else:
319 username = ""
320 return "%s://%s%s%s" % (ud.proto, username, ud.host, ud.path)
321
315 def _revision_key(self, ud, d, name): 322 def _revision_key(self, ud, d, name):
316 """ 323 """
317 Return a unique key for the url 324 Return a unique key for the url
@@ -322,13 +329,9 @@ class Git(FetchMethod):
322 """ 329 """
323 Run git ls-remote with the specified search string 330 Run git ls-remote with the specified search string
324 """ 331 """
325 if ud.user: 332 repourl = self._get_repo_url(ud)
326 username = ud.user + '@' 333 cmd = "%s ls-remote %s %s" % \
327 else: 334 (ud.basecmd, repourl, search)
328 username = ""
329
330 cmd = "%s ls-remote %s://%s%s%s %s" % \
331 (ud.basecmd, ud.proto, username, ud.host, ud.path, search)
332 if ud.proto.lower() != 'file': 335 if ud.proto.lower() != 'file':
333 bb.fetch2.check_network_access(d, cmd) 336 bb.fetch2.check_network_access(d, cmd)
334 output = runfetchcmd(cmd, d, True) 337 output = runfetchcmd(cmd, d, True)