[PATCH 0/7] fdt: Fix up tests and build warnings on newer distros

At present the code coverage for test_fdt is not working. This series fixes that and takes the opportunity to fix the pylint warnings in that file.
Some newer Linux distributions are producing warnings about using distutils, so this series moves things over to setuptools.
Simon Glass (7): dtoc: Tidy up fdt_tests RunTestCoverage() args dtoc: Tidy up fdt_tests RunTests() dtoc: Fix fdt test coverage dtoc: Move main program into its own function test_fdt: Convert to use argparse dtoc: Correct remaining pylint problems in test_fdt fdt: Move to setuptools
scripts/dtc/README | 106 +++++++++++ scripts/dtc/pylibfdt/Makefile | 5 +- scripts/dtc/pylibfdt/setup.py | 60 ++++++- scripts/pylint.base | 2 +- tools/dtoc/test_fdt.py | 326 +++++++++++++++++++--------------- 5 files changed, 345 insertions(+), 154 deletions(-) create mode 100644 scripts/dtc/README

Pass the options args in rather than using the global various. Use snake case and fix up comments to make pylint happy.
Signed-off-by: Simon Glass sjg@chromium.org ---
tools/dtoc/test_fdt.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/tools/dtoc/test_fdt.py b/tools/dtoc/test_fdt.py index 3baf4437cdd..ec257552efc 100755 --- a/tools/dtoc/test_fdt.py +++ b/tools/dtoc/test_fdt.py @@ -768,10 +768,14 @@ class TestFdtUtil(unittest.TestCase): tools.outdir= old_outdir
-def RunTestCoverage(): - """Run the tests and check that we get 100% coverage""" +def run_test_coverage(build_dir): + """Run the tests and check that we get 100% coverage + + Args: + build_dir (str): Directory containing the build output + """ test_util.run_test_coverage('tools/dtoc/test_fdt.py', None, - ['tools/patman/*.py', '*test_fdt.py'], options.build_dir) + ['tools/patman/*.py', '*test_fdt.py'], build_dir)
def RunTests(args): @@ -811,4 +815,4 @@ if options.test: ret_code = RunTests(args) sys.exit(ret_code) elif options.test_coverage: - RunTestCoverage() + run_test_coverage(options.build_dir)

Pass the options args in rather than using the global various. Use snake case and fix up comments to make pylint happy.
Signed-off-by: Simon Glass sjg@chromium.org ---
tools/dtoc/test_fdt.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
Applied to u-boot-dm, thanks!

Pass the options args in rather than using the global variables. Use snake case, fix up comments and use a ternary operator to make pylint happy.
Signed-off-by: Simon Glass sjg@chromium.org ---
tools/dtoc/test_fdt.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/tools/dtoc/test_fdt.py b/tools/dtoc/test_fdt.py index ec257552efc..b48819831d6 100755 --- a/tools/dtoc/test_fdt.py +++ b/tools/dtoc/test_fdt.py @@ -778,17 +778,20 @@ def run_test_coverage(build_dir): ['tools/patman/*.py', '*test_fdt.py'], build_dir)
-def RunTests(args): +def run_tests(args, processes): """Run all the test we have for the fdt model
Args: - args: List of positional args provided to fdt. This can hold a test - name to execute (as in 'fdt -t testFdt', for example) + args (list or str): List of positional args provided. This can hold a + test name to execute (as in 'test_fdt -t testFdt', for example) + processes (int): Number of processes to use (None means as many as there + are CPUs on the system. This must be set to 1 when running under + the python3-coverage tool
Returns: - Return code, 0 on success + int: Return code, 0 on success """ - test_name = args and args[0] or None + test_name = args[0] if args else None result = test_util.run_test_suites( 'test_fdt', False, False, False, None, test_name, None, [TestFdt, TestNode, TestProp, TestFdtUtil]) @@ -812,7 +815,7 @@ parser.add_option('-T', '--test-coverage', action='store_true',
# Run our meagre tests if options.test: - ret_code = RunTests(args) + ret_code = run_tests(args, options.processes) sys.exit(ret_code) elif options.test_coverage: run_test_coverage(options.build_dir)

Pass the options args in rather than using the global variables. Use snake case, fix up comments and use a ternary operator to make pylint happy.
Signed-off-by: Simon Glass sjg@chromium.org ---
tools/dtoc/test_fdt.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
Applied to u-boot-dm, thanks!

Fix a bug that the --processes option was ignored, thus resulting in no test coverage information being generated.
Signed-off-by: Simon Glass sjg@chromium.org Fixes: 42ae363ddd9 ("dtoc: Update fdt tests to use test_util") ---
tools/dtoc/test_fdt.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/dtoc/test_fdt.py b/tools/dtoc/test_fdt.py index b48819831d6..afa0bb58850 100755 --- a/tools/dtoc/test_fdt.py +++ b/tools/dtoc/test_fdt.py @@ -793,7 +793,7 @@ def run_tests(args, processes): """ test_name = args[0] if args else None result = test_util.run_test_suites( - 'test_fdt', False, False, False, None, test_name, None, + 'test_fdt', False, False, False, processes, test_name, None, [TestFdt, TestNode, TestProp, TestFdtUtil])
return (0 if result.wasSuccessful() else 1)

Fix a bug that the --processes option was ignored, thus resulting in no test coverage information being generated.
Signed-off-by: Simon Glass sjg@chromium.org Fixes: 42ae363ddd9 ("dtoc: Update fdt tests to use test_util") ---
tools/dtoc/test_fdt.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Applied to u-boot-dm, thanks!

Use a function for the main program so everything there doesn't look like a global variable to pylint.
Signed-off-by: Simon Glass sjg@chromium.org ---
tools/dtoc/test_fdt.py | 44 +++++++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 20 deletions(-)
diff --git a/tools/dtoc/test_fdt.py b/tools/dtoc/test_fdt.py index afa0bb58850..e10fb528e81 100755 --- a/tools/dtoc/test_fdt.py +++ b/tools/dtoc/test_fdt.py @@ -799,23 +799,27 @@ def run_tests(args, processes): return (0 if result.wasSuccessful() else 1)
-if __name__ != '__main__': - sys.exit(1) - -parser = OptionParser() -parser.add_option('-B', '--build-dir', type='string', default='b', - help='Directory containing the build output') -parser.add_option('-P', '--processes', type=int, - help='set number of processes to use for running tests') -parser.add_option('-t', '--test', action='store_true', dest='test', - default=False, help='run tests') -parser.add_option('-T', '--test-coverage', action='store_true', - default=False, help='run tests and check for 100% coverage') -(options, args) = parser.parse_args() - -# Run our meagre tests -if options.test: - ret_code = run_tests(args, options.processes) - sys.exit(ret_code) -elif options.test_coverage: - run_test_coverage(options.build_dir) +def main(): + """Main program for this tool""" + parser = OptionParser() + parser.add_option('-B', '--build-dir', type='string', default='b', + help='Directory containing the build output') + parser.add_option('-P', '--processes', type=int, + help='set number of processes to use for running tests') + parser.add_option('-t', '--test', action='store_true', dest='test', + default=False, help='run tests') + parser.add_option('-T', '--test-coverage', action='store_true', + default=False, help='run tests and check for 100% coverage') + (options, args) = parser.parse_args() + + # Run our meagre tests + if options.test: + ret_code = run_tests(args, options.processes) + return ret_code + if options.test_coverage: + run_test_coverage(options.build_dir) + return 0 + +if __name__ == '__main__': + sys.exit(main()) +sys.exit(1)

Use a function for the main program so everything there doesn't look like a global variable to pylint.
Signed-off-by: Simon Glass sjg@chromium.org ---
tools/dtoc/test_fdt.py | 44 +++++++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 20 deletions(-)
Applied to u-boot-dm, thanks!

Drop the deprecated OptionParser.
Signed-off-by: Simon Glass sjg@chromium.org ---
tools/dtoc/test_fdt.py | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-)
diff --git a/tools/dtoc/test_fdt.py b/tools/dtoc/test_fdt.py index e10fb528e81..c38158edf32 100755 --- a/tools/dtoc/test_fdt.py +++ b/tools/dtoc/test_fdt.py @@ -4,7 +4,7 @@ # Written by Simon Glass sjg@chromium.org #
-from optparse import OptionParser +from argparse import ArgumentParser import glob import os import shutil @@ -778,12 +778,11 @@ def run_test_coverage(build_dir): ['tools/patman/*.py', '*test_fdt.py'], build_dir)
-def run_tests(args, processes): +def run_tests(names, processes): """Run all the test we have for the fdt model
Args: - args (list or str): List of positional args provided. This can hold a - test name to execute (as in 'test_fdt -t testFdt', for example) + names (list of str): List of test names provided. Only the first is used processes (int): Number of processes to use (None means as many as there are CPUs on the system. This must be set to 1 when running under the python3-coverage tool @@ -791,7 +790,7 @@ def run_tests(args, processes): Returns: int: Return code, 0 on success """ - test_name = args[0] if args else None + test_name = names[0] if names else None result = test_util.run_test_suites( 'test_fdt', False, False, False, processes, test_name, None, [TestFdt, TestNode, TestProp, TestFdtUtil]) @@ -801,23 +800,25 @@ def run_tests(args, processes):
def main(): """Main program for this tool""" - parser = OptionParser() - parser.add_option('-B', '--build-dir', type='string', default='b', - help='Directory containing the build output') - parser.add_option('-P', '--processes', type=int, - help='set number of processes to use for running tests') - parser.add_option('-t', '--test', action='store_true', dest='test', - default=False, help='run tests') - parser.add_option('-T', '--test-coverage', action='store_true', - default=False, help='run tests and check for 100% coverage') - (options, args) = parser.parse_args() + parser = ArgumentParser() + parser.add_argument('-B', '--build-dir', type=str, default='b', + help='Directory containing the build output') + parser.add_argument('-P', '--processes', type=int, + help='set number of processes to use for running tests') + parser.add_argument('-t', '--test', action='store_true', dest='test', + default=False, help='run tests') + parser.add_argument('-T', '--test-coverage', action='store_true', + default=False, + help='run tests and check for 100% coverage') + parser.add_argument('name', nargs='*') + args = parser.parse_args()
# Run our meagre tests - if options.test: - ret_code = run_tests(args, options.processes) + if args.test: + ret_code = run_tests(args.name, args.processes) return ret_code - if options.test_coverage: - run_test_coverage(options.build_dir) + if args.test_coverage: + run_test_coverage(args.build_dir) return 0
if __name__ == '__main__':

Drop the deprecated OptionParser.
Signed-off-by: Simon Glass sjg@chromium.org ---
tools/dtoc/test_fdt.py | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-)
Applied to u-boot-dm, thanks!

Fix various camel-case and other naming problems. Update the pylint base file to avoid regressions.
Signed-off-by: Simon Glass sjg@chromium.org ---
scripts/pylint.base | 2 +- tools/dtoc/test_fdt.py | 254 +++++++++++++++++++++++------------------ 2 files changed, 142 insertions(+), 114 deletions(-)
diff --git a/scripts/pylint.base b/scripts/pylint.base index 9ebebf47ab9..5203f2bb492 100644 --- a/scripts/pylint.base +++ b/scripts/pylint.base @@ -167,7 +167,7 @@ tools_binman_etype_x86_reset16_tpl -15.71 tools_binman_etype_x86_start16 -15.71 tools_binman_etype_x86_start16_spl -15.71 tools_binman_etype_x86_start16_tpl -15.71 -tools_binman_fdt_test 3.23 +tools_binman_fdt_test 10.00 tools_binman_fip_util 9.85 tools_binman_fip_util_test 10.00 tools_binman_fmap_util 6.88 diff --git a/tools/dtoc/test_fdt.py b/tools/dtoc/test_fdt.py index c38158edf32..8a990b8bd77 100755 --- a/tools/dtoc/test_fdt.py +++ b/tools/dtoc/test_fdt.py @@ -1,11 +1,13 @@ #!/usr/bin/env python3 # SPDX-License-Identifier: GPL-2.0+ -# Copyright (c) 2018 Google, Inc -# Written by Simon Glass sjg@chromium.org -# + +""" +Tests for the Fdt module +Copyright (c) 2018 Google, Inc +Written by Simon Glass sjg@chromium.org +"""
from argparse import ArgumentParser -import glob import os import shutil import sys @@ -22,16 +24,18 @@ sys.path.insert(2, os.path.join(our_path, '../../scripts/dtc/pylibfdt')) sys.path.insert(2, os.path.join(our_path, '../../build-sandbox_spl/scripts/dtc/pylibfdt'))
+#pylint: disable=wrong-import-position from dtoc import fdt from dtoc import fdt_util from dtoc.fdt_util import fdt32_to_cpu, fdt64_to_cpu from dtoc.fdt import Type, BytesToValue import libfdt -from patman import command from patman import test_util from patman import tools
-def _GetPropertyValue(dtb, node, prop_name): +#pylint: disable=protected-access + +def _get_property_value(dtb, node, prop_name): """Low-level function to get the property value based on its offset
This looks directly in the device tree at the property's offset to find @@ -83,13 +87,13 @@ class TestFdt(unittest.TestCase): def setUp(self): self.dtb = fdt.FdtScan(find_dtb_file('dtoc_test_simple.dts'))
- def testFdt(self): + def test_fdt(self): """Test that we can open an Fdt""" self.dtb.Scan() root = self.dtb.GetRoot() self.assertTrue(isinstance(root, fdt.Node))
- def testGetNode(self): + def test_get_node(self): """Test the GetNode() method""" node = self.dtb.GetNode('/spl-test') self.assertTrue(isinstance(node, fdt.Node)) @@ -103,27 +107,28 @@ class TestFdt(unittest.TestCase): self.assertTrue(isinstance(node, fdt.Node)) self.assertEqual(0, node.Offset())
- def testFlush(self): + def test_flush(self): """Check that we can flush the device tree out to its file""" fname = self.dtb._fname - with open(fname, 'rb') as fd: - data = fd.read() + with open(fname, 'rb') as inf: + inf.read() os.remove(fname) with self.assertRaises(IOError): - open(fname, 'rb') + with open(fname, 'rb'): + pass self.dtb.Flush() - with open(fname, 'rb') as fd: - data = fd.read() + with open(fname, 'rb') as inf: + inf.read()
- def testPack(self): + def test_pack(self): """Test that packing a device tree works""" self.dtb.Pack()
- def testGetFdtRaw(self): + def test_get_fdt_raw(self): """Tetst that we can access the raw device-tree data""" self.assertTrue(isinstance(self.dtb.GetContents(), bytes))
- def testGetProps(self): + def test_get_props(self): """Tests obtaining a list of properties""" node = self.dtb.GetNode('/spl-test') props = self.dtb.GetProps(node) @@ -133,17 +138,19 @@ class TestFdt(unittest.TestCase): 'stringval', 'u-boot,dm-pre-reloc'], sorted(props.keys()))
- def testCheckError(self): + def test_check_error(self): """Tests the ChecKError() function""" - with self.assertRaises(ValueError) as e: + with self.assertRaises(ValueError) as exc: fdt.CheckErr(-libfdt.NOTFOUND, 'hello') - self.assertIn('FDT_ERR_NOTFOUND: hello', str(e.exception)) + self.assertIn('FDT_ERR_NOTFOUND: hello', str(exc.exception))
- def testGetFdt(self): + def test_get_fdt(self): + """Test getting an Fdt object from a node""" node = self.dtb.GetNode('/spl-test') self.assertEqual(self.dtb, node.GetFdt())
- def testBytesToValue(self): + def test_bytes_to_value(self): + """Test converting a string list into Python""" self.assertEqual(BytesToValue(b'this\0is\0'), (Type.STRING, ['this', 'is']))
@@ -163,11 +170,11 @@ class TestNode(unittest.TestCase): self.node = self.dtb.GetNode('/spl-test') self.fdt = self.dtb.GetFdtObj()
- def testOffset(self): + def test_offset(self): """Tests that we can obtain the offset of a node""" self.assertTrue(self.node.Offset() > 0)
- def testDelete(self): + def test_delete(self): """Tests that we can delete a property""" node2 = self.dtb.GetNode('/spl-test2') offset1 = node2.Offset() @@ -180,13 +187,13 @@ class TestNode(unittest.TestCase): with self.assertRaises(libfdt.FdtException): self.node.DeleteProp('missing')
- def testDeleteGetOffset(self): + def test_delete_get_offset(self): """Test that property offset update when properties are deleted""" self.node.DeleteProp('intval') - prop, value = _GetPropertyValue(self.dtb, self.node, 'longbytearray') + prop, value = _get_property_value(self.dtb, self.node, 'longbytearray') self.assertEqual(prop.value, value)
- def testFindNode(self): + def test_find_node(self): """Tests that we can find a node using the FindNode() functoin""" node = self.dtb.GetRoot().FindNode('i2c@0') self.assertEqual('i2c@0', node.name) @@ -194,33 +201,33 @@ class TestNode(unittest.TestCase): self.assertEqual('pmic@9', subnode.name) self.assertEqual(None, node.FindNode('missing'))
- def testRefreshMissingNode(self): + def test_refresh_missing_node(self): """Test refreshing offsets when an extra node is present in dtb""" # Delete it from our tables, not the device tree del self.dtb._root.subnodes[-1] - with self.assertRaises(ValueError) as e: + with self.assertRaises(ValueError) as exc: self.dtb.Refresh() - self.assertIn('Internal error, offset', str(e.exception)) + self.assertIn('Internal error, offset', str(exc.exception))
- def testRefreshExtraNode(self): + def test_refresh_extra_node(self): """Test refreshing offsets when an expected node is missing""" # Delete it from the device tre, not our tables self.fdt.del_node(self.node.Offset()) - with self.assertRaises(ValueError) as e: + with self.assertRaises(ValueError) as exc: self.dtb.Refresh() self.assertIn('Internal error, node name mismatch ' - 'spl-test != spl-test2', str(e.exception)) + 'spl-test != spl-test2', str(exc.exception))
- def testRefreshMissingProp(self): + def test_refresh_missing_prop(self): """Test refreshing offsets when an extra property is present in dtb""" # Delete it from our tables, not the device tree del self.node.props['notstring'] - with self.assertRaises(ValueError) as e: + with self.assertRaises(ValueError) as exc: self.dtb.Refresh() self.assertIn("Internal error, node '/spl-test' property 'notstring' missing, offset ", - str(e.exception)) + str(exc.exception))
- def testLookupPhandle(self): + def test_lookup_phandle(self): """Test looking up a single phandle""" dtb = fdt.FdtScan(find_dtb_file('dtoc_test_phandle.dts')) node = dtb.GetNode('/phandle-source2') @@ -228,19 +235,19 @@ class TestNode(unittest.TestCase): target = dtb.GetNode('/phandle-target') self.assertEqual(target, dtb.LookupPhandle(fdt32_to_cpu(prop.value)))
- def testAddNodeSpace(self): + def test_add_node_space(self): """Test adding a single node when out of space""" self.fdt.pack() self.node.AddSubnode('subnode') - with self.assertRaises(libfdt.FdtException) as e: + with self.assertRaises(libfdt.FdtException) as exc: self.dtb.Sync(auto_resize=False) - self.assertIn('FDT_ERR_NOSPACE', str(e.exception)) + self.assertIn('FDT_ERR_NOSPACE', str(exc.exception))
self.dtb.Sync(auto_resize=True) offset = self.fdt.path_offset('/spl-test/subnode') self.assertTrue(offset > 0)
- def testAddNodes(self): + def test_add_nodes(self): """Test adding various subnode and properies""" node = self.dtb.GetNode('/i2c@0')
@@ -272,7 +279,7 @@ class TestNode(unittest.TestCase):
self.dtb.Sync(auto_resize=True)
- def testAddOneNode(self): + def test_add_one_node(self): """Testing deleting and adding a subnode before syncing""" subnode = self.node.AddSubnode('subnode') self.node.AddSubnode('subnode2') @@ -283,21 +290,21 @@ class TestNode(unittest.TestCase): self.node.AddSubnode('subnode3') self.dtb.Sync()
- def testRefreshNameMismatch(self): + def test_refresh_name_mismatch(self): """Test name mismatch when syncing nodes and properties""" - prop = self.node.AddInt('integer-a', 12) + self.node.AddInt('integer-a', 12)
wrong_offset = self.dtb.GetNode('/i2c@0')._offset self.node._offset = wrong_offset - with self.assertRaises(ValueError) as e: + with self.assertRaises(ValueError) as exc: self.dtb.Sync() self.assertIn("Internal error, node '/spl-test' name mismatch 'i2c@0'", - str(e.exception)) + str(exc.exception))
- with self.assertRaises(ValueError) as e: + with self.assertRaises(ValueError) as exc: self.node.Refresh(wrong_offset) self.assertIn("Internal error, node '/spl-test' name mismatch 'i2c@0'", - str(e.exception)) + str(exc.exception))
class TestProp(unittest.TestCase): @@ -316,80 +323,83 @@ class TestProp(unittest.TestCase): self.node = self.dtb.GetNode('/spl-test') self.fdt = self.dtb.GetFdtObj()
- def testMissingNode(self): + def test_missing_node(self): + """Test GetNode() when the node is missing""" self.assertEqual(None, self.dtb.GetNode('missing'))
- def testPhandle(self): + def test_phandle(self): + """Test GetNode() on a phandle""" dtb = fdt.FdtScan(find_dtb_file('dtoc_test_phandle.dts')) node = dtb.GetNode('/phandle-source2') prop = node.props['clocks'] self.assertTrue(fdt32_to_cpu(prop.value) > 0)
- def _ConvertProp(self, prop_name): + def _convert_prop(self, prop_name): """Helper function to look up a property in self.node and return it
Args: - Property name to find + str: Property name to find
- Return fdt.Prop object for this property + Returns: + fdt.Prop: object for this property """ - p = self.fdt.getprop(self.node.Offset(), prop_name) - return fdt.Prop(self.node, -1, prop_name, p) + prop = self.fdt.getprop(self.node.Offset(), prop_name) + return fdt.Prop(self.node, -1, prop_name, prop)
- def testMakeProp(self): + def test_make_prop(self): """Test we can convert all the the types that are supported""" - prop = self._ConvertProp('boolval') + prop = self._convert_prop('boolval') self.assertEqual(Type.BOOL, prop.type) self.assertEqual(True, prop.value)
- prop = self._ConvertProp('intval') + prop = self._convert_prop('intval') self.assertEqual(Type.INT, prop.type) self.assertEqual(1, fdt32_to_cpu(prop.value))
- prop = self._ConvertProp('int64val') + prop = self._convert_prop('int64val') self.assertEqual(Type.INT, prop.type) self.assertEqual(0x123456789abcdef0, fdt64_to_cpu(prop.value))
- prop = self._ConvertProp('intarray') + prop = self._convert_prop('intarray') self.assertEqual(Type.INT, prop.type) val = [fdt32_to_cpu(val) for val in prop.value] self.assertEqual([2, 3, 4], val)
- prop = self._ConvertProp('byteval') + prop = self._convert_prop('byteval') self.assertEqual(Type.BYTE, prop.type) self.assertEqual(5, ord(prop.value))
- prop = self._ConvertProp('longbytearray') + prop = self._convert_prop('longbytearray') self.assertEqual(Type.BYTE, prop.type) val = [ord(val) for val in prop.value] self.assertEqual([9, 10, 11, 12, 13, 14, 15, 16, 17], val)
- prop = self._ConvertProp('stringval') + prop = self._convert_prop('stringval') self.assertEqual(Type.STRING, prop.type) self.assertEqual('message', prop.value)
- prop = self._ConvertProp('stringarray') + prop = self._convert_prop('stringarray') self.assertEqual(Type.STRING, prop.type) self.assertEqual(['multi-word', 'message'], prop.value)
- prop = self._ConvertProp('notstring') + prop = self._convert_prop('notstring') self.assertEqual(Type.BYTE, prop.type) val = [ord(val) for val in prop.value] self.assertEqual([0x20, 0x21, 0x22, 0x10, 0], val)
- def testGetEmpty(self): + def test_get_empty(self): """Tests the GetEmpty() function for the various supported types""" self.assertEqual(True, fdt.Prop.GetEmpty(Type.BOOL)) self.assertEqual(chr(0), fdt.Prop.GetEmpty(Type.BYTE)) self.assertEqual(tools.get_bytes(0, 4), fdt.Prop.GetEmpty(Type.INT)) self.assertEqual('', fdt.Prop.GetEmpty(Type.STRING))
- def testGetOffset(self): + def test_get_offset(self): """Test we can get the offset of a property""" - prop, value = _GetPropertyValue(self.dtb, self.node, 'longbytearray') + prop, value = _get_property_value(self.dtb, self.node, 'longbytearray') self.assertEqual(prop.value, value)
- def testWiden(self): + def test_widen(self): """Test widening of values""" node2 = self.dtb.GetNode('/spl-test2') node3 = self.dtb.GetNode('/spl-test3') @@ -426,7 +436,13 @@ class TestProp(unittest.TestCase): self.assertEqual(['\x09', '\x0a', '\x0b', '\x0c', '\x0d', '\x0e', '\x0f', '\x10', '\0'], prop3.value)
- # Similarly for a string array + def test_widen_more(self): + """More tests of widening values""" + node2 = self.dtb.GetNode('/spl-test2') + node3 = self.dtb.GetNode('/spl-test3') + prop = self.node.props['intval'] + + # Test widening a single string into a string array prop = self.node.props['stringval'] prop2 = node2.props['stringarray'] self.assertFalse(isinstance(prop.value, list)) @@ -466,7 +482,7 @@ class TestProp(unittest.TestCase): self.assertTrue(isinstance(prop.value, list)) self.assertEqual(1, len(prop.value))
- def testAdd(self): + def test_add(self): """Test adding properties""" self.fdt.pack() # This function should automatically expand the device tree @@ -485,12 +501,12 @@ class TestProp(unittest.TestCase):
# This should fail since it would need to increase the device-tree size self.node.AddZeroProp('four') - with self.assertRaises(libfdt.FdtException) as e: + with self.assertRaises(libfdt.FdtException) as exc: self.dtb.Sync(auto_resize=False) - self.assertIn('FDT_ERR_NOSPACE', str(e.exception)) + self.assertIn('FDT_ERR_NOSPACE', str(exc.exception)) self.dtb.Sync(auto_resize=True)
- def testAddMore(self): + def test_add_more(self): """Test various other methods for adding and setting properties""" self.node.AddZeroProp('one') self.dtb.Sync(auto_resize=True) @@ -516,9 +532,9 @@ class TestProp(unittest.TestCase):
self.fdt.pack() self.node.SetString('string', val + 'x') - with self.assertRaises(libfdt.FdtException) as e: + with self.assertRaises(libfdt.FdtException) as exc: self.dtb.Sync(auto_resize=False) - self.assertIn('FDT_ERR_NOSPACE', str(e.exception)) + self.assertIn('FDT_ERR_NOSPACE', str(exc.exception)) self.node.SetString('string', val[:-1])
prop = self.node.props['string'] @@ -565,7 +581,8 @@ class TestProp(unittest.TestCase): new_offset = self.fdt.path_offset('/spl-test', libfdt.QUIET_NOTFOUND) self.assertEqual(-libfdt.NOTFOUND, new_offset)
- def testFromData(self): + def test_from_data(self): + """Test creating an FDT from data""" dtb2 = fdt.Fdt.FromData(self.dtb.GetContents()) self.assertEqual(dtb2.GetContents(), self.dtb.GetContents())
@@ -573,28 +590,28 @@ class TestProp(unittest.TestCase): self.dtb.Sync(auto_resize=True) self.assertTrue(dtb2.GetContents() != self.dtb.GetContents())
- def testMissingSetInt(self): + def test_missing_set_int(self): """Test handling of a missing property with SetInt""" - with self.assertRaises(ValueError) as e: + with self.assertRaises(ValueError) as exc: self.node.SetInt('one', 1) self.assertIn("node '/spl-test': Missing property 'one'", - str(e.exception)) + str(exc.exception))
- def testMissingSetData(self): + def test_missing_set_data(self): """Test handling of a missing property with SetData""" - with self.assertRaises(ValueError) as e: + with self.assertRaises(ValueError) as exc: self.node.SetData('one', b'data') self.assertIn("node '/spl-test': Missing property 'one'", - str(e.exception)) + str(exc.exception))
- def testMissingSetString(self): + def test_missing_set_string(self): """Test handling of a missing property with SetString""" - with self.assertRaises(ValueError) as e: + with self.assertRaises(ValueError) as exc: self.node.SetString('one', 1) self.assertIn("node '/spl-test': Missing property 'one'", - str(e.exception)) + str(exc.exception))
- def testGetFilename(self): + def test_get_filename(self): """Test the dtb filename can be provided""" self.assertEqual(tools.get_output_filename('source.dtb'), self.dtb.GetFilename()) @@ -619,38 +636,42 @@ class TestFdtUtil(unittest.TestCase): self.dtb = fdt.FdtScan(find_dtb_file('dtoc_test_simple.dts')) self.node = self.dtb.GetNode('/spl-test')
- def testGetInt(self): + def test_get_int(self): + """Test getting an int from a node""" self.assertEqual(1, fdt_util.GetInt(self.node, 'intval')) self.assertEqual(3, fdt_util.GetInt(self.node, 'missing', 3))
- with self.assertRaises(ValueError) as e: + with self.assertRaises(ValueError) as exc: fdt_util.GetInt(self.node, 'intarray') self.assertIn("property 'intarray' has list value: expecting a single " - 'integer', str(e.exception)) + 'integer', str(exc.exception))
- def testGetInt64(self): + def test_get_int64(self): + """Test getting a 64-bit int from a node""" self.assertEqual(0x123456789abcdef0, fdt_util.GetInt64(self.node, 'int64val')) self.assertEqual(3, fdt_util.GetInt64(self.node, 'missing', 3))
- with self.assertRaises(ValueError) as e: + with self.assertRaises(ValueError) as exc: fdt_util.GetInt64(self.node, 'intarray') self.assertIn( "property 'intarray' should be a list with 2 items for 64-bit values", - str(e.exception)) + str(exc.exception))
- def testGetString(self): + def test_get_string(self): + """Test getting a string from a node""" self.assertEqual('message', fdt_util.GetString(self.node, 'stringval')) self.assertEqual('test', fdt_util.GetString(self.node, 'missing', 'test')) self.assertEqual('', fdt_util.GetString(self.node, 'boolval'))
- with self.assertRaises(ValueError) as e: + with self.assertRaises(ValueError) as exc: self.assertEqual(3, fdt_util.GetString(self.node, 'stringarray')) self.assertIn("property 'stringarray' has list value: expecting a " - 'single string', str(e.exception)) + 'single string', str(exc.exception))
- def testGetStringList(self): + def test_get_string_list(self): + """Test getting a string list from a node""" self.assertEqual(['message'], fdt_util.GetStringList(self.node, 'stringval')) self.assertEqual( @@ -660,7 +681,8 @@ class TestFdtUtil(unittest.TestCase): fdt_util.GetStringList(self.node, 'missing', ['test'])) self.assertEqual([], fdt_util.GetStringList(self.node, 'boolval'))
- def testGetArgs(self): + def test_get_args(self): + """Test getting arguments from a node""" node = self.dtb.GetNode('/orig-node') self.assertEqual(['message'], fdt_util.GetArgs(self.node, 'stringval')) self.assertEqual( @@ -679,44 +701,48 @@ class TestFdtUtil(unittest.TestCase): "Node '/spl-test': Expected property 'missing'", str(exc.exception))
- def testGetBool(self): + def test_get_bool(self): + """Test getting a bool from a node""" self.assertEqual(True, fdt_util.GetBool(self.node, 'boolval')) self.assertEqual(False, fdt_util.GetBool(self.node, 'missing')) self.assertEqual(True, fdt_util.GetBool(self.node, 'missing', True)) self.assertEqual(False, fdt_util.GetBool(self.node, 'missing', False))
- def testGetByte(self): + def test_get_byte(self): + """Test getting a byte from a node""" self.assertEqual(5, fdt_util.GetByte(self.node, 'byteval')) self.assertEqual(3, fdt_util.GetByte(self.node, 'missing', 3))
- with self.assertRaises(ValueError) as e: + with self.assertRaises(ValueError) as exc: fdt_util.GetByte(self.node, 'longbytearray') self.assertIn("property 'longbytearray' has list value: expecting a " - 'single byte', str(e.exception)) + 'single byte', str(exc.exception))
- with self.assertRaises(ValueError) as e: + with self.assertRaises(ValueError) as exc: fdt_util.GetByte(self.node, 'intval') self.assertIn("property 'intval' has length 4, expecting 1", - str(e.exception)) + str(exc.exception))
- def testGetBytes(self): + def test_get_bytes(self): + """Test getting multiple bytes from a node""" self.assertEqual(bytes([5]), fdt_util.GetBytes(self.node, 'byteval', 1)) self.assertEqual(None, fdt_util.GetBytes(self.node, 'missing', 3)) self.assertEqual( bytes([3]), fdt_util.GetBytes(self.node, 'missing', 3, bytes([3])))
- with self.assertRaises(ValueError) as e: + with self.assertRaises(ValueError) as exc: fdt_util.GetBytes(self.node, 'longbytearray', 7) self.assertIn( "Node 'spl-test' property 'longbytearray' has length 9, expecting 7", - str(e.exception)) + str(exc.exception))
self.assertEqual( bytes([0, 0, 0, 1]), fdt_util.GetBytes(self.node, 'intval', 4)) self.assertEqual( bytes([3]), fdt_util.GetBytes(self.node, 'missing', 3, bytes([3])))
- def testGetPhandleList(self): + def test_get_phandle_list(self): + """Test getting a list of phandles from a node""" dtb = fdt.FdtScan(find_dtb_file('dtoc_test_phandle.dts')) node = dtb.GetNode('/phandle-source2') self.assertEqual([1], fdt_util.GetPhandleList(node, 'clocks')) @@ -725,14 +751,16 @@ class TestFdtUtil(unittest.TestCase): fdt_util.GetPhandleList(node, 'clocks')) self.assertEqual(None, fdt_util.GetPhandleList(node, 'missing'))
- def testGetDataType(self): + def test_get_data_type(self): + """Test getting a value of a particular type from a node""" self.assertEqual(1, fdt_util.GetDatatype(self.node, 'intval', int)) self.assertEqual('message', fdt_util.GetDatatype(self.node, 'stringval', str)) - with self.assertRaises(ValueError) as e: + with self.assertRaises(ValueError): self.assertEqual(3, fdt_util.GetDatatype(self.node, 'boolval', bool)) - def testFdtCellsToCpu(self): + def test_fdt_cells_to_cpu(self): + """Test getting cells with the correct endianness""" val = self.node.props['intarray'].value self.assertEqual(0, fdt_util.fdt_cells_to_cpu(val, 0)) self.assertEqual(2, fdt_util.fdt_cells_to_cpu(val, 1)) @@ -749,12 +777,12 @@ class TestFdtUtil(unittest.TestCase): 2)) self.assertEqual(0x12345678, fdt_util.fdt_cells_to_cpu(val, 1))
- def testEnsureCompiled(self): + def test_ensure_compiled(self): """Test a degenerate case of this function (file already compiled)""" dtb = fdt_util.EnsureCompiled(find_dtb_file('dtoc_test_simple.dts')) self.assertEqual(dtb, fdt_util.EnsureCompiled(dtb))
- def testEnsureCompiledTmpdir(self): + def test_ensure_compiled_tmpdir(self): """Test providing a temporary directory""" try: old_outdir = tools.outdir

Fix various camel-case and other naming problems. Update the pylint base file to avoid regressions.
Signed-off-by: Simon Glass sjg@chromium.org ---
scripts/pylint.base | 2 +- tools/dtoc/test_fdt.py | 254 +++++++++++++++++++++++------------------ 2 files changed, 142 insertions(+), 114 deletions(-)
Applied to u-boot-dm, thanks!

The distutils package is deprecated. The upstream libfdt repo uses setuptools for building the pylibfdt module, so bring in that code, suitably modified for U-Boot. Also bring in the README.
The modifications include setting the version correctly, making use of the environment variables provided by the Makefile and various tweaks to the directories.
Note that the version omits the minus character at the start of EXTRAVERSION, since this creates a warning. The build is really just used within U-Boot itself, so it doesn't matter too much if the version matches upstream, or exactly matches U-Boot.
Signed-off-by: Simon Glass sjg@chromium.org ---
scripts/dtc/README | 106 ++++++++++++++++++++++++++++++++++ scripts/dtc/pylibfdt/Makefile | 5 +- scripts/dtc/pylibfdt/setup.py | 60 ++++++++++++++++--- 3 files changed, 161 insertions(+), 10 deletions(-) create mode 100644 scripts/dtc/README
diff --git a/scripts/dtc/README b/scripts/dtc/README new file mode 100644 index 00000000000..a48312a422c --- /dev/null +++ b/scripts/dtc/README @@ -0,0 +1,106 @@ +The source tree contains the Device Tree Compiler (dtc) toolchain for +working with device tree source and binary files and also libfdt, a +utility library for reading and manipulating the binary format. + +DTC and LIBFDT are maintained by: + +David Gibson david@gibson.dropbear.id.au +Jon Loeliger loeliger@gmail.com + + +Python library +-------------- + +A Python library is also available. To build this you will need to install +swig and Python development files. On Debian distributions: + + sudo apt-get install swig python3-dev + +The library provides an Fdt class which you can use like this: + +$ PYTHONPATH=../pylibfdt python3 +>>> import libfdt +>>> fdt = libfdt.Fdt(open('test_tree1.dtb', mode='rb').read()) +>>> node = fdt.path_offset('/subnode@1') +>>> print(node) +124 +>>> prop_offset = fdt.first_property_offset(node) +>>> prop = fdt.get_property_by_offset(prop_offset) +>>> print('%s=%s' % (prop.name, prop.as_str())) +compatible=subnode1 +>>> node2 = fdt.path_offset('/') +>>> print(fdt.getprop(node2, 'compatible').as_str()) +test_tree1 + +You will find tests in tests/pylibfdt_tests.py showing how to use each +method. Help is available using the Python help command, e.g.: + + $ cd pylibfdt + $ python3 -c "import libfdt; help(libfdt)" + +If you add new features, please check code coverage: + + $ sudo apt-get install python3-coverage + $ cd tests + # It's just 'coverage' on most other distributions + $ python3-coverage run pylibfdt_tests.py + $ python3-coverage html + # Open 'htmlcov/index.html' in your browser + + +The library can be installed with pip from a local source tree: + + pip install . [--user|--prefix=/path/to/install_dir] + +Or directly from a remote git repo: + + pip install git+git://git.kernel.org/pub/scm/utils/dtc/dtc.git@main + +The install depends on libfdt shared library being installed on the host system +first. Generally, using --user or --prefix is not necessary and pip will use the +default location for the Python installation which varies if the user is root or +not. + +You can also install everything via make if you like, but pip is recommended. + +To install both libfdt and pylibfdt you can use: + + make install [PREFIX=/path/to/install_dir] + +To disable building the python library, even if swig and Python are available, +use: + + make NO_PYTHON=1 + + +More work remains to support all of libfdt, including access to numeric +values. + + +Adding a new function to libfdt.h +--------------------------------- + +The shared library uses libfdt/version.lds to list the exported functions, so +add your new function there. Check that your function works with pylibfdt. If +it cannot be supported, put the declaration in libfdt.h behind #ifndef SWIG so +that swig ignores it. + + +Tests +----- + +Test files are kept in the tests/ directory. Use 'make check' to build and run +all tests. + +If you want to adjust a test file, be aware that tree_tree1.dts is compiled +and checked against a binary tree from assembler macros in trees.S. So +if you change that file you must change tree.S also. + + +Mailing list +------------ +The following list is for discussion about dtc and libfdt implementation +mailto:devicetree-compiler@vger.kernel.org + +Core device tree bindings are discussed on the devicetree-spec list: +mailto:devicetree-spec@vger.kernel.org diff --git a/scripts/dtc/pylibfdt/Makefile b/scripts/dtc/pylibfdt/Makefile index 493995e3038..e442d5c2420 100644 --- a/scripts/dtc/pylibfdt/Makefile +++ b/scripts/dtc/pylibfdt/Makefile @@ -13,11 +13,14 @@ include $(LIBFDT_srcdir)/Makefile.libfdt PYLIBFDT_srcs = $(addprefix $(LIBFDT_srcdir)/,$(LIBFDT_SRCS)) \ $(obj)/libfdt.i
+# create a version string compliant with PEP 440 +PEP_VERSION = $(VERSION)$(if $(PATCHLEVEL),.$(PATCHLEVEL)$(if $(SUBLEVEL),.$(SUBLEVEL)))$(subst -,,$(EXTRAVERSION)) + quiet_cmd_pymod = PYMOD $@ cmd_pymod = unset CROSS_COMPILE; unset CFLAGS; \ CC="$(HOSTCC)" LDSHARED="$(HOSTCC) -shared " \ LDFLAGS="$(HOSTLDFLAGS)" \ - VERSION="u-boot-$(UBOOTVERSION)" \ + VERSION="$(PEP_VERSION)" \ CPPFLAGS="$(HOSTCFLAGS) -I$(LIBFDT_srcdir)" OBJDIR=$(obj) \ SOURCES="$(PYLIBFDT_srcs)" \ SWIG_OPTS="-I$(LIBFDT_srcdir) -I$(LIBFDT_srcdir)/.." \ diff --git a/scripts/dtc/pylibfdt/setup.py b/scripts/dtc/pylibfdt/setup.py index 992cdec30f5..6be12fea775 100755 --- a/scripts/dtc/pylibfdt/setup.py +++ b/scripts/dtc/pylibfdt/setup.py @@ -1,11 +1,13 @@ #!/usr/bin/env python3 +# SPDX-License-Identifier: (GPL-2.0-or-later OR BSD-2-Clause)
""" setup.py file for SWIG libfdt Copyright (C) 2017 Google, Inc. Written by Simon Glass sjg@chromium.org
-SPDX-License-Identifier: GPL-2.0+ BSD-2-Clause +This script is modified from the upstream version, to fit in with the U-Boot +build system.
Files to be built into the extension are provided in SOURCES C flags to use are provided in CPPFLAGS @@ -18,14 +20,29 @@ allows this script to be run stand-alone, e.g.: ./pylibfdt/setup.py install [--prefix=...] """
-from distutils.core import setup, Extension +from setuptools import setup, Extension +from setuptools.command.build_py import build_py as _build_py import os import re import sys
+srcdir = os.path.dirname(__file__) + +with open(os.path.join(srcdir, "../README"), "r") as fh: + long_description = fh.read() + # Decodes a Makefile assignment line into key and value (and plus for +=) RE_KEY_VALUE = re.compile('(?P<key>\w+) *(?P<plus>[+])?= *(?P<value>.*)$')
+def get_top_builddir(): + if '--top-builddir' in sys.argv: + index = sys.argv.index('--top-builddir') + sys.argv.pop(index) + return sys.argv.pop(index) + else: + return os.path.join(srcdir, '..') + +top_builddir = get_top_builddir()
def ParseMakefile(fname): """Parse a Makefile to obtain its variables. @@ -81,12 +98,13 @@ def GetEnvFromMakefiles(): basedir = os.path.dirname(os.path.dirname(os.path.abspath(sys.argv[0]))) swig_opts = ['-I%s' % basedir] makevars = ParseMakefile(os.path.join(basedir, 'Makefile')) + print('makevars', makevars) version = '%s.%s.%s' % (makevars['VERSION'], makevars['PATCHLEVEL'], makevars['SUBLEVEL']) makevars = ParseMakefile(os.path.join(basedir, 'libfdt', 'Makefile.libfdt')) files = makevars['LIBFDT_SRCS'].split() files = [os.path.join(basedir, 'libfdt', fname) for fname in files] - files.append('pylibfdt/libfdt.i') + files.append('libfdt.i') cflags = ['-I%s' % basedir, '-I%s/libfdt' % basedir] objdir = '' return swig_opts, version, files, cflags, objdir @@ -107,17 +125,41 @@ if not all((swig_opts, version, files, cflags, objdir)):
libfdt_module = Extension( '_libfdt', - sources = files, - extra_compile_args = cflags, - swig_opts = swig_opts, + sources=files, + define_macros=[('PY_SSIZE_T_CLEAN', None)], + include_dirs=[os.path.join(srcdir, 'libfdt')], + library_dirs=[os.path.join(top_builddir, 'libfdt')], + swig_opts=swig_opts, )
+class build_py(_build_py): + def run(self): + self.run_command("build_ext") + return super().run() + setup( name='libfdt', - version= version, - author='Simon Glass sjg@chromium.org', + version=version, + cmdclass = {'build_py' : build_py}, + setup_requires = ['setuptools_scm'], + author='Simon Glass', + author_email='sjg@chromium.org', description='Python binding for libfdt', ext_modules=[libfdt_module], package_dir={'': objdir}, - py_modules=['pylibfdt/libfdt'], + py_modules=['libfdt'], + + long_description=long_description, + long_description_content_type="text/plain", + url="https://git.kernel.org/pub/scm/utils/dtc/dtc.git", + license="BSD", + license_files=["GPL", "BSD-2-Clause"], + + classifiers=[ + "Programming Language :: Python :: 3", + "License :: OSI Approved :: BSD License", + "License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)", + "Operating System :: OS Independent", + ], + )

On Sat, Jul 30, 2022 at 08:57:11PM -0600, Simon Glass wrote:
The distutils package is deprecated. The upstream libfdt repo uses setuptools for building the pylibfdt module, so bring in that code, suitably modified for U-Boot. Also bring in the README.
The modifications include setting the version correctly, making use of the environment variables provided by the Makefile and various tweaks to the directories.
Note that the version omits the minus character at the start of EXTRAVERSION, since this creates a warning. The build is really just used within U-Boot itself, so it doesn't matter too much if the version matches upstream, or exactly matches U-Boot.
Signed-off-by: Simon Glass sjg@chromium.org
scripts/dtc/README | 106 ++++++++++++++++++++++++++++++++++ scripts/dtc/pylibfdt/Makefile | 5 +- scripts/dtc/pylibfdt/setup.py | 60 ++++++++++++++++--- 3 files changed, 161 insertions(+), 10 deletions(-) create mode 100644 scripts/dtc/README
This isn't new enough, however: /usr/lib/python3/dist-packages/setuptools/installer.py:27: SetuptoolsDeprecationWarning: setuptools.installer is deprecated. Requirements should be satisfied by a PEP 517 installer. when trying in Ubuntu 22.04 (the trini/u-boot-gitlab-ci-runner:jammy-20220531-13Jul2022 docker specifically).

Hi Tom,
On Tue, 9 Aug 2022 at 11:56, Tom Rini trini@konsulko.com wrote:
On Sat, Jul 30, 2022 at 08:57:11PM -0600, Simon Glass wrote:
The distutils package is deprecated. The upstream libfdt repo uses setuptools for building the pylibfdt module, so bring in that code, suitably modified for U-Boot. Also bring in the README.
The modifications include setting the version correctly, making use of the environment variables provided by the Makefile and various tweaks to the directories.
Note that the version omits the minus character at the start of EXTRAVERSION, since this creates a warning. The build is really just used within U-Boot itself, so it doesn't matter too much if the version matches upstream, or exactly matches U-Boot.
Signed-off-by: Simon Glass sjg@chromium.org
scripts/dtc/README | 106 ++++++++++++++++++++++++++++++++++ scripts/dtc/pylibfdt/Makefile | 5 +- scripts/dtc/pylibfdt/setup.py | 60 ++++++++++++++++--- 3 files changed, 161 insertions(+), 10 deletions(-) create mode 100644 scripts/dtc/README
This isn't new enough, however: /usr/lib/python3/dist-packages/setuptools/installer.py:27: SetuptoolsDeprecationWarning: setuptools.installer is deprecated. Requirements should be satisfied by a PEP 517 installer. when trying in Ubuntu 22.04 (the trini/u-boot-gitlab-ci-runner:jammy-20220531-13Jul2022 docker specifically).
+Rob Herring
Yes I see that. But it is a start!
Also I was about to send a pull request with this...should I take it out?
Regards, Simon

On Tue, Aug 09, 2022 at 01:51:15PM -0600, Simon Glass wrote:
Hi Tom,
On Tue, 9 Aug 2022 at 11:56, Tom Rini trini@konsulko.com wrote:
On Sat, Jul 30, 2022 at 08:57:11PM -0600, Simon Glass wrote:
The distutils package is deprecated. The upstream libfdt repo uses setuptools for building the pylibfdt module, so bring in that code, suitably modified for U-Boot. Also bring in the README.
The modifications include setting the version correctly, making use of the environment variables provided by the Makefile and various tweaks to the directories.
Note that the version omits the minus character at the start of EXTRAVERSION, since this creates a warning. The build is really just used within U-Boot itself, so it doesn't matter too much if the version matches upstream, or exactly matches U-Boot.
Signed-off-by: Simon Glass sjg@chromium.org
scripts/dtc/README | 106 ++++++++++++++++++++++++++++++++++ scripts/dtc/pylibfdt/Makefile | 5 +- scripts/dtc/pylibfdt/setup.py | 60 ++++++++++++++++--- 3 files changed, 161 insertions(+), 10 deletions(-) create mode 100644 scripts/dtc/README
This isn't new enough, however: /usr/lib/python3/dist-packages/setuptools/installer.py:27: SetuptoolsDeprecationWarning: setuptools.installer is deprecated. Requirements should be satisfied by a PEP 517 installer. when trying in Ubuntu 22.04 (the trini/u-boot-gitlab-ci-runner:jammy-20220531-13Jul2022 docker specifically).
+Rob Herring
Yes I see that. But it is a start!
Also I was about to send a pull request with this...should I take it out?
Well, it brings us in sync with upstream I see, so yes, we should take this now and work on getting the next warning resolved. For why I hit this again, I'm just shuffling around where we set -e/+e.
participants (2)
-
Simon Glass
-
Tom Rini