Skip to contentSkip to conversation

fetch2/git.py: fix _latest_revision for local PREMIRROR

PATCH In review Robert Yang 2 participants 5 messages Aug 13, 2015 – Aug 17, 2015

lore
Share & tools
lore
#0 lore raw

cover fetch2/git.py: fix _latest_revision for local PREMIRROR

The following changes since commit 64da20b8555350e1b0d761c36499532e83ca9827:

multilib_global.bbclass: fix PREFERRED_VERSION for cross-canadian (2015-08-12 23:51:13 -0700)

are available in the git repository at:

git://git.pokylinux.org/poky-contrib rbt/auto
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=rbt/auto

Robert Yang (1):
fetch2/git.py: fix _latest_revision for local PREMIRROR

 bitbake/lib/bb/fetch2/git.py |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/1 fetch2/git.py: fix _latest_revision for local PREMIRROR

- 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.

---
 bitbake/lib/bb/fetch2/git.py |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
bitbake/lib/bb/fetch2/git.py +6 -1
index 374d846..67ee107 100644
@@ -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:
Signature · 1 line
1.7.9.5
#2 lore raw
Quoted 34 lines · Robert Yang

- 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.

---
 bitbake/lib/bb/fetch2/git.py |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
bitbake/lib/bb/fetch2/git.py +0 -1
index 374d846..67ee107 100644
@@ -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]

bitbake/lib/bb/fetch2/git.py class Git(FetchMethod): · line 368

Quoted 10 lines
bitbake/lib/bb/fetch2/git.py +6 -0
             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:

The idea is that when BB_NO_NETWORK is set, network accesses show errors. This would stop that happening in all cases and lead to silent failures which would be bad for user experience.

So no, this isn't an acceptable way to fix this, sorry.

Cheers,

Richard

#3 lore raw
Quoted 41 lines · Richard Purdie
Quoted 40 lines · Robert Yang

- 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.

---
  bitbake/lib/bb/fetch2/git.py |    7 ++++++-
  1 file changed, 6 insertions(+), 1 deletion(-)
bitbake/lib/bb/fetch2/git.py +5 -1
index 374d846..67ee107 100644
@@ -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:
Quoted 8 lines

bitbake/lib/bb/fetch2/git.py class Git(FetchMethod): · line 368

Quoted 4 lines
bitbake/lib/bb/fetch2/git.py +1 -0
+            output = "%s %s" % (name, head)
          for s in [head, tag + "^{}", tag]:
              for l in output.split('\n'):
                  if s in l:

The idea is that when BB_NO_NETWORK is set, network accesses show errors. This would stop that happening in all cases and lead to silent failures which would be bad for user experience.

Thanks, do you have any ideas on how to fix the problem when use local mirror for SRCREV = "${AUTOREV}" recipes, please ?

// Robert

Quoted 16 lines

So no, this isn't an acceptable way to fix this, sorry.

Cheers,

Richard

#4 lore raw
In reply to Robert Yang

Sorry, please ignore this one, wrong mailing list.

// Robert

Quoted 15 lines · Robert Yang

The following changes since commit 64da20b8555350e1b0d761c36499532e83ca9827:

   multilib_global.bbclass: fix PREFERRED_VERSION for cross-canadian (2015-08-12 23:51:13 -0700)

are available in the git repository at:

git://git.pokylinux.org/poky-contrib rbt/auto
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=rbt/auto

Robert Yang (1):
fetch2/git.py: fix _latest_revision for local PREMIRROR

  bitbake/lib/bb/fetch2/git.py |    7 ++++++-
  1 file changed, 6 insertions(+), 1 deletion(-)