From af6480bdde2e2e3709d219f9ca43d7c0938314b6 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Mon, 7 Feb 2011 10:23:01 +0000 Subject: distrodata: Update to new fetcher API Signed-off-by: Richard Purdie --- meta/classes/distrodata.bbclass | 59 +++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 35 deletions(-) (limited to 'meta/classes/distrodata.bbclass') diff --git a/meta/classes/distrodata.bbclass b/meta/classes/distrodata.bbclass index 868f65685b..31e7420cf4 100644 --- a/meta/classes/distrodata.bbclass +++ b/meta/classes/distrodata.bbclass @@ -309,42 +309,31 @@ python do_checkpkg() { """ def internal_fetch_wget(url, d, tmpf): status = "ErrFetchUnknown" - try: - """ - 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 - """ - fn = bb.data.getVar('FILE', d, 1) - bb.fetch.urldata_cache[fn] = {} - bb.fetch.init([url], d) - except bb.fetch.NoMethodError: - status = "ErrFetchNoMethod" - except: - status = "ErrInitUrlUnknown" - else: - """ - To avoid impacting bitbake build engine, this trick is required for reusing bitbake - interfaces. bb.fetch.go() is not appliable as it checks downloaded content in ${DL_DIR} - while we don't want to pollute that place. So bb.fetch.checkstatus() is borrowed here - which is designed for check purpose but we override check command for our own purpose - """ - ld = bb.data.createCopy(d) - 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}'" \ + """ + 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 + """ + fn = bb.data.getVar('FILE', d, 1) + bb.fetch2.urldata_cache[fn] = {} + + """ + To avoid impacting bitbake build engine, this trick is required for reusing bitbake + interfaces. bb.fetch.go() is not appliable as it checks downloaded content in ${DL_DIR} + while we don't want to pollute that place. So bb.fetch2.checkstatus() is borrowed here + which is designed for check purpose but we override check command for our own purpose + """ + ld = bb.data.createCopy(d) + 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}'" \ % tmpf.name, d) - bb.data.update_data(ld) - - 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" + bb.data.update_data(ld) + + try: + fetcher = bb.fetch2.Fetch([url], ld) + fetcher.checkstatus() + status = "SUCC" + except bb.fetch2.BBFetchException, e: + status = "ErrFetch" + return status """ -- cgit v1.2.3-54-g00ecf