[bitbake-devel] [PATCH 1/1] fetch2/git.py:_latest_revision: respect BB_FETCH_PREMIRRORONLY

Robert Yang liezhi.yang at windriver.com
Thu Jan 7 07:38:51 UTC 2016


Fixed when use a local BB_FETCH_PREMIRRORONLY for AUTOREV recipes:
SRCREV = "${AUTOREV}"
BB_NO_NETWORK = "1"
For example, the refpolicy-mls from meta-selinux:
$ bitbake refpolicy-mls -ccleanall/fetch

Log data follows:
| DEBUG: Executing python function do_cleanall
| DEBUG: Python function do_cleanall finished
| ERROR: Function failed: Network access disabled through BB_NO_NETWORK (or set indirectly due to use of BB_FETCH_PREMIRRORONLY) but access requested with command git -c core.fsyncobjectfiles=0 ls-remote git://github.com/TresysTechnology/refpolicy.git  (for url None)
ERROR: Task 3 (/path/to/meta-selinux/recipes-security/refpolicy/refpolicy-mls_git.bb, do_cleanall) failed with exit code '1'
NOTE: Tasks Summary: Attempted 4 tasks of which 0 didn't need to be rerun and 1 failed.

Check BB_FETCH_PREMIRRORONLY before ls-remote will fix the problem.

[YOCTO #8893]

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

diff --git a/bitbake/lib/bb/fetch2/git.py b/bitbake/lib/bb/fetch2/git.py
index 5ffab22..7f7296f 100644
--- a/bitbake/lib/bb/fetch2/git.py
+++ b/bitbake/lib/bb/fetch2/git.py
@@ -356,7 +356,10 @@ class Git(FetchMethod):
         """
         Compute the HEAD revision for the url
         """
-        output = self._lsremote(ud, d, "")
+        if d.getVar("BB_FETCH_PREMIRRORONLY", True) and ud.proto != "file":
+            return "HEAD"
+        else:
+            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]
-- 
1.7.9.5




More information about the bitbake-devel mailing list