diff options
-rw-r--r-- | bitbake/lib/bb/fetch2/git.py | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/bitbake/lib/bb/fetch2/git.py b/bitbake/lib/bb/fetch2/git.py index a8be859d94..2550bde838 100644 --- a/bitbake/lib/bb/fetch2/git.py +++ b/bitbake/lib/bb/fetch2/git.py | |||
@@ -379,14 +379,26 @@ class Git(FetchMethod): | |||
379 | """ | 379 | """ |
380 | Run git ls-remote with the specified search string | 380 | Run git ls-remote with the specified search string |
381 | """ | 381 | """ |
382 | repourl = self._get_repo_url(ud) | 382 | # Prevent recursion e.g. in OE if SRCPV is in PV, PV is in WORKDIR, |
383 | cmd = "%s ls-remote %s %s" % \ | 383 | # and WORKDIR is in PATH (as a result of RSS), our call to |
384 | (ud.basecmd, repourl, search) | 384 | # runfetchcmd() exports PATH so this function will get called again (!) |
385 | if ud.proto.lower() != 'file': | 385 | # In this scenario the return call of the function isn't actually |
386 | bb.fetch2.check_network_access(d, cmd, repourl) | 386 | # important - WORKDIR isn't needed in PATH to call git ls-remote |
387 | output = runfetchcmd(cmd, d, True) | 387 | # anyway. |
388 | if not output: | 388 | if d.getVar('_BB_GIT_IN_LSREMOTE', False): |
389 | raise bb.fetch2.FetchError("The command %s gave empty output unexpectedly" % cmd, ud.url) | 389 | return '' |
390 | d.setVar('_BB_GIT_IN_LSREMOTE', '1') | ||
391 | try: | ||
392 | repourl = self._get_repo_url(ud) | ||
393 | cmd = "%s ls-remote %s %s" % \ | ||
394 | (ud.basecmd, repourl, search) | ||
395 | if ud.proto.lower() != 'file': | ||
396 | bb.fetch2.check_network_access(d, cmd, repourl) | ||
397 | output = runfetchcmd(cmd, d, True) | ||
398 | if not output: | ||
399 | raise bb.fetch2.FetchError("The command %s gave empty output unexpectedly" % cmd, ud.url) | ||
400 | finally: | ||
401 | d.delVar('_BB_GIT_IN_LSREMOTE') | ||
390 | return output | 402 | return output |
391 | 403 | ||
392 | def _latest_revision(self, ud, d, name): | 404 | def _latest_revision(self, ud, d, name): |