With unified builds we want to access the master configuration from Python. While we can use fdtget as a work-around, the cleanest solution is to use a libfdt Python binding.
This bug tracks upstreaming of this work.
Work still to do:
- Detected different versions of Python on the machine
- Install the library from the Makefile
The library only includes enough features to cope with our current needs. If that changes I may need to add a few more functions to the SWIG interface.
The ebuild should add a dependency on dev-lang/python. Otherwise the build fails because portage starts building it before python.
WARNING: The following packages failed once or more,
but succeeded upon retry. This might indicate incorrect
dependencies.
sys-apps/dtc-1.4.4-r1
dtc-1.4.4-r1: python pylibfdt/setup.py "-I libfdt -I ." libfdt/fdt.c libfdt/fdt_ro.c libfdt/fdt_wip.c libfdt/fdt_sw.c libfdt/fdt_rw.c libfdt/fdt_strerror.c libfdt/fdt_empty_tree.c libfdt/fdt_addresses.c libfdt/fdt_overlay.c pylibfdt/libfdt_wrap.c
dtc-1.4.4-r1: pylibfdt/libfdt_wrap.c:130:11: fatal error: 'Python.h' file not found
dtc-1.4.4-r1: # include <Python.h>
dtc-1.4.4-r1: ^~~~~~~~~~
dtc-1.4.4-r1: 1 error generated.
(https://uberchromegw.corp.google.com/i/chromiumos.tryserver/builders/release/builds/9992/steps/BuildPackages%20%5Bafdo_use%5D/logs/stdio)
Status: Looking pretty good - upstream maintainer has applied some patches and asked for a rebase. Mike has provided some comments. Should have a new version out this week.
Now applied upstream. I'll wait for a release and any other comments and then should be able to drop our local patches.
git://git.kernel.org/pub/scm/utils/dtc/dtc.git
e56f2b0 pylibfdt: Use setup.py to build the swig file
896f1c1 pylibfdt: Use Makefile constructs to implement NO_PYTHON
90db6d9 pylibfdt: Allow setup.py to operate stand-alone
b04a2cf pylibfdt: Fix code style in setup.py
1c5170d pylibfdt: Rename libfdt.swig to libfdt.i
ab15256 pylibfdt: Use the call function to simplify the Makefile
9f2e3a3 pylibfdt: Use the correct libfdt version in the module
e91c652 pylibfdt: Enable installation of Python module
8a892fd pylibfdt: Allow building to be disabled
14c4171 pylibfdt: Use package_dir to set the package directory
89a5062 pylibfdt: Use environment to pass C flags and files
4e0e0d0 pylibfdt: Allow pkg-config to be supplied in the environment
756ffc4 Build pylibfdt as part of the normal build process
8cb3896 Adjust libfdt.h to work with swig
b40aa83 Mention pylibfdt in the documentation
12cfb74 Add tests for pylibfdt
50f2507 Add an initial Python library for libfdt
v1.4.5 has come out and has our changes in it except for the fdtget symlink following. We plan to stop using that when cros_config_host is ready, so I'll hold off switching back to upstream until then.
Comment 1 by sjg@chromium.org
, Mar 21 2017