diff options
author | Yu Ke <ke.yu@intel.com> | 2011-01-24 14:58:26 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-02-10 23:36:44 +0000 |
commit | a605deb12ace4c7abdf72bbcdfb59d9fc3569801 (patch) | |
tree | 448743ddf6a44d0fd433327e65a80576af56feb4 | |
parent | cd3705347a72fe869c955e0ab4111b6bdad913c9 (diff) | |
download | bitbake-a605deb12ace4c7abdf72bbcdfb59d9fc3569801.tar.gz |
bb.fetch2: add "BB_NO_NETWORK" option
Sometime user want a purely local fetching, i.e. using local mirror without
any remote netowrk access. BB_NO_NETWORK option is introduced for this purpose
check_network_access() is the guard for BB_NO_NETWOKR option. it should be
put in any place that fetcher use network access
(From Poky rev: 098e8ded339f3bf864f3bad9871028176f70b12b)
Signed-off-by: Yu Ke <ke.yu@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | lib/bb/fetch2/__init__.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/bb/fetch2/__init__.py b/lib/bb/fetch2/__init__.py index 886d49afa..9fe4eb2c0 100644 --- a/lib/bb/fetch2/__init__.py +++ b/lib/bb/fetch2/__init__.py @@ -469,6 +469,16 @@ def runfetchcmd(cmd, d, quiet = False): return output +def check_network_access(d, info = ""): + """ + log remote network access, and error if BB_NO_NETWORK is set + """ + if bb.data.getVar("BB_NO_NETWORK", d, True) == "1": + bb.error("BB_NO_NETWORK is set, but the fetcher code attempted network access with the command %s" % info) + raise FetchError("BB_NO_NETWORK violation") + else: + bb.note("Fetcher accessed the network with the command %s" % info) + def try_mirrors(d, uri, mirrors, check = False, force = False): """ Try to use a mirrored version of the sources. |