[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openembedded-core
Subject:    [OE-core][PATCH] python3: Fix sysroot reproducibility
From:       "Joshua Watt" <JPEWhacker () gmail ! com>
Date:       2021-09-30 20:41:59
Message-ID: 20210930204159.3451316-1-JPEWhacker () gmail ! com
[Download RAW message or body]

Content-Transfer-Encoding: 8bit

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>
---
 meta/recipes-devtools/python/python3/reformat_sysconfig.py | 2 +-
 meta/recipes-devtools/python/python3_3.9.6.bb              | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/meta/recipes-devtools/python/python3/reformat_sysconfig.py \
b/meta/recipes-devtools/python/python3/reformat_sysconfig.py index \
                c4164313e8..5e2b12879d 100644
--- a/meta/recipes-devtools/python/python3/reformat_sysconfig.py
+++ b/meta/recipes-devtools/python/python3/reformat_sysconfig.py
@@ -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')
 
diff --git a/meta/recipes-devtools/python/python3_3.9.6.bb \
b/meta/recipes-devtools/python/python3_3.9.6.bb index f04bfc3053..aae7837180 100644
--- a/meta/recipes-devtools/python/python3_3.9.6.bb
+++ b/meta/recipes-devtools/python/python3_3.9.6.bb
@@ -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
-- 
2.33.0



-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#156508): https://lists.openembedded.org/g/openembedded-core/message/156508
Mute This Topic: https://lists.openembedded.org/mt/85984000/4454766
Group Owner: openembedded-core+owner@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [openembedded-core@marc.info]
-=-=-=-=-=-=-=-=-=-=-=-



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic