diff options
author | Yu Ke <ke.yu@intel.com> | 2011-01-24 15:56:54 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-01-25 12:32:50 +0000 |
commit | 029f8584d547c0792ffbe2f83451dcdfe2a3db7f (patch) | |
tree | f5d680b8b72371b1039d5aff6fac1b28eb9d530f /bitbake/lib | |
parent | 098e8ded339f3bf864f3bad9871028176f70b12b (diff) | |
download | openembedded-core-029f8584d547c0792ffbe2f83451dcdfe2a3db7f.tar.gz openembedded-core-029f8584d547c0792ffbe2f83451dcdfe2a3db7f.tar.bz2 openembedded-core-029f8584d547c0792ffbe2f83451dcdfe2a3db7f.zip |
bitbake/fetch2: Instrument fetchers when making network access
Signed-off-by: Yu Ke <ke.yu@intel.com>
Diffstat (limited to 'bitbake/lib')
-rw-r--r-- | bitbake/lib/bb/fetch2/bzr.py | 4 | ||||
-rw-r--r-- | bitbake/lib/bb/fetch2/cvs.py | 2 | ||||
-rw-r--r-- | bitbake/lib/bb/fetch2/git.py | 3 | ||||
-rw-r--r-- | bitbake/lib/bb/fetch2/hg.py | 3 | ||||
-rw-r--r-- | bitbake/lib/bb/fetch2/osc.py | 2 | ||||
-rw-r--r-- | bitbake/lib/bb/fetch2/repo.py | 2 | ||||
-rw-r--r-- | bitbake/lib/bb/fetch2/ssh.py | 2 | ||||
-rw-r--r-- | bitbake/lib/bb/fetch2/svn.py | 4 | ||||
-rw-r--r-- | bitbake/lib/bb/fetch2/wget.py | 1 |
9 files changed, 22 insertions, 1 deletions
diff --git a/bitbake/lib/bb/fetch2/bzr.py b/bitbake/lib/bb/fetch2/bzr.py index 608ecc7474..6e1970b715 100644 --- a/bitbake/lib/bb/fetch2/bzr.py +++ b/bitbake/lib/bb/fetch2/bzr.py @@ -85,11 +85,13 @@ class Bzr(Fetch): if os.access(os.path.join(ud.pkgdir, os.path.basename(ud.pkgdir), '.bzr'), os.R_OK): bzrcmd = self._buildbzrcommand(ud, d, "update") logger.debug(1, "BZR Update %s", loc) + bb.fetch2.check_network_access(d, bzrcmd) os.chdir(os.path.join (ud.pkgdir, os.path.basename(ud.path))) runfetchcmd(bzrcmd, d) else: bb.utils.remove(os.path.join(ud.pkgdir, os.path.basename(ud.pkgdir)), True) bzrcmd = self._buildbzrcommand(ud, d, "fetch") + bb.fetch2.check_network_access(d, bzrcmd) logger.debug(1, "BZR Checkout %s", loc) bb.mkdirhier(ud.pkgdir) os.chdir(ud.pkgdir) @@ -130,6 +132,8 @@ class Bzr(Fetch): """ logger.debug(2, "BZR fetcher hitting network for %s", url) + bb.fetch2.check_network_access(d, self._buildbzrcommand(ud, d, "revno")) + output = runfetchcmd(self._buildbzrcommand(ud, d, "revno"), d, True) return output.strip() diff --git a/bitbake/lib/bb/fetch2/cvs.py b/bitbake/lib/bb/fetch2/cvs.py index 8e72090488..4915e74e4b 100644 --- a/bitbake/lib/bb/fetch2/cvs.py +++ b/bitbake/lib/bb/fetch2/cvs.py @@ -131,6 +131,7 @@ class Cvs(Fetch): moddir = os.path.join(pkgdir, localdir) if os.access(os.path.join(moddir, 'CVS'), os.R_OK): logger.info("Update " + loc) + bb.fetch2.check_network_access(d, cvsupdatecmd) # update sources there os.chdir(moddir) myret = os.system(cvsupdatecmd) @@ -140,6 +141,7 @@ class Cvs(Fetch): bb.mkdirhier(pkgdir) os.chdir(pkgdir) logger.debug(1, "Running %s", cvscmd) + bb.fetch2.check_network_access(d, cvscmd) myret = os.system(cvscmd) if myret != 0 or not os.access(moddir, os.R_OK): diff --git a/bitbake/lib/bb/fetch2/git.py b/bitbake/lib/bb/fetch2/git.py index d818c1e6f0..08daa20313 100644 --- a/bitbake/lib/bb/fetch2/git.py +++ b/bitbake/lib/bb/fetch2/git.py @@ -124,12 +124,14 @@ class Git(Fetch): # If the repo still doesn't exist, fallback to cloning it if not os.path.exists(ud.clonedir): + bb.fetch2.check_network_access(d, "git clone %s%s" % (ud.host, ud.path)) runfetchcmd("%s clone -n %s://%s%s%s %s" % (ud.basecmd, ud.proto, username, ud.host, ud.path, ud.clonedir), d) os.chdir(ud.clonedir) # Update the checkout if needed if not self._contains_ref(ud.tag, d) or 'fullclone' in ud.parm: # Remove all but the .git directory + bb.fetch2.check_network_access(d, "git fetch %s%s" %(ud.host, ud.path)) runfetchcmd("rm * -Rf", d) if 'fullclone' in ud.parm: runfetchcmd("%s fetch --all" % (ud.basecmd), d) @@ -215,6 +217,7 @@ class Git(Fetch): else: username = "" + bb.fetch2.check_network_access(d, "git ls-remote %s%s %s" % (ud.host, ud.path, ud.branch)) 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.branch) output = runfetchcmd(cmd, d, True) diff --git a/bitbake/lib/bb/fetch2/hg.py b/bitbake/lib/bb/fetch2/hg.py index 635ecbfade..4ba28c7100 100644 --- a/bitbake/lib/bb/fetch2/hg.py +++ b/bitbake/lib/bb/fetch2/hg.py @@ -123,6 +123,7 @@ class Hg(Fetch): # update sources there os.chdir(ud.moddir) logger.debug(1, "Running %s", updatecmd) + bb.fetch2.check_network_access(d, updatecmd) runfetchcmd(updatecmd, d) else: @@ -132,6 +133,7 @@ class Hg(Fetch): bb.mkdirhier(ud.pkgdir) os.chdir(ud.pkgdir) logger.debug(1, "Running %s", fetchcmd) + bb.fetch2.check_network_access(d, fetchcmd) runfetchcmd(fetchcmd, d) # Even when we clone (fetch), we still need to update as hg's clone @@ -165,6 +167,7 @@ class Hg(Fetch): """ Compute tip revision for the url """ + bb.fetch2.check_network_access(d, self._buildhgcommand(ud, d, "info")) output = runfetchcmd(self._buildhgcommand(ud, d, "info"), d) return output.strip() diff --git a/bitbake/lib/bb/fetch2/osc.py b/bitbake/lib/bb/fetch2/osc.py index 619e2f15dd..25dcb7bd67 100644 --- a/bitbake/lib/bb/fetch2/osc.py +++ b/bitbake/lib/bb/fetch2/osc.py @@ -92,6 +92,7 @@ class Osc(Fetch): # update sources there os.chdir(ud.moddir) logger.debug(1, "Running %s", oscupdatecmd) + bb.fetch2.check_network_access(d, oscupdatecmd) runfetchcmd(oscupdatecmd, d) else: oscfetchcmd = self._buildosccommand(ud, d, "fetch") @@ -100,6 +101,7 @@ class Osc(Fetch): bb.mkdirhier(ud.pkgdir) os.chdir(ud.pkgdir) logger.debug(1, "Running %s", oscfetchcmd) + bb.fetch2.check_network_access(d, oscfetchcmd) runfetchcmd(oscfetchcmd, d) os.chdir(os.path.join(ud.pkgdir + ud.path)) diff --git a/bitbake/lib/bb/fetch2/repo.py b/bitbake/lib/bb/fetch2/repo.py index 510ba4686a..c80fe5de84 100644 --- a/bitbake/lib/bb/fetch2/repo.py +++ b/bitbake/lib/bb/fetch2/repo.py @@ -74,8 +74,10 @@ class Repo(Fetch): bb.mkdirhier(os.path.join(codir, "repo")) os.chdir(os.path.join(codir, "repo")) if not os.path.exists(os.path.join(codir, "repo", ".repo")): + bb.fetch2.check_network_access(d, "repo init -m %s -b %s -u %s://%s%s%s" % (ud.manifest, ud.branch, ud.proto, username, ud.host, ud.path)) runfetchcmd("repo init -m %s -b %s -u %s://%s%s%s" % (ud.manifest, ud.branch, ud.proto, username, ud.host, ud.path), d) + bb.fetch2.check_network_access(d, "repo sync %s" % ud.url) runfetchcmd("repo sync", d) os.chdir(codir) diff --git a/bitbake/lib/bb/fetch2/ssh.py b/bitbake/lib/bb/fetch2/ssh.py index 78f55a6e9f..711e66896e 100644 --- a/bitbake/lib/bb/fetch2/ssh.py +++ b/bitbake/lib/bb/fetch2/ssh.py @@ -112,6 +112,8 @@ class SSH(Fetch): commands.mkarg(ldir) ) + bb.fetch2.check_network_access(d, cmd) + (exitstatus, output) = commands.getstatusoutput(cmd) if exitstatus != 0: print(output) diff --git a/bitbake/lib/bb/fetch2/svn.py b/bitbake/lib/bb/fetch2/svn.py index 547c04fd9e..8d768026be 100644 --- a/bitbake/lib/bb/fetch2/svn.py +++ b/bitbake/lib/bb/fetch2/svn.py @@ -139,6 +139,7 @@ class Svn(Fetch): # update sources there os.chdir(ud.moddir) logger.debug(1, "Running %s", svnupdatecmd) + bb.fetch2.check_network_access(d, svnupdatecmd) runfetchcmd(svnupdatecmd, d) else: svnfetchcmd = self._buildsvncommand(ud, d, "fetch") @@ -147,6 +148,7 @@ class Svn(Fetch): bb.mkdirhier(ud.pkgdir) os.chdir(ud.pkgdir) logger.debug(1, "Running %s", svnfetchcmd) + bb.fetch2.check_network_access(d, svnfetchcmd) runfetchcmd(svnfetchcmd, d) scmdata = ud.parm.get("scmdata", "") @@ -180,7 +182,7 @@ class Svn(Fetch): """ Return the latest upstream revision number """ - logger.debug(2, "SVN fetcher hitting network for %s", url) + bb.fetch2.check_network_access(d, self._buildsvncommand(ud, d, "info")) output = runfetchcmd("LANG=C LC_ALL=C " + self._buildsvncommand(ud, d, "info"), d, True) diff --git a/bitbake/lib/bb/fetch2/wget.py b/bitbake/lib/bb/fetch2/wget.py index 91cfafb5b5..88cb8c7fed 100644 --- a/bitbake/lib/bb/fetch2/wget.py +++ b/bitbake/lib/bb/fetch2/wget.py @@ -69,6 +69,7 @@ class Wget(Fetch): fetchcmd = fetchcmd.replace("${FILE}", ud.basename) logger.info("fetch " + uri) logger.debug(2, "executing " + fetchcmd) + bb.fetch2.check_network_access(d, fetchcmd) runfetchcmd(fetchcmd, d) # Sanity check since wget can pretend it succeed when it didn't |