]> code.ossystems Code Review - openembedded-core.git/commitdiff
python3: Fix sysroot reproducibility
authorJoshua Watt <JPEWhacker@gmail.com>
Thu, 30 Sep 2021 20:41:59 +0000 (15:41 -0500)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 1 Oct 2021 13:51:23 +0000 (14:51 +0100)
Fixes the reformatting of the sysconfigdata to be reproducible in the
sysroot as well as in the package. During this a bug was uncovered in
the way that the data was reformatted where it appears that python
cannot parse a single line of code over 40000 characters. To work around
this, pass a maximum with of "1" to pprint instead of sys.maxsize which
will cause it to wrap as often as possible and should keep it
reproducible.

Signed-off-by: Joshua Watt <JPEWhacker@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-devtools/python/python3/reformat_sysconfig.py
meta/recipes-devtools/python/python3_3.9.6.bb

index c4164313e8b8eb6ed7c6e3bb777dde489907ef2d..5e2b12879d9578183aa1dfebd27c3ba34f088ea5 100644 (file)
@@ -16,6 +16,6 @@ with open(sys.argv[1], 'r') as f:
 with open(sys.argv[1], 'w') as f:
     for k in sorted(l.keys()):
         f.write('%s = ' % k)
-        pprint.pprint(l[k], stream=f, width=sys.maxsize)
+        pprint.pprint(l[k], stream=f, width=1)
         f.write('\n')
 
index f04bfc30530984e26bfc55109e87000a1b194825..aae7837180ad5874b58ab3c3278e8219b7127721 100644 (file)
@@ -161,6 +161,10 @@ do_install:append:class-native() {
 }
 
 do_install:append() {
+        for c in ${D}/${libdir}/python${PYTHON_MAJMIN}/_sysconfigdata*.py; do
+            python3 ${WORKDIR}/reformat_sysconfig.py $c
+        done
+
         mkdir -p ${D}${libdir}/python-sysconfigdata
         sysconfigfile=`find ${D} -name _sysconfig*.py`
         cp $sysconfigfile ${D}${libdir}/python-sysconfigdata/_sysconfigdata.py