Skip to contentSkip to conversation

fetch2/git: Allow file:// URLs without checking for network access

PATCH Applied Jeff Polk 2 participants 3 messages May 4, 2012

lore
Share & tools
lore

Jeff Polk

author
#0 lore raw

PATCH 1/2 fetch2/git: Allow file:// URLs without checking for network access

Don't check for network access before grabbing the the current head, cloning, or updating a clone when the protocol is 'file'.

---
 lib/bb/fetch2/git.py |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
lib/bb/fetch2/git.py +6 -3
index 61fdc4b..bcc0da5 100644
@@ -184,7 +184,8 @@ class Git(FetchMethod):
         # If the repo still doesn't exist, fallback to cloning it
         if not os.path.exists(ud.clonedir):
             clone_cmd = "%s clone --bare --mirror %s %s" % (ud.basecmd, repourl, ud.clonedir)
-            bb.fetch2.check_network_access(d, clone_cmd)
+            if ud.proto.lower() != 'file':
+                bb.fetch2.check_network_access(d, clone_cmd)
             runfetchcmd(clone_cmd, d)
 
         os.chdir(ud.clonedir)
@@ -202,7 +203,8 @@ class Git(FetchMethod):
 
             runfetchcmd("%s remote add --mirror=fetch origin %s" % (ud.basecmd, repourl), d)
             fetch_cmd = "%s fetch -f --prune %s refs/*:refs/*" % (ud.basecmd, repourl)
-            bb.fetch2.check_network_access(d, fetch_cmd, ud.url)
+            if ud.proto.lower() != 'file':
+                bb.fetch2.check_network_access(d, fetch_cmd, ud.url)
             runfetchcmd(fetch_cmd, d)
             runfetchcmd("%s prune-packed" % ud.basecmd, d)
             runfetchcmd("%s pack-redundant --all | xargs -r rm" % ud.basecmd, d)
@@ -281,7 +283,8 @@ class Git(FetchMethod):
         basecmd = data.getVar("FETCHCMD_git", d, True) or "git"
         cmd = "%s ls-remote %s://%s%s%s %s" % \
               (basecmd, ud.proto, username, ud.host, ud.path, ud.branches[name])
-        bb.fetch2.check_network_access(d, cmd)
+        if ud.proto.lower() != 'file':
+            bb.fetch2.check_network_access(d, cmd)
         output = runfetchcmd(cmd, d, True)
         if not output:
             raise bb.fetch2.FetchError("The command %s gave empty output unexpectedly" % cmd, url)
Signature · 1 line
1.7.5.4
author
#1 lore raw

PATCH 2/2 bitbake/fetch2: Fix spelling error in network access error message

---
 lib/bb/fetch2/__init__.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
lib/bb/fetch2/__init__.py +1 -1
index 414cc2b..3391e6a 100644
@@ -99,7 +99,7 @@ class ParameterError(BBFetchException):
 class NetworkAccess(BBFetchException):
     """Exception raised when network access is disabled but it is required."""
     def __init__(self, url, cmd):
-         msg = "Network access disabled through BB_NO_NETWORK but access rquested with command %s (for url %s)" % (cmd, url)
+         msg = "Network access disabled through BB_NO_NETWORK but access requested with command %s (for url %s)" % (cmd, url)
          self.url = url
          self.cmd = cmd
          BBFetchException.__init__(self, msg)
Signature · 1 line
1.7.5.4
#2 lore raw
In reply to Jeff Polk
Quoted 7 lines · Jeff Polk

Don't check for network access before grabbing the the current head, cloning, or updating a clone when the protocol is 'file'.

---
 lib/bb/fetch2/git.py |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

Merged to master (along with 2/2), thanks.

Richard