GithubHelp home page GithubHelp logo

Comments (18)

bnavigator avatar bnavigator commented on August 16, 2024 1
python-sip6.spec

That has %fdupes -s doc and is irrelevant for python

from python-rpm-macros.

s-t-e-v-e-n-k avatar s-t-e-v-e-n-k commented on August 16, 2024 1

Trying to come up with a proof concept here, but the problem is that if you run %fdupes and then use compileall, the hardlinks get replaced. Still trying to think of a good solution.

from python-rpm-macros.

mcepl avatar mcepl commented on August 16, 2024

I wonder whether #151 is involved somehow.

from python-rpm-macros.

mcepl avatar mcepl commented on August 16, 2024

@Vogtinator, @bnavigator, and @bmwiedemann might be interested as well.

from python-rpm-macros.

Vogtinator avatar Vogtinator commented on August 16, 2024

This should support existing spec files since calling fdupes a second time should result in no changes

There could be some edge cases like %fdupes -s converting hardlinks to symlinks, but I recommend against %fdupes -s anyway...

from python-rpm-macros.

s-t-e-v-e-n-k avatar s-t-e-v-e-n-k commented on August 16, 2024

I think all python spec files now don't use %fdupes -s

from python-rpm-macros.

mcepl avatar mcepl commented on August 16, 2024

I think all python spec files now don't use %fdupes -s

Just for the record (none of these are much relevant for anything):

milic~/b/spec_factory$ rg -l 'fdupes -s' python-*
python-youtube-dl.spec
python-sip6.spec
python-pytest-expect.spec
python-pymediainfo.spec
python-OWSLib.spec
python-mkdocs.spec
python-livereload.spec
python-gphoto2.spec
python-ghp-import.spec
python-cangjie.spec
python-apipkg.spec
milic~/b/spec_factory$ 

However, it is really not much relevant for this discussion (delegated to Trello).

from python-rpm-macros.

bmwiedemann avatar bmwiedemann commented on August 16, 2024

In the last years, timestamps are mostly not a problem for .pyc files, because rpmbuild normalizes mtime via %clamp_mtime_to_source_date_epoch Y and .pyc headers usually default to checksum mode with SOURCE_DATE_EPOCH set.

What is a problem are variations (e.g. from ASLR) that go into .pyc files. Because .pyc files are memory-dumps of internal python state, they are hard to make properly reproducible.

e.g.

> cat test.py
lext = {'png', 'gif', 'jpg', 'pcx', 'pnm', 'tif', 'xpm'}

> for i in $(seq 10) ; do setarch -R python3.10 -m py_compile test.py ; md5sum __pycache__/test.cpython-310.pyc 
  done|sort -u|wc -l
10

from python-rpm-macros.

Vogtinator avatar Vogtinator commented on August 16, 2024

This is actually not directly about reproducible builds but about fixing a packaging issue: https://bugzilla.suse.com/show_bug.cgi?id=1207805

from python-rpm-macros.

bnavigator avatar bnavigator commented on August 16, 2024

Bug is non-public

from python-rpm-macros.

bnavigator avatar bnavigator commented on August 16, 2024

In the last years, timestamps are mostly not a problem for .pyc files, because rpmbuild normalizes mtime via %clamp_mtime_to_source_date_epoch Y and .pyc headers usually default to checksum mode with SOURCE_DATE_EPOCH set.

@bmwiedemann, is that also true for SLE/Leap? The py39 custom repos for 15.X builds always throw rpmlint errors because that one doesn't like the mtimes of the .pyc files. I ignore them.

from python-rpm-macros.

mcepl avatar mcepl commented on August 16, 2024

Bug is non-public

I am sorry about that, I tried to add you to the bug so it should be visible at least to you. Does it work?

from python-rpm-macros.

bnavigator avatar bnavigator commented on August 16, 2024

I can read it now.

Taking @bmwiedemann's input into account, I suspect this is a SLE/Leap only issue for Python 3.6 generated .pyc files.

%#FLAVOR#_compile is already part of %#FLAVOR#_pyproject_install. No harm in adding %fdupes before that call, so that duplicate source files get the same mtime. Legacy %python_install would need to get a bit more attention.

Alternative suggestion: Add -n to the %fdupes calls. I think in 99% of the cases, where identical .pyc files get deduplicated are empty __init__.py files.

from python-rpm-macros.

brjsp avatar brjsp commented on August 16, 2024

Alternative suggestion: Add -n to the %fdupes calls. I think in 99% of the cases, where identical .pyc files get deduplicated are empty __init__.py files.

no — 99% of cases are identical files for opt-0 and opt-1 (which make rpmlint unhappy as there are usually a lot of them)

from python-rpm-macros.

bnavigator avatar bnavigator commented on August 16, 2024

But those have always the same mtime and have never been a problem for reproducible builds due to deduplication.

from python-rpm-macros.

Vogtinator avatar Vogtinator commented on August 16, 2024

Yeah, the issue is only about *.py files getting replaced by hardlinks. Replacing .pyc files with hardlinks is fine, their mtime is not used.

from python-rpm-macros.

bnavigator avatar bnavigator commented on August 16, 2024

Really interested in your proof here. Because your last comment directly contradicts your concept of the initial post (#156 (comment))

Barely any packages calls %fdupes before the python compile, and if it does this it is only fixable in the package specfile not in the python macros.

from python-rpm-macros.

s-t-e-v-e-n-k avatar s-t-e-v-e-n-k commented on August 16, 2024

That was an evil idea, not a fiat accompli -- I'm still trying tings out, but I welcome your input.

from python-rpm-macros.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.