diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2016-12-13 20:09:36 +1300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-12-14 12:30:49 +0000 |
commit | 70ce5952373cedc1620a9c2d1e1348ab972124cb (patch) | |
tree | a2a5aaf4c01f7ef569829de29be8faa45c28cffd /scripts | |
parent | 1f8cf63f8affcf6c881c7842ef38b82b8781d2eb (diff) | |
download | poky-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')
-rw-r--r-- | scripts/lib/devtool/__init__.py | 26 | ||||
-rw-r--r-- | scripts/lib/devtool/deploy.py | 2 | ||||
-rw-r--r-- | scripts/lib/devtool/standard.py | 2 | ||||
-rw-r--r-- | scripts/lib/devtool/upgrade.py | 2 | ||||
-rw-r--r-- | scripts/lib/recipetool/append.py | 21 | ||||
-rw-r--r-- | scripts/lib/recipetool/newappend.py | 14 | ||||
-rw-r--r-- | scripts/lib/recipetool/setvar.py | 2 |
7 files changed, 16 insertions, 53 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 | ||
123 | def 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 | |||
135 | def parse_recipe(config, tinfoil, pn, appends, filter_workspace=True): | 123 | def 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 | ||
152 | def check_workspace_recipe(workspace, pn, checksrc=True, bbclassextend=False): | 140 | def 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 |
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 | ||
100 | def _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 | |||
111 | def _parse_recipe(pn, tinfoil): | 100 | def _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 | ||
121 | def determine_file_source(targetpath, rd): | 108 | def 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 | ||
42 | def _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 | |||
54 | def layer(layerpath): | 42 | def 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): | |||
60 | def newappend(args): | 48 | def 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) |