[OE-core] [PATCH 4/6] python3-core: improve reproducibility

Hongxu Jia hongxu.jia at windriver.com
Fri Feb 2 02:13:44 UTC 2018


On 2018年02月02日 03:27, Burton, Ross wrote:
> On 12 January 2018 at 08:11, Hongxu Jia <hongxu.jia at windriver.com 
> <mailto:hongxu.jia at windriver.com>> wrote:
>
>     +  # Recompile _sysconfigdata after modifying it
>     +       cd ${PKGD}
>     +       ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} \
>     +            -c "from py_compile import compile;
>     compile('./${libdir}/python${PYTHON_MAJMIN}/_sysconfigdata.py')"
>     +       ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} \
>     +            -c "from py_compile import compile;
>     compile('./${libdir}/python${PYTHON_MAJMIN}/_sysconfigdata.py',
>     optimize=1)"
>     +       ${STAGING_BINDIR_NATIVE}/${PYTHON_PN}-native/${PYTHON_PN} \
>     +            -c "from py_compile import compile;
>     compile('./${libdir}/python${PYTHON_MAJMIN}/_sysconfigdata.py',
>     optimize=2)"
>     +       cd -
>
>
> Do we really need to generate optimise=1 and optimise=2 variants for a 
> file which is just data?
>

Yes, with a simple search in ${D}, any py file has a triples pyc

$ find image/ -name "site.cpython-35*"
image/usr/lib64/python3.5/__pycache__/site.cpython-35.pyc
image/usr/lib64/python3.5/__pycache__/site.cpython-35.opt-1.pyc
image/usr/lib64/python3.5/__pycache__/site.cpython-35.opt-2.pyc

If we do not require to generate so many duplicate optimize file,
I could improve python3's do_install process, but I am not sure
it is really necessary.

> I'd suggest something like this would be neater:
>
> rm -f ${PKGD}/${libdir}/python*/__pycache__/_sysconfigdata.*
> nativepython -m py_compile ${PKGD}/${libdir}/python*/_sysconfigdata.py
>

I ust refer distutil* bbclass in oe-core.

//Hongxu

> Ross


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openembedded.org/pipermail/openembedded-core/attachments/20180202/37fdb937/attachment-0002.html>


More information about the Openembedded-core mailing list