| Summary: | Create a way to clean old leftover python files and directories, when updating python packages | ||
|---|---|---|---|
| Product: | Mageia | Reporter: | Marc Krämer <mageia> |
| Component: | RPM Packages | Assignee: | Python Stack Maintainers <python> |
| Status: | NEW --- | QA Contact: | |
| Severity: | minor | ||
| Priority: | Normal | CC: | lewyssmith, marja11, yvesbrungard |
| Version: | 9 | ||
| Target Milestone: | --- | ||
| Hardware: | All | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Source RPM: | CVE: | ||
| Status comment: | |||
|
Description
Marc Krämer
2023-10-17 21:32:10 CEST
Those leftover files and/or directories were/are not owned by any pkg and thus not removed when updating the pkgs. Thanks for your comment, Jani. So what to do? Put this in ERRATA ? How to close the bug? CC:
(none) =>
lewyssmith @Jani: e.g. at least usr/lib/python3.7/site-packages/MgaRepo/plugins/__pycache__/__init__.cpython-37.pyc must come from a package. But why are cached files not put under /var/cache ? And if this is not an option, after uninstalling python the "__pycache__" dirs and the content should be removed. I would like to see the system more clean instead of having old files lying around and there is no "tool" to find and remove them. (In reply to Marc Krämer from comment #3) > @Jani: e.g. at least > usr/lib/python3.7/site-packages/MgaRepo/plugins/__pycache__/__init__.cpython- > 37.pyc must come from a package. > But why are cached files not put under /var/cache ? And if this is not an > option, after uninstalling python the "__pycache__" dirs and the content > should be removed. > > I would like to see the system more clean instead of having old files lying > around and there is no "tool" to find and remove them. Assigning to the python stack maintainers, maybe they know of a way (or can create one) how to handle this more cleanly Assignee:
bugsquad =>
python For mgarepo, I see that the difficulty comes from trying to separate mgarepo-ldap package. I think mgarepo-ldap fails to own
/usr/lib/python3.8/site-packages/MgaRepo/plugins/__pycache__/__init__.cpython-38.pyc
This could be solved by adding
%pycached %{python3_sitelib}/%{Uname}/plugins/__init__.py
But I wonder why it is useful to have this part separated from the main package.
Perhaps because of python3-ldap requirement. In this case, we can keep the package with only the README.LDAP and the Requires, without other files.CC:
(none) =>
yvesbrungard btw. I don't think this is a python only problem. E.g. for java-jdk: ls /etc/java/java-* /etc/java/java-11-openjdk: java-11-openjdk-11.0.10.0.1-0.0.ea.2.mga8.x86_64/ java-11-openjdk-11.0.15.0.10-1.2.mga8.x86_64/ java-11-openjdk-11.0.18.0.10-1.mga8.x86_64/ java-11-openjdk-11.0.11.0.9-0.1.mga8.x86_64/ java-11-openjdk-11.0.15.0.10-1.mga8.x86_64/ java-11-openjdk-11.0.18.0.10-1.mga9.x86_64/ java-11-openjdk-11.0.13.0.8-2.1.mga8.x86_64/ java-11-openjdk-11.0.17.0.8-1.1.mga8.x86_64/ /etc/java/java-17-openjdk: java-17-openjdk-17.0.7.0.7-1.mga9.x86_64/ java-17-openjdk-17.0.8.0.7-1.mga9.x86_64/ But I think this one has really wrong config settings.... Mgarepo should be fixed in cauldron. the best way to do this is declaring in %files each folder and file that the python package provide, but could be a pain, I use this on package that fails if we don't clean the previous files
%posttrans
if ls %{python3_sitelib}/|grep %{pypi_name}|grep -v %{version} ; then
rm -rf %{python3_sitelib}/$(ls %{python3_sitelib}/|grep %{pypi_name}|grep -v %{version})
fi
|