return True
return False
+ def fragment_prefix(self, fragmentname):
+ return fragmentname.split("/",1)[0]
+
def builtin_fragment_exists(self, fragmentname):
- fragment_prefix = fragmentname.split("/",1)[0]
+ fragment_prefix = self.fragment_prefix(fragmentname)
fragment_prefix_defs = set([f.split(':')[0] for f in self.tinfoil.config_data.getVar('OE_FRAGMENTS_BUILTIN').split()])
return fragment_prefix in fragment_prefix_defs
if f in enabled_fragments:
print("Fragment {} already included in {}".format(f, args.confpath))
else:
+ # first filter out all built-in fragments with the same prefix as the one that is being enabled
+ enabled_fragments = [fragment for fragment in enabled_fragments if not(self.builtin_fragment_exists(fragment) and self.fragment_prefix(fragment) == self.fragment_prefix(f))]
enabled_fragments.append(f)
return " ".join(enabled_fragments), None, 0, True
2. Verify that SELFTEST_BUILTIN_FRAGMENT_VARIABLE is set after setting
the fragment.
3. Verify that SELFTEST_BUILTIN_FRAGMENT_VARIABLE is set after setting
- the fragment with another value that overrides the first one.
- 4. Verify that SELFTEST_BUILTIN_FRAGMENT_VARIABLE is set to the previous
- value after removing the second assignment (from step 3).
+ the fragment with another value that replaces the first one.
+ 4. Repeat steps 2 and 3 to verify that going back and forth between values
+ works.
5. Verify that SELFTEST_BUILTIN_FRAGMENT_VARIABLE is not set after
- removing the original assignment.
+ removing the final assignment.
"""
self.assertEqual(get_bb_var('SELFTEST_BUILTIN_FRAGMENT_VARIABLE'), None)
runCmd('bitbake-config-build enable-fragment selftest-fragment/someothervalue')
self.assertEqual(get_bb_var('SELFTEST_BUILTIN_FRAGMENT_VARIABLE'), 'someothervalue')
- runCmd('bitbake-config-build disable-fragment selftest-fragment/someothervalue')
+ runCmd('bitbake-config-build enable-fragment selftest-fragment/somevalue')
self.assertEqual(get_bb_var('SELFTEST_BUILTIN_FRAGMENT_VARIABLE'), 'somevalue')
- runCmd('bitbake-config-build disable-fragment selftest-fragment/somevalue')
+ runCmd('bitbake-config-build enable-fragment selftest-fragment/someothervalue')
+ self.assertEqual(get_bb_var('SELFTEST_BUILTIN_FRAGMENT_VARIABLE'), 'someothervalue')
+
+ runCmd('bitbake-config-build disable-fragment selftest-fragment/someothervalue')
self.assertEqual(get_bb_var('SELFTEST_BUILTIN_FRAGMENT_VARIABLE'), None)
def test_show_fragment(self):