summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb
diff options
context:
space:
mode:
authorYu Ke <ke.yu@intel.com>2011-01-24 15:56:54 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-01-25 12:32:50 +0000
commit029f8584d547c0792ffbe2f83451dcdfe2a3db7f (patch)
treef5d680b8b72371b1039d5aff6fac1b28eb9d530f /bitbake/lib/bb
parent098e8ded339f3bf864f3bad9871028176f70b12b (diff)
downloadpoky-029f8584d547c0792ffbe2f83451dcdfe2a3db7f.tar.gz
bitbake/fetch2: Instrument fetchers when making network access
Signed-off-by: Yu Ke <ke.yu@intel.com>
Diffstat (limited to 'bitbake/lib/bb')
-rw-r--r--bitbake/lib/bb/fetch2/bzr.py4
-rw-r--r--bitbake/lib/bb/fetch2/cvs.py2
-rw-r--r--bitbake/lib/bb/fetch2/git.py3
-rw-r--r--bitbake/lib/bb/fetch2/hg.py3
-rw-r--r--bitbake/lib/bb/fetch2/osc.py2
-rw-r--r--bitbake/lib/bb/fetch2/repo.py2
-rw-r--r--bitbake/lib/bb/fetch2/ssh.py2
-rw-r--r--bitbake/lib/bb/fetch2/svn.py4
-rw-r--r--bitbake/lib/bb/fetch2/wget.py1
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):
85 if os.access(os.path.join(ud.pkgdir, os.path.basename(ud.pkgdir), '.bzr'), os.R_OK): 85 if os.access(os.path.join(ud.pkgdir, os.path.basename(ud.pkgdir), '.bzr'), os.R_OK):
86 bzrcmd = self._buildbzrcommand(ud, d, "update") 86 bzrcmd = self._buildbzrcommand(ud, d, "update")
87 logger.debug(1, "BZR Update %s", loc) 87 logger.debug(1, "BZR Update %s", loc)
88 bb.fetch2.check_network_access(d, bzrcmd)
88 os.chdir(os.path.join (ud.pkgdir, os.path.basename(ud.path))) 89 os.chdir(os.path.join (ud.pkgdir, os.path.basename(ud.path)))
89 runfetchcmd(bzrcmd, d) 90 runfetchcmd(bzrcmd, d)
90 else: 91 else:
91 bb.utils.remove(os.path.join(ud.pkgdir, os.path.basename(ud.pkgdir)), True) 92 bb.utils.remove(os.path.join(ud.pkgdir, os.path.basename(ud.pkgdir)), True)
92 bzrcmd = self._buildbzrcommand(ud, d, "fetch") 93 bzrcmd = self._buildbzrcommand(ud, d, "fetch")
94 bb.fetch2.check_network_access(d, bzrcmd)
93 logger.debug(1, "BZR Checkout %s", loc) 95 logger.debug(1, "BZR Checkout %s", loc)
94 bb.mkdirhier(ud.pkgdir) 96 bb.mkdirhier(ud.pkgdir)
95 os.chdir(ud.pkgdir) 97 os.chdir(ud.pkgdir)
@@ -130,6 +132,8 @@ class Bzr(Fetch):
130 """ 132 """
131 logger.debug(2, "BZR fetcher hitting network for %s", url) 133 logger.debug(2, "BZR fetcher hitting network for %s", url)
132 134
135 bb.fetch2.check_network_access(d, self._buildbzrcommand(ud, d, "revno"))
136
133 output = runfetchcmd(self._buildbzrcommand(ud, d, "revno"), d, True) 137 output = runfetchcmd(self._buildbzrcommand(ud, d, "revno"), d, True)
134 138
135 return output.strip() 139 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):
131 moddir = os.path.join(pkgdir, localdir) 131 moddir = os.path.join(pkgdir, localdir)
132 if os.access(os.path.join(moddir, 'CVS'), os.R_OK): 132 if os.access(os.path.join(moddir, 'CVS'), os.R_OK):
133 logger.info("Update " + loc) 133 logger.info("Update " + loc)
134 bb.fetch2.check_network_access(d, cvsupdatecmd)
134 # update sources there 135 # update sources there
135 os.chdir(moddir) 136 os.chdir(moddir)
136 myret = os.system(cvsupdatecmd) 137 myret = os.system(cvsupdatecmd)
@@ -140,6 +141,7 @@ class Cvs(Fetch):
140 bb.mkdirhier(pkgdir) 141 bb.mkdirhier(pkgdir)
141 os.chdir(pkgdir) 142 os.chdir(pkgdir)
142 logger.debug(1, "Running %s", cvscmd) 143 logger.debug(1, "Running %s", cvscmd)
144 bb.fetch2.check_network_access(d, cvscmd)
143 myret = os.system(cvscmd) 145 myret = os.system(cvscmd)
144 146
145 if myret != 0 or not os.access(moddir, os.R_OK): 147 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):
124 124
125 # If the repo still doesn't exist, fallback to cloning it 125 # If the repo still doesn't exist, fallback to cloning it
126 if not os.path.exists(ud.clonedir): 126 if not os.path.exists(ud.clonedir):
127 bb.fetch2.check_network_access(d, "git clone %s%s" % (ud.host, ud.path))
127 runfetchcmd("%s clone -n %s://%s%s%s %s" % (ud.basecmd, ud.proto, username, ud.host, ud.path, ud.clonedir), d) 128 runfetchcmd("%s clone -n %s://%s%s%s %s" % (ud.basecmd, ud.proto, username, ud.host, ud.path, ud.clonedir), d)
128 129
129 os.chdir(ud.clonedir) 130 os.chdir(ud.clonedir)
130 # Update the checkout if needed 131 # Update the checkout if needed
131 if not self._contains_ref(ud.tag, d) or 'fullclone' in ud.parm: 132 if not self._contains_ref(ud.tag, d) or 'fullclone' in ud.parm:
132 # Remove all but the .git directory 133 # Remove all but the .git directory
134 bb.fetch2.check_network_access(d, "git fetch %s%s" %(ud.host, ud.path))
133 runfetchcmd("rm * -Rf", d) 135 runfetchcmd("rm * -Rf", d)
134 if 'fullclone' in ud.parm: 136 if 'fullclone' in ud.parm:
135 runfetchcmd("%s fetch --all" % (ud.basecmd), d) 137 runfetchcmd("%s fetch --all" % (ud.basecmd), d)
@@ -215,6 +217,7 @@ class Git(Fetch):
215 else: 217 else:
216 username = "" 218 username = ""
217 219
220 bb.fetch2.check_network_access(d, "git ls-remote %s%s %s" % (ud.host, ud.path, ud.branch))
218 basecmd = data.getVar("FETCHCMD_git", d, True) or "git" 221 basecmd = data.getVar("FETCHCMD_git", d, True) or "git"
219 cmd = "%s ls-remote %s://%s%s%s %s" % (basecmd, ud.proto, username, ud.host, ud.path, ud.branch) 222 cmd = "%s ls-remote %s://%s%s%s %s" % (basecmd, ud.proto, username, ud.host, ud.path, ud.branch)
220 output = runfetchcmd(cmd, d, True) 223 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):
123 # update sources there 123 # update sources there
124 os.chdir(ud.moddir) 124 os.chdir(ud.moddir)
125 logger.debug(1, "Running %s", updatecmd) 125 logger.debug(1, "Running %s", updatecmd)
126 bb.fetch2.check_network_access(d, updatecmd)
126 runfetchcmd(updatecmd, d) 127 runfetchcmd(updatecmd, d)
127 128
128 else: 129 else:
@@ -132,6 +133,7 @@ class Hg(Fetch):
132 bb.mkdirhier(ud.pkgdir) 133 bb.mkdirhier(ud.pkgdir)
133 os.chdir(ud.pkgdir) 134 os.chdir(ud.pkgdir)
134 logger.debug(1, "Running %s", fetchcmd) 135 logger.debug(1, "Running %s", fetchcmd)
136 bb.fetch2.check_network_access(d, fetchcmd)
135 runfetchcmd(fetchcmd, d) 137 runfetchcmd(fetchcmd, d)
136 138
137 # Even when we clone (fetch), we still need to update as hg's clone 139 # Even when we clone (fetch), we still need to update as hg's clone
@@ -165,6 +167,7 @@ class Hg(Fetch):
165 """ 167 """
166 Compute tip revision for the url 168 Compute tip revision for the url
167 """ 169 """
170 bb.fetch2.check_network_access(d, self._buildhgcommand(ud, d, "info"))
168 output = runfetchcmd(self._buildhgcommand(ud, d, "info"), d) 171 output = runfetchcmd(self._buildhgcommand(ud, d, "info"), d)
169 return output.strip() 172 return output.strip()
170 173
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):
92 # update sources there 92 # update sources there
93 os.chdir(ud.moddir) 93 os.chdir(ud.moddir)
94 logger.debug(1, "Running %s", oscupdatecmd) 94 logger.debug(1, "Running %s", oscupdatecmd)
95 bb.fetch2.check_network_access(d, oscupdatecmd)
95 runfetchcmd(oscupdatecmd, d) 96 runfetchcmd(oscupdatecmd, d)
96 else: 97 else:
97 oscfetchcmd = self._buildosccommand(ud, d, "fetch") 98 oscfetchcmd = self._buildosccommand(ud, d, "fetch")
@@ -100,6 +101,7 @@ class Osc(Fetch):
100 bb.mkdirhier(ud.pkgdir) 101 bb.mkdirhier(ud.pkgdir)
101 os.chdir(ud.pkgdir) 102 os.chdir(ud.pkgdir)
102 logger.debug(1, "Running %s", oscfetchcmd) 103 logger.debug(1, "Running %s", oscfetchcmd)
104 bb.fetch2.check_network_access(d, oscfetchcmd)
103 runfetchcmd(oscfetchcmd, d) 105 runfetchcmd(oscfetchcmd, d)
104 106
105 os.chdir(os.path.join(ud.pkgdir + ud.path)) 107 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):
74 bb.mkdirhier(os.path.join(codir, "repo")) 74 bb.mkdirhier(os.path.join(codir, "repo"))
75 os.chdir(os.path.join(codir, "repo")) 75 os.chdir(os.path.join(codir, "repo"))
76 if not os.path.exists(os.path.join(codir, "repo", ".repo")): 76 if not os.path.exists(os.path.join(codir, "repo", ".repo")):
77 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))
77 runfetchcmd("repo init -m %s -b %s -u %s://%s%s%s" % (ud.manifest, ud.branch, ud.proto, username, ud.host, ud.path), d) 78 runfetchcmd("repo init -m %s -b %s -u %s://%s%s%s" % (ud.manifest, ud.branch, ud.proto, username, ud.host, ud.path), d)
78 79
80 bb.fetch2.check_network_access(d, "repo sync %s" % ud.url)
79 runfetchcmd("repo sync", d) 81 runfetchcmd("repo sync", d)
80 os.chdir(codir) 82 os.chdir(codir)
81 83
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):
112 commands.mkarg(ldir) 112 commands.mkarg(ldir)
113 ) 113 )
114 114
115 bb.fetch2.check_network_access(d, cmd)
116
115 (exitstatus, output) = commands.getstatusoutput(cmd) 117 (exitstatus, output) = commands.getstatusoutput(cmd)
116 if exitstatus != 0: 118 if exitstatus != 0:
117 print(output) 119 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):
139 # update sources there 139 # update sources there
140 os.chdir(ud.moddir) 140 os.chdir(ud.moddir)
141 logger.debug(1, "Running %s", svnupdatecmd) 141 logger.debug(1, "Running %s", svnupdatecmd)
142 bb.fetch2.check_network_access(d, svnupdatecmd)
142 runfetchcmd(svnupdatecmd, d) 143 runfetchcmd(svnupdatecmd, d)
143 else: 144 else:
144 svnfetchcmd = self._buildsvncommand(ud, d, "fetch") 145 svnfetchcmd = self._buildsvncommand(ud, d, "fetch")
@@ -147,6 +148,7 @@ class Svn(Fetch):
147 bb.mkdirhier(ud.pkgdir) 148 bb.mkdirhier(ud.pkgdir)
148 os.chdir(ud.pkgdir) 149 os.chdir(ud.pkgdir)
149 logger.debug(1, "Running %s", svnfetchcmd) 150 logger.debug(1, "Running %s", svnfetchcmd)
151 bb.fetch2.check_network_access(d, svnfetchcmd)
150 runfetchcmd(svnfetchcmd, d) 152 runfetchcmd(svnfetchcmd, d)
151 153
152 scmdata = ud.parm.get("scmdata", "") 154 scmdata = ud.parm.get("scmdata", "")
@@ -180,7 +182,7 @@ class Svn(Fetch):
180 """ 182 """
181 Return the latest upstream revision number 183 Return the latest upstream revision number
182 """ 184 """
183 logger.debug(2, "SVN fetcher hitting network for %s", url) 185 bb.fetch2.check_network_access(d, self._buildsvncommand(ud, d, "info"))
184 186
185 output = runfetchcmd("LANG=C LC_ALL=C " + self._buildsvncommand(ud, d, "info"), d, True) 187 output = runfetchcmd("LANG=C LC_ALL=C " + self._buildsvncommand(ud, d, "info"), d, True)
186 188
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):
69 fetchcmd = fetchcmd.replace("${FILE}", ud.basename) 69 fetchcmd = fetchcmd.replace("${FILE}", ud.basename)
70 logger.info("fetch " + uri) 70 logger.info("fetch " + uri)
71 logger.debug(2, "executing " + fetchcmd) 71 logger.debug(2, "executing " + fetchcmd)
72 bb.fetch2.check_network_access(d, fetchcmd)
72 runfetchcmd(fetchcmd, d) 73 runfetchcmd(fetchcmd, d)
73 74
74 # Sanity check since wget can pretend it succeed when it didn't 75 # Sanity check since wget can pretend it succeed when it didn't