summaryrefslogtreecommitdiffstats
path: root/scripts/lib/devtool
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2016-12-13 20:09:36 +1300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-12-14 12:30:49 +0000
commit70ce5952373cedc1620a9c2d1e1348ab972124cb (patch)
treea2a5aaf4c01f7ef569829de29be8faa45c28cffd /scripts/lib/devtool
parent1f8cf63f8affcf6c881c7842ef38b82b8781d2eb (diff)
downloadpoky-70ce5952373cedc1620a9c2d1e1348ab972124cb.tar.gz
devtool / recipetool: use tinfoil parsing API
Use Tinfoil.parse_recipe_file() and Tinfoil.parse_recipe() instead of the recipeutils equivalents, and replace any local duplicate implementations. This not only tidies up the code but also allows these calls to work in memres mode. (From OE-Core rev: f13b56266ee96dfab65a3a7db50e8051aa9f071a) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/devtool')
-rw-r--r--scripts/lib/devtool/__init__.py26
-rw-r--r--scripts/lib/devtool/deploy.py2
-rw-r--r--scripts/lib/devtool/standard.py2
-rw-r--r--scripts/lib/devtool/upgrade.py2
4 files changed, 10 insertions, 22 deletions
diff --git a/scripts/lib/devtool/__init__.py b/scripts/lib/devtool/__init__.py
index 31ecb65937..99c5534893 100644
--- a/scripts/lib/devtool/__init__.py
+++ b/scripts/lib/devtool/__init__.py
@@ -120,34 +120,22 @@ def setup_tinfoil(config_only=False, basepath=None, tracking=False):
120 os.chdir(orig_cwd) 120 os.chdir(orig_cwd)
121 return tinfoil 121 return tinfoil
122 122
123def get_recipe_file(cooker, pn):
124 """Find recipe file corresponding a package name"""
125 import oe.recipeutils
126 recipefile = oe.recipeutils.pn_to_recipe(cooker, pn)
127 if not recipefile:
128 skipreasons = oe.recipeutils.get_unavailable_reasons(cooker, pn)
129 if skipreasons:
130 logger.error('\n'.join(skipreasons))
131 else:
132 logger.error("Unable to find any recipe file matching %s" % pn)
133 return recipefile
134
135def parse_recipe(config, tinfoil, pn, appends, filter_workspace=True): 123def parse_recipe(config, tinfoil, pn, appends, filter_workspace=True):
136 """Parse recipe of a package""" 124 """Parse the specified recipe"""
137 import oe.recipeutils 125 try:
138 recipefile = get_recipe_file(tinfoil.cooker, pn) 126 recipefile = tinfoil.get_recipe_file(pn)
139 if not recipefile: 127 except bb.providers.NoProvider as e:
140 # Error already logged 128 logger.error(str(e))
141 return None 129 return None
142 if appends: 130 if appends:
143 append_files = tinfoil.cooker.collection.get_file_appends(recipefile) 131 append_files = tinfoil.get_file_appends(recipefile)
144 if filter_workspace: 132 if filter_workspace:
145 # Filter out appends from the workspace 133 # Filter out appends from the workspace
146 append_files = [path for path in append_files if 134 append_files = [path for path in append_files if
147 not path.startswith(config.workspace_path)] 135 not path.startswith(config.workspace_path)]
148 else: 136 else:
149 append_files = None 137 append_files = None
150 return oe.recipeutils.parse_recipe(tinfoil.cooker, recipefile, append_files) 138 return tinfoil.parse_recipe_file(recipefile, appends, append_files)
151 139
152def check_workspace_recipe(workspace, pn, checksrc=True, bbclassextend=False): 140def check_workspace_recipe(workspace, pn, checksrc=True, bbclassextend=False):
153 """ 141 """
diff --git a/scripts/lib/devtool/deploy.py b/scripts/lib/devtool/deploy.py
index c4c7bf6c73..db7dffa307 100644
--- a/scripts/lib/devtool/deploy.py
+++ b/scripts/lib/devtool/deploy.py
@@ -156,7 +156,7 @@ def deploy(args, config, basepath, workspace):
156 tinfoil = setup_tinfoil(basepath=basepath) 156 tinfoil = setup_tinfoil(basepath=basepath)
157 try: 157 try:
158 try: 158 try:
159 rd = oe.recipeutils.parse_recipe_simple(tinfoil.cooker, args.recipename, tinfoil.config_data) 159 rd = tinfoil.parse_recipe(args.recipename)
160 except Exception as e: 160 except Exception as e:
161 raise DevtoolError('Exception parsing recipe %s: %s' % 161 raise DevtoolError('Exception parsing recipe %s: %s' %
162 (args.recipename, e)) 162 (args.recipename, e))
diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py
index e4d2a57ab6..87d3f5dc04 100644
--- a/scripts/lib/devtool/standard.py
+++ b/scripts/lib/devtool/standard.py
@@ -224,7 +224,7 @@ def add(args, config, basepath, workspace):
224 224
225 tinfoil = setup_tinfoil(config_only=True, basepath=basepath) 225 tinfoil = setup_tinfoil(config_only=True, basepath=basepath)
226 try: 226 try:
227 rd = oe.recipeutils.parse_recipe(tinfoil.cooker, recipefile, None) 227 rd = tinfoil.parse_recipe_file(recipefile, False)
228 if not rd: 228 if not rd:
229 return 1 229 return 1
230 230
diff --git a/scripts/lib/devtool/upgrade.py b/scripts/lib/devtool/upgrade.py
index a4239f1cd2..52f9ab1a01 100644
--- a/scripts/lib/devtool/upgrade.py
+++ b/scripts/lib/devtool/upgrade.py
@@ -320,7 +320,7 @@ def _create_new_recipe(newpv, md5, sha256, srcrev, srcbranch, workspace, tinfoil
320 newvalues['SRC_URI[md5sum]'] = md5 320 newvalues['SRC_URI[md5sum]'] = md5
321 newvalues['SRC_URI[sha256sum]'] = sha256 321 newvalues['SRC_URI[sha256sum]'] = sha256
322 322
323 rd = oe.recipeutils.parse_recipe(tinfoil.cooker, fullpath, None) 323 rd = tinfoil.parse_recipe_file(fullpath, False)
324 oe.recipeutils.patch_recipe(rd, fullpath, newvalues) 324 oe.recipeutils.patch_recipe(rd, fullpath, newvalues)
325 325
326 return fullpath, copied 326 return fullpath, copied