summaryrefslogtreecommitdiffstats
path: root/scripts/lib/recipetool/create.py
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2015-09-08 11:39:07 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-09-09 14:27:50 +0100
commitee0c11d9889cc5abbffbec512d7232416a6e6319 (patch)
treec280fb65d876c853af8fbf7def31ad196f54c775 /scripts/lib/recipetool/create.py
parent3690281efbd3770cc36aa6a65cf2e6999c7b9f9e (diff)
downloadpoky-ee0c11d9889cc5abbffbec512d7232416a6e6319.tar.gz
scriptutils: split out simple fetching function from recipetool
This will now also be used by "devtool upgrade". (From OE-Core rev: 0d0b8425eaf74a6d7f3d9f6471e6edca1a273c06) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/recipetool/create.py')
-rw-r--r--scripts/lib/recipetool/create.py30
1 files changed, 1 insertions, 29 deletions
diff --git a/scripts/lib/recipetool/create.py b/scripts/lib/recipetool/create.py
index ec6e107e62..c4754dbcdd 100644
--- a/scripts/lib/recipetool/create.py
+++ b/scripts/lib/recipetool/create.py
@@ -58,34 +58,6 @@ class RecipeHandler():
58 58
59 59
60 60
61def fetch_source(uri, destdir, srcrev):
62 import bb.data
63 bb.utils.mkdirhier(destdir)
64 localdata = bb.data.createCopy(tinfoil.config_data)
65 bb.data.update_data(localdata)
66 localdata.setVar('BB_STRICT_CHECKSUM', '')
67 localdata.setVar('SRCREV', srcrev)
68 ret = (None, None)
69 olddir = os.getcwd()
70 try:
71 fetcher = bb.fetch2.Fetch([uri], localdata)
72 for u in fetcher.ud:
73 ud = fetcher.ud[u]
74 ud.ignore_checksums = True
75 fetcher.download()
76 fetcher.unpack(destdir)
77 for u in fetcher.ud:
78 ud = fetcher.ud[u]
79 if ud.method.recommends_checksum(ud):
80 md5value = bb.utils.md5_file(ud.localpath)
81 sha256value = bb.utils.sha256_file(ud.localpath)
82 ret = (md5value, sha256value)
83 except bb.fetch2.BBFetchException, e:
84 raise bb.build.FuncFailed(e)
85 finally:
86 os.chdir(olddir)
87 return ret
88
89def supports_srcrev(uri): 61def supports_srcrev(uri):
90 localdata = bb.data.createCopy(tinfoil.config_data) 62 localdata = bb.data.createCopy(tinfoil.config_data)
91 # This is a bit sad, but if you don't have this set there can be some 63 # This is a bit sad, but if you don't have this set there can be some
@@ -123,7 +95,7 @@ def create_recipe(args):
123 tempsrc = tempfile.mkdtemp(prefix='recipetool-') 95 tempsrc = tempfile.mkdtemp(prefix='recipetool-')
124 srctree = tempsrc 96 srctree = tempsrc
125 logger.info('Fetching %s...' % srcuri) 97 logger.info('Fetching %s...' % srcuri)
126 checksums = fetch_source(args.source, srctree, srcrev) 98 checksums = scriptutils.fetch_uri(tinfoil.config_data, args.source, srctree, srcrev)
127 dirlist = os.listdir(srctree) 99 dirlist = os.listdir(srctree)
128 if 'git.indirectionsymlink' in dirlist: 100 if 'git.indirectionsymlink' in dirlist:
129 dirlist.remove('git.indirectionsymlink') 101 dirlist.remove('git.indirectionsymlink')