1
0
mirror of https://git.yoctoproject.org/poky synced 2026-06-02 01:19:52 +00:00

distrodata: Update to new fetcher API

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Richard Purdie
2011-02-07 10:23:01 +00:00
parent fbebb9a9cd
commit af6480bdde
+24 -35
View File
@@ -309,42 +309,31 @@ python do_checkpkg() {
""" """
def internal_fetch_wget(url, d, tmpf): def internal_fetch_wget(url, d, tmpf):
status = "ErrFetchUnknown" status = "ErrFetchUnknown"
try: """
""" Clear internal url cache as it's a temporary check. Not doing so will have
Clear internal url cache as it's a temporary check. Not doing so will have bitbake check url multiple times when looping through a single url
bitbake check url multiple times when looping through a single url """
""" fn = bb.data.getVar('FILE', d, 1)
fn = bb.data.getVar('FILE', d, 1) bb.fetch2.urldata_cache[fn] = {}
bb.fetch.urldata_cache[fn] = {}
bb.fetch.init([url], d) """
except bb.fetch.NoMethodError: To avoid impacting bitbake build engine, this trick is required for reusing bitbake
status = "ErrFetchNoMethod" interfaces. bb.fetch.go() is not appliable as it checks downloaded content in ${DL_DIR}
except: while we don't want to pollute that place. So bb.fetch2.checkstatus() is borrowed here
status = "ErrInitUrlUnknown" which is designed for check purpose but we override check command for our own purpose
else: """
""" ld = bb.data.createCopy(d)
To avoid impacting bitbake build engine, this trick is required for reusing bitbake bb.data.setVar('CHECKCOMMAND_wget', "/usr/bin/env wget -t 1 --passive-ftp -O %s --user-agent=\"Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.12) Gecko/20101027 Ubuntu/9.10 (karmic) Firefox/3.6.12\" '${URI}'" \
interfaces. bb.fetch.go() is not appliable as it checks downloaded content in ${DL_DIR} % tmpf.name, d)
while we don't want to pollute that place. So bb.fetch.checkstatus() is borrowed here bb.data.update_data(ld)
which is designed for check purpose but we override check command for our own purpose
""" try:
ld = bb.data.createCopy(d) fetcher = bb.fetch2.Fetch([url], ld)
bb.data.setVar('CHECKCOMMAND_wget', "/usr/bin/env wget -t 1 --passive-ftp -O %s --user-agent=\"Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.12) Gecko/20101027 Ubuntu/9.10 (karmic) Firefox/3.6.12\" '${URI}'" \ fetcher.checkstatus()
% tmpf.name, d) status = "SUCC"
bb.data.update_data(ld) except bb.fetch2.BBFetchException, e:
status = "ErrFetch"
try:
bb.fetch.checkstatus(ld)
except bb.fetch.MissingParameterError:
status = "ErrMissParam"
except bb.fetch.FetchError:
status = "ErrFetch"
except bb.fetch.MD5SumError:
status = "ErrMD5Sum"
except:
status = "ErrFetchUnknown"
else:
status = "SUCC"
return status return status
""" """