Search code examples
pythonpython-3.xpipdebiandeb

.deb packaged python wheel files differ from the unpackaged ones?


I have to pack Python wheels into .deb, and for that I use simple debian/rules:

%:
    dh $@

And I have a pipdebs.install file:

#!/usr/bin/dh-exec

../external/python3.10/wheels /usr/lib/python3.10/.cache/pip/
../external/python3.10/requirements.txt /usr/lib/python3.10/.cache/pip/

But the problem is that when I build .deb and extract wheels directory from data.tar.zst/usr/lib/python3.10/.cache/pip/wheels then it differs from the ../external/python3.10/wheels one.

Why is that?


Solution

  • I have reproduced your error with debhelper-compat (=13). Next time you run dpkg-buildpackage, pay attention to the console output. I got following (interesting) message:

    dh_strip_nondeterminism
        Normalizing ... using File::StripNondeterminism::handlers::zip
    

    Quick googling results in that

    StripNondeterminism is a library for stripping non-deterministic information such as timestamps and filesystem ordering from various file and archive formats.

    So, that also explains why your wheels inside .deb differ from the ones you have outside .deb.

    Workaround is (YYY is your Package: in debian/control that you don't want to perform dh_strip_nondeterminism on and XXX is the package you want to perform dh_strip_nondeterminism on ):

    override_dh_strip_nondeterminism:
        dh_strip_nondeterminism --package=XXX
    

    Note, that this workaround will do the dh_strip_nondeterminism only for the XXX package and not for others YYY, ... packages