diff options
author | Joshua Watt <jpewhacker@gmail.com> | 2021-02-19 20:37:00 -0600 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-02-21 22:02:01 +0000 |
commit | 40f5a289d5f3fd8b1d0f3ee1544531b85f5ab350 (patch) | |
tree | 682b115929d4f7327289826cfcc9604d12f181a0 /bitbake/lib | |
parent | 90e5cce0e31ed40c17b6cfed46945c8536c99ee3 (diff) | |
download | poky-40f5a289d5f3fd8b1d0f3ee1544531b85f5ab350.tar.gz |
bitbake: event: Fix broken builds when multiconfig has a hyphen in the name
5f7fdf7b2d ("bitbake: event: Prevent bitbake from executing event
handler for wrong multiconfig target") broke multiconfig builds contain
a hyphen, since it's attempt to use the multiconfig as part of a
function name and python functions are not allowed to contain a hyphen.
Rework the bitbake multiconfig test to test a multiconfig with a hyphen
and one with an underscore to validate this doesn't break in the future.
(Bitbake rev: c3168df330a4563cbd03ba74de55a22217d823ed)
Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib')
-rw-r--r-- | bitbake/lib/bb/event.py | 4 | ||||
-rw-r--r-- | bitbake/lib/bb/tests/runqueue-tests/conf/multiconfig/mc-1.conf (renamed from bitbake/lib/bb/tests/runqueue-tests/conf/multiconfig/mc1.conf) | 0 | ||||
-rw-r--r-- | bitbake/lib/bb/tests/runqueue-tests/conf/multiconfig/mc_2.conf (renamed from bitbake/lib/bb/tests/runqueue-tests/conf/multiconfig/mc2.conf) | 0 | ||||
-rw-r--r-- | bitbake/lib/bb/tests/runqueue-tests/recipes/f1.bb | 2 | ||||
-rw-r--r-- | bitbake/lib/bb/tests/runqueue-tests/recipes/fails-mc/fails-mc1.bb | 4 | ||||
-rw-r--r-- | bitbake/lib/bb/tests/runqueue-tests/recipes/fails-mc/fails-mc2.bb | 4 | ||||
-rw-r--r-- | bitbake/lib/bb/tests/runqueue.py | 38 |
7 files changed, 26 insertions, 26 deletions
diff --git a/bitbake/lib/bb/event.py b/bitbake/lib/bb/event.py index ff89959460..23e1f3187b 100644 --- a/bitbake/lib/bb/event.py +++ b/bitbake/lib/bb/event.py | |||
@@ -234,7 +234,7 @@ def register(name, handler, mask=None, filename=None, lineno=None, data=None): | |||
234 | 234 | ||
235 | if data and data.getVar("BB_CURRENT_MC"): | 235 | if data and data.getVar("BB_CURRENT_MC"): |
236 | mc = data.getVar("BB_CURRENT_MC") | 236 | mc = data.getVar("BB_CURRENT_MC") |
237 | name = '%s%s' % (mc, name) | 237 | name = '%s%s' % (mc.replace('-', '_'), name) |
238 | 238 | ||
239 | # already registered | 239 | # already registered |
240 | if name in _handlers: | 240 | if name in _handlers: |
@@ -286,7 +286,7 @@ def remove(name, handler, data=None): | |||
286 | if data: | 286 | if data: |
287 | if data.getVar("BB_CURRENT_MC"): | 287 | if data.getVar("BB_CURRENT_MC"): |
288 | mc = data.getVar("BB_CURRENT_MC") | 288 | mc = data.getVar("BB_CURRENT_MC") |
289 | name = '%s%s' % (mc, name) | 289 | name = '%s%s' % (mc.replace('-', '_'), name) |
290 | 290 | ||
291 | _handlers.pop(name) | 291 | _handlers.pop(name) |
292 | if name in _catchall_handlers: | 292 | if name in _catchall_handlers: |
diff --git a/bitbake/lib/bb/tests/runqueue-tests/conf/multiconfig/mc1.conf b/bitbake/lib/bb/tests/runqueue-tests/conf/multiconfig/mc-1.conf index f34b8dcccf..f34b8dcccf 100644 --- a/bitbake/lib/bb/tests/runqueue-tests/conf/multiconfig/mc1.conf +++ b/bitbake/lib/bb/tests/runqueue-tests/conf/multiconfig/mc-1.conf | |||
diff --git a/bitbake/lib/bb/tests/runqueue-tests/conf/multiconfig/mc2.conf b/bitbake/lib/bb/tests/runqueue-tests/conf/multiconfig/mc_2.conf index c3360fc5c8..c3360fc5c8 100644 --- a/bitbake/lib/bb/tests/runqueue-tests/conf/multiconfig/mc2.conf +++ b/bitbake/lib/bb/tests/runqueue-tests/conf/multiconfig/mc_2.conf | |||
diff --git a/bitbake/lib/bb/tests/runqueue-tests/recipes/f1.bb b/bitbake/lib/bb/tests/runqueue-tests/recipes/f1.bb index d45a4cff52..7b8fc592ab 100644 --- a/bitbake/lib/bb/tests/runqueue-tests/recipes/f1.bb +++ b/bitbake/lib/bb/tests/runqueue-tests/recipes/f1.bb | |||
@@ -1 +1 @@ | |||
do_install[mcdepends] = "mc:mc1:mc2:a1:do_build" | do_install[mcdepends] = "mc:mc-1:mc_2:a1:do_build" | ||
diff --git a/bitbake/lib/bb/tests/runqueue-tests/recipes/fails-mc/fails-mc1.bb b/bitbake/lib/bb/tests/runqueue-tests/recipes/fails-mc/fails-mc1.bb index 17a181fffb..eed69c805a 100644 --- a/bitbake/lib/bb/tests/runqueue-tests/recipes/fails-mc/fails-mc1.bb +++ b/bitbake/lib/bb/tests/runqueue-tests/recipes/fails-mc/fails-mc1.bb | |||
@@ -1,5 +1,5 @@ | |||
1 | python () { | 1 | python () { |
2 | if d.getVar("BB_CURRENT_MC") == "mc1": | 2 | if d.getVar("BB_CURRENT_MC") == "mc-1": |
3 | bb.fatal("Multiconfig is mc1") | 3 | bb.fatal("Multiconfig is mc-1") |
4 | } | 4 | } |
5 | 5 | ||
diff --git a/bitbake/lib/bb/tests/runqueue-tests/recipes/fails-mc/fails-mc2.bb b/bitbake/lib/bb/tests/runqueue-tests/recipes/fails-mc/fails-mc2.bb index cc69e7b82d..3c172ef974 100644 --- a/bitbake/lib/bb/tests/runqueue-tests/recipes/fails-mc/fails-mc2.bb +++ b/bitbake/lib/bb/tests/runqueue-tests/recipes/fails-mc/fails-mc2.bb | |||
@@ -1,4 +1,4 @@ | |||
1 | python () { | 1 | python () { |
2 | if d.getVar("BB_CURRENT_MC") == "mc2": | 2 | if d.getVar("BB_CURRENT_MC") == "mc_2": |
3 | bb.fatal("Multiconfig is mc2") | 3 | bb.fatal("Multiconfig is mc_2") |
4 | } | 4 | } |
diff --git a/bitbake/lib/bb/tests/runqueue.py b/bitbake/lib/bb/tests/runqueue.py index d3d62b98f9..3d51779d6c 100644 --- a/bitbake/lib/bb/tests/runqueue.py +++ b/bitbake/lib/bb/tests/runqueue.py | |||
@@ -216,66 +216,66 @@ class RunQueueTests(unittest.TestCase): | |||
216 | def test_multiconfig_setscene_optimise(self): | 216 | def test_multiconfig_setscene_optimise(self): |
217 | with tempfile.TemporaryDirectory(prefix="runqueuetest") as tempdir: | 217 | with tempfile.TemporaryDirectory(prefix="runqueuetest") as tempdir: |
218 | extraenv = { | 218 | extraenv = { |
219 | "BBMULTICONFIG" : "mc1 mc2", | 219 | "BBMULTICONFIG" : "mc-1 mc_2", |
220 | "BB_SIGNATURE_HANDLER" : "basic" | 220 | "BB_SIGNATURE_HANDLER" : "basic" |
221 | } | 221 | } |
222 | cmd = ["bitbake", "b1", "mc:mc1:b1", "mc:mc2:b1"] | 222 | cmd = ["bitbake", "b1", "mc:mc-1:b1", "mc:mc_2:b1"] |
223 | setscenetasks = ['package_write_ipk_setscene', 'package_write_rpm_setscene', 'packagedata_setscene', | 223 | setscenetasks = ['package_write_ipk_setscene', 'package_write_rpm_setscene', 'packagedata_setscene', |
224 | 'populate_sysroot_setscene', 'package_qa_setscene'] | 224 | 'populate_sysroot_setscene', 'package_qa_setscene'] |
225 | sstatevalid = "" | 225 | sstatevalid = "" |
226 | tasks = self.run_bitbakecmd(cmd, tempdir, sstatevalid, extraenv=extraenv) | 226 | tasks = self.run_bitbakecmd(cmd, tempdir, sstatevalid, extraenv=extraenv) |
227 | expected = ['a1:' + x for x in self.alltasks] + ['b1:' + x for x in self.alltasks] + \ | 227 | expected = ['a1:' + x for x in self.alltasks] + ['b1:' + x for x in self.alltasks] + \ |
228 | ['mc1:b1:' + x for x in setscenetasks] + ['mc1:a1:' + x for x in setscenetasks] + \ | 228 | ['mc-1:b1:' + x for x in setscenetasks] + ['mc-1:a1:' + x for x in setscenetasks] + \ |
229 | ['mc2:b1:' + x for x in setscenetasks] + ['mc2:a1:' + x for x in setscenetasks] + \ | 229 | ['mc_2:b1:' + x for x in setscenetasks] + ['mc_2:a1:' + x for x in setscenetasks] + \ |
230 | ['mc1:b1:build', 'mc2:b1:build'] | 230 | ['mc-1:b1:build', 'mc_2:b1:build'] |
231 | for x in ['mc1:a1:package_qa_setscene', 'mc2:a1:package_qa_setscene', 'a1:build', 'a1:package_qa']: | 231 | for x in ['mc-1:a1:package_qa_setscene', 'mc_2:a1:package_qa_setscene', 'a1:build', 'a1:package_qa']: |
232 | expected.remove(x) | 232 | expected.remove(x) |
233 | self.assertEqual(set(tasks), set(expected)) | 233 | self.assertEqual(set(tasks), set(expected)) |
234 | 234 | ||
235 | def test_multiconfig_bbmask(self): | 235 | def test_multiconfig_bbmask(self): |
236 | # This test validates that multiconfigs can independently mask off | 236 | # This test validates that multiconfigs can independently mask off |
237 | # recipes they do not want with BBMASK. It works by having recipes | 237 | # recipes they do not want with BBMASK. It works by having recipes |
238 | # that will fail to parse for mc1 and mc2, then making each multiconfig | 238 | # that will fail to parse for mc-1 and mc_2, then making each multiconfig |
239 | # build the one that does parse. This ensures that the recipes are in | 239 | # build the one that does parse. This ensures that the recipes are in |
240 | # each multiconfigs BBFILES, but each is masking only the one that | 240 | # each multiconfigs BBFILES, but each is masking only the one that |
241 | # doesn't parse | 241 | # doesn't parse |
242 | with tempfile.TemporaryDirectory(prefix="runqueuetest") as tempdir: | 242 | with tempfile.TemporaryDirectory(prefix="runqueuetest") as tempdir: |
243 | extraenv = { | 243 | extraenv = { |
244 | "BBMULTICONFIG" : "mc1 mc2", | 244 | "BBMULTICONFIG" : "mc-1 mc_2", |
245 | "BB_SIGNATURE_HANDLER" : "basic", | 245 | "BB_SIGNATURE_HANDLER" : "basic", |
246 | "EXTRA_BBFILES": "${COREBASE}/recipes/fails-mc/*.bb", | 246 | "EXTRA_BBFILES": "${COREBASE}/recipes/fails-mc/*.bb", |
247 | } | 247 | } |
248 | cmd = ["bitbake", "mc:mc1:fails-mc2", "mc:mc2:fails-mc1"] | 248 | cmd = ["bitbake", "mc:mc-1:fails-mc2", "mc:mc_2:fails-mc1"] |
249 | self.run_bitbakecmd(cmd, tempdir, "", extraenv=extraenv) | 249 | self.run_bitbakecmd(cmd, tempdir, "", extraenv=extraenv) |
250 | 250 | ||
251 | def test_multiconfig_mcdepends(self): | 251 | def test_multiconfig_mcdepends(self): |
252 | with tempfile.TemporaryDirectory(prefix="runqueuetest") as tempdir: | 252 | with tempfile.TemporaryDirectory(prefix="runqueuetest") as tempdir: |
253 | extraenv = { | 253 | extraenv = { |
254 | "BBMULTICONFIG" : "mc1 mc2", | 254 | "BBMULTICONFIG" : "mc-1 mc_2", |
255 | "BB_SIGNATURE_HANDLER" : "TestMulticonfigDepends", | 255 | "BB_SIGNATURE_HANDLER" : "TestMulticonfigDepends", |
256 | "EXTRA_BBFILES": "${COREBASE}/recipes/fails-mc/*.bb", | 256 | "EXTRA_BBFILES": "${COREBASE}/recipes/fails-mc/*.bb", |
257 | } | 257 | } |
258 | tasks = self.run_bitbakecmd(["bitbake", "mc:mc1:f1"], tempdir, "", extraenv=extraenv, cleanup=True) | 258 | tasks = self.run_bitbakecmd(["bitbake", "mc:mc-1:f1"], tempdir, "", extraenv=extraenv, cleanup=True) |
259 | expected = ["mc1:f1:%s" % t for t in self.alltasks] + \ | 259 | expected = ["mc-1:f1:%s" % t for t in self.alltasks] + \ |
260 | ["mc2:a1:%s" % t for t in self.alltasks] | 260 | ["mc_2:a1:%s" % t for t in self.alltasks] |
261 | self.assertEqual(set(tasks), set(expected)) | 261 | self.assertEqual(set(tasks), set(expected)) |
262 | 262 | ||
263 | # A rebuild does nothing | 263 | # A rebuild does nothing |
264 | tasks = self.run_bitbakecmd(["bitbake", "mc:mc1:f1"], tempdir, "", extraenv=extraenv, cleanup=True) | 264 | tasks = self.run_bitbakecmd(["bitbake", "mc:mc-1:f1"], tempdir, "", extraenv=extraenv, cleanup=True) |
265 | self.assertEqual(set(tasks), set()) | 265 | self.assertEqual(set(tasks), set()) |
266 | 266 | ||
267 | # Test that a signature change in the dependent task causes | 267 | # Test that a signature change in the dependent task causes |
268 | # mcdepends to rebuild | 268 | # mcdepends to rebuild |
269 | tasks = self.run_bitbakecmd(["bitbake", "mc:mc2:a1", "-c", "compile", "-f"], tempdir, "", extraenv=extraenv, cleanup=True) | 269 | tasks = self.run_bitbakecmd(["bitbake", "mc:mc_2:a1", "-c", "compile", "-f"], tempdir, "", extraenv=extraenv, cleanup=True) |
270 | expected = ["mc2:a1:compile"] | 270 | expected = ["mc_2:a1:compile"] |
271 | self.assertEqual(set(tasks), set(expected)) | 271 | self.assertEqual(set(tasks), set(expected)) |
272 | 272 | ||
273 | rerun_tasks = self.alltasks[:] | 273 | rerun_tasks = self.alltasks[:] |
274 | for x in ("fetch", "unpack", "patch", "prepare_recipe_sysroot", "configure", "compile"): | 274 | for x in ("fetch", "unpack", "patch", "prepare_recipe_sysroot", "configure", "compile"): |
275 | rerun_tasks.remove(x) | 275 | rerun_tasks.remove(x) |
276 | tasks = self.run_bitbakecmd(["bitbake", "mc:mc1:f1"], tempdir, "", extraenv=extraenv, cleanup=True) | 276 | tasks = self.run_bitbakecmd(["bitbake", "mc:mc-1:f1"], tempdir, "", extraenv=extraenv, cleanup=True) |
277 | expected = ["mc1:f1:%s" % t for t in rerun_tasks] + \ | 277 | expected = ["mc-1:f1:%s" % t for t in rerun_tasks] + \ |
278 | ["mc2:a1:%s" % t for t in rerun_tasks] | 278 | ["mc_2:a1:%s" % t for t in rerun_tasks] |
279 | self.assertEqual(set(tasks), set(expected)) | 279 | self.assertEqual(set(tasks), set(expected)) |
280 | 280 | ||
281 | @unittest.skipIf(sys.version_info < (3, 5, 0), 'Python 3.5 or later required') | 281 | @unittest.skipIf(sys.version_info < (3, 5, 0), 'Python 3.5 or later required') |