[bitbake-devel] [PATCH 1/1] fetch2/git.py: fix _latest_revision for local PREMIRROR

Robert Yang liezhi.yang at windriver.com
Thu Aug 13 07:08:48 UTC 2015


- Fixed when SRCREV = "${AUTOREV}", and set BB_NO_NETWORK = "1":
$ bitbake <recipe> -ccleanall
| DEBUG: Executing python function do_cleanall
| DEBUG: Python function do_cleanall finished
| ERROR: Function failed: Network access disabled through BB_NO_NETWORK ...

- Fixed when SRCREV = "${AUTOREV}", set BB_NO_NETWORK = "1"  and use
  local PREMIRROR:
$ bitbake <recipe> -cfetchall
| DEBUG: Python function do_fetch finished
| ERROR: Function failed: Network access disabled through BB_NO_NETWORK ...

Stop running "git ls-remote" when BB_NO_NETWORK would fix the problem.

Signed-off-by: Robert Yang <liezhi.yang at windriver.com>
---
 bitbake/lib/bb/fetch2/git.py |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/bitbake/lib/bb/fetch2/git.py b/bitbake/lib/bb/fetch2/git.py
index 374d846..67ee107 100644
--- a/bitbake/lib/bb/fetch2/git.py
+++ b/bitbake/lib/bb/fetch2/git.py
@@ -350,7 +350,6 @@ class Git(FetchMethod):
         """
         Compute the HEAD revision for the url
         """
-        output = self._lsremote(ud, d, "")
         # Tags of the form ^{} may not work, need to fallback to other form
         if ud.unresolvedrev[name][:5] == "refs/":
             head = ud.unresolvedrev[name]
@@ -358,6 +357,12 @@ class Git(FetchMethod):
         else:
             head = "refs/heads/%s" % ud.unresolvedrev[name]
             tag = "refs/tags/%s" % ud.unresolvedrev[name]
+        # Only ls-remote when url is "file://" or BB_NO_NETWORK != "1",
+        # this makes local mirror works.
+        if ud.proto.lower() == 'file' or d.getVar("BB_NO_NETWORK", True) != "1":
+            output = self._lsremote(ud, d, "")
+        else:
+            output = "%s %s" % (name, head)
         for s in [head, tag + "^{}", tag]:
             for l in output.split('\n'):
                 if s in l:
-- 
1.7.9.5




More information about the bitbake-devel mailing list