fetch2: Unify BB_FETCH_PREMIRRORONLY
PATCH v2 2/2 fetch2: Use bb.utils.to_boolean() for BB_NO_NETWORK
In reply to Robert YangMake it consistent with BB_FETCH_PREMIRRORONLY.
--- bitbake/lib/bb/fetch2/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
bitbake/lib/bb/fetch2/__init__.py +2 -2
@@ -898,7 +898,7 @@ def check_network_access(d, info, url): log remote network access, and error if BB_NO_NETWORK is set or the given URI is untrusted """ - if d.getVar("BB_NO_NETWORK") == "1": + if bb.utils.to_boolean(d.getVar("BB_NO_NETWORK")): raise NetworkAccess(url, info) elif not trusted_network(d, url): raise UntrustedUrl(url, info)
@@ -1098,7 +1098,7 @@ def trusted_network(d, url): BB_ALLOWED_NETWORKS is set globally or for a specific recipe. Note: modifies SRC_URI & mirrors. """ - if d.getVar('BB_NO_NETWORK') == "1": + if bb.utils.to_boolean(d.getVar("BB_NO_NETWORK")): return True pkgname = d.expand(d.getVar('PN', False))
Signature · 1 line
2.7.4
v2 cover fetch2: Unify BB_FETCH_PREMIRRORONLY
* V2
- Use bb.utils.to_boolean() for BB_FETCH_PREMIRRORONLY as RP suggested.
- Use bb.utils.to_boolean() for BB_NO_NETWORK.
- We also need use bb.utils.to_boolean() for oe-core's BB_NO_NETWORK, will fix it later.
* V1
- Initial version
The following changes since commit acc242c7ec20a74e1afcc2420f5e2981e843b0df:
bitbake: fetch2: Print SCMs list when SRCREV_FORMAT is not set (2019-03-24 17:01:34 +0000)
are available in the git repository at:
git://git.pokylinux.org/poky-contrib rbt/premirror
http://git.pokylinux.org/cgit.cgi//log/?h=rbt/premirror
Robert Yang (2):
fetch2: Unify BB_FETCH_PREMIRRORONLY
fetch2: Use bb.utils.to_boolean() for BB_NO_NETWORK
bitbake/lib/bb/fetch2/__init__.py | 6 +++--- bitbake/lib/bb/fetch2/git.py | 2 +- bitbake/lib/bb/fetch2/hg.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-)
Signature · 1 line
2.7.4
PATCH v2 1/2 fetch2: Unify BB_FETCH_PREMIRRORONLY
The fetch2/__init__.py checks whether "BB_FETCH_PREMIRRORONLY" == "1", but fetch2/git.py and hg.py checks whether it is None, this makes it discontinuous, and BB_FETCH_PREMIRRORONLY = "0" doens't work as expected in the later case, so unify it to the previous one. (As BB_NO_NETWORK does).
And also use bb.utils.to_boolean() to make them consistent.
--- bitbake/lib/bb/fetch2/__init__.py | 2 +- bitbake/lib/bb/fetch2/git.py | 2 +- bitbake/lib/bb/fetch2/hg.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
bitbake/lib/bb/fetch2/__init__.py +1 -1
@@ -1642,7 +1642,7 @@ class Fetch(object): urls = self.urls network = self.d.getVar("BB_NO_NETWORK") - premirroronly = (self.d.getVar("BB_FETCH_PREMIRRORONLY") == "1") + premirroronly = bb.utils.to_boolean(self.d.getVar("BB_FETCH_PREMIRRORONLY")) for u in urls: ud = self.ud[u]
bitbake/lib/bb/fetch2/git.py +1 -1
@@ -318,7 +318,7 @@ class Git(FetchMethod): def try_premirror(self, ud, d): # If we don't do this, updating an existing checkout with only premirrors # is not possible - if d.getVar("BB_FETCH_PREMIRRORONLY") is not None: + if bb.utils.to_boolean(d.getVar("BB_FETCH_PREMIRRORONLY")): return True if os.path.exists(ud.clonedir): return False
bitbake/lib/bb/fetch2/hg.py +1 -1
@@ -99,7 +99,7 @@ class Hg(FetchMethod): def try_premirror(self, ud, d): # If we don't do this, updating an existing checkout with only premirrors # is not possible - if d.getVar("BB_FETCH_PREMIRRORONLY") is not None: + if bb.utils.to_boolean(d.getVar("BB_FETCH_PREMIRRORONLY")): return True if os.path.exists(ud.moddir): return False
Signature · 1 line
2.7.4