diff options
author | Yu Ke <ke.yu@intel.com> | 2011-01-24 14:58:26 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-01-25 12:32:49 +0000 |
commit | 098e8ded339f3bf864f3bad9871028176f70b12b (patch) | |
tree | 6d5dc51856d06aed9e93516cdb1d66e8ce6c87c0 /bitbake/lib | |
parent | 733de7596c2ed78a846541b3290f01c21ff96606 (diff) | |
download | poky-098e8ded339f3bf864f3bad9871028176f70b12b.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
Signed-off-by: Yu Ke <ke.yu@intel.com>
Diffstat (limited to 'bitbake/lib')
-rw-r--r-- | bitbake/lib/bb/fetch2/__init__.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py index 886d49afa2..9fe4eb2c02 100644 --- a/bitbake/lib/bb/fetch2/__init__.py +++ b/bitbake/lib/bb/fetch2/__init__.py | |||
@@ -469,6 +469,16 @@ def runfetchcmd(cmd, d, quiet = False): | |||
469 | 469 | ||
470 | return output | 470 | return output |
471 | 471 | ||
472 | def check_network_access(d, info = ""): | ||
473 | """ | ||
474 | log remote network access, and error if BB_NO_NETWORK is set | ||
475 | """ | ||
476 | if bb.data.getVar("BB_NO_NETWORK", d, True) == "1": | ||
477 | bb.error("BB_NO_NETWORK is set, but the fetcher code attempted network access with the command %s" % info) | ||
478 | raise FetchError("BB_NO_NETWORK violation") | ||
479 | else: | ||
480 | bb.note("Fetcher accessed the network with the command %s" % info) | ||
481 | |||
472 | def try_mirrors(d, uri, mirrors, check = False, force = False): | 482 | def try_mirrors(d, uri, mirrors, check = False, force = False): |
473 | """ | 483 | """ |
474 | Try to use a mirrored version of the sources. | 484 | Try to use a mirrored version of the sources. |