summaryrefslogtreecommitdiffstats
path: root/scripts/lib/recipetool
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/recipetool
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/recipetool')
-rw-r--r--scripts/lib/recipetool/append.py21
-rw-r--r--scripts/lib/recipetool/newappend.py14
-rw-r--r--scripts/lib/recipetool/setvar.py2
3 files changed, 6 insertions, 31 deletions
diff --git a/scripts/lib/recipetool/append.py b/scripts/lib/recipetool/append.py
index 1e0fc1ee85..3e85a0cb0f 100644
--- a/scripts/lib/recipetool/append.py
+++ b/scripts/lib/recipetool/append.py
@@ -97,25 +97,12 @@ def find_target_file(targetpath, d, pkglist=None):
97 recipes[targetpath].append('!%s' % pn) 97 recipes[targetpath].append('!%s' % pn)
98 return recipes 98 return recipes
99 99
100def _get_recipe_file(cooker, pn):
101 import oe.recipeutils
102 recipefile = oe.recipeutils.pn_to_recipe(cooker, pn)
103 if not recipefile:
104 skipreasons = oe.recipeutils.get_unavailable_reasons(cooker, pn)
105 if skipreasons:
106 logger.error('\n'.join(skipreasons))
107 else:
108 logger.error("Unable to find any recipe file matching %s" % pn)
109 return recipefile
110
111def _parse_recipe(pn, tinfoil): 100def _parse_recipe(pn, tinfoil):
112 import oe.recipeutils 101 try:
113 recipefile = _get_recipe_file(tinfoil.cooker, pn) 102 rd = tinfoil.parse_recipe(pn)
114 if not recipefile: 103 except bb.providers.NoProvider as e:
115 # Error already logged 104 logger.error(str(e))
116 return None 105 return None
117 append_files = tinfoil.cooker.collection.get_file_appends(recipefile)
118 rd = oe.recipeutils.parse_recipe(tinfoil.cooker, recipefile, append_files)
119 return rd 106 return rd
120 107
121def determine_file_source(targetpath, rd): 108def determine_file_source(targetpath, rd):
diff --git a/scripts/lib/recipetool/newappend.py b/scripts/lib/recipetool/newappend.py
index fbdd7bcef5..376084035f 100644
--- a/scripts/lib/recipetool/newappend.py
+++ b/scripts/lib/recipetool/newappend.py
@@ -39,18 +39,6 @@ def tinfoil_init(instance):
39 tinfoil = instance 39 tinfoil = instance
40 40
41 41
42def _get_recipe_file(cooker, pn):
43 import oe.recipeutils
44 recipefile = oe.recipeutils.pn_to_recipe(cooker, pn)
45 if not recipefile:
46 skipreasons = oe.recipeutils.get_unavailable_reasons(cooker, pn)
47 if skipreasons:
48 logger.error('\n'.join(skipreasons))
49 else:
50 logger.error("Unable to find any recipe file matching %s" % pn)
51 return recipefile
52
53
54def layer(layerpath): 42def layer(layerpath):
55 if not os.path.exists(os.path.join(layerpath, 'conf', 'layer.conf')): 43 if not os.path.exists(os.path.join(layerpath, 'conf', 'layer.conf')):
56 raise argparse.ArgumentTypeError('{0!r} must be a path to a valid layer'.format(layerpath)) 44 raise argparse.ArgumentTypeError('{0!r} must be a path to a valid layer'.format(layerpath))
@@ -60,7 +48,7 @@ def layer(layerpath):
60def newappend(args): 48def newappend(args):
61 import oe.recipeutils 49 import oe.recipeutils
62 50
63 recipe_path = _get_recipe_file(tinfoil.cooker, args.target) 51 recipe_path = tinfoil.get_recipe_file(args.target)
64 52
65 rd = tinfoil.config_data.createCopy() 53 rd = tinfoil.config_data.createCopy()
66 rd.setVar('FILE', recipe_path) 54 rd.setVar('FILE', recipe_path)
diff --git a/scripts/lib/recipetool/setvar.py b/scripts/lib/recipetool/setvar.py
index 85701c06a9..9de315a0ef 100644
--- a/scripts/lib/recipetool/setvar.py
+++ b/scripts/lib/recipetool/setvar.py
@@ -51,7 +51,7 @@ def setvar(args):
51 if args.recipe_only: 51 if args.recipe_only:
52 patches = [oe.recipeutils.patch_recipe_file(args.recipefile, varvalues, patch=args.patch)] 52 patches = [oe.recipeutils.patch_recipe_file(args.recipefile, varvalues, patch=args.patch)]
53 else: 53 else:
54 rd = oe.recipeutils.parse_recipe(tinfoil.cooker, args.recipefile, None) 54 rd = tinfoil.parse_recipe_file(args.recipefile, False)
55 if not rd: 55 if not rd:
56 return 1 56 return 1
57 patches = oe.recipeutils.patch_recipe(rd, args.recipefile, varvalues, patch=args.patch) 57 patches = oe.recipeutils.patch_recipe(rd, args.recipefile, varvalues, patch=args.patch)