POC: keep only cache for large, autogenerated files
This saves about 2 MiB from the package. When all rpms get extracted, the comparison is as follows on an ext4 filesystem: With this patch: $ du -s usr 195828 usr/ Without this patch: $ du -s usr 198224 usr/ Which is a difference of 2.396 MiB. To reduce the filesystem footprint of the Python installation, some files are now being removed and only one level of their pycache (non-optimized) is being kept. These particular files were chosen for their size and the fact that they are autogenerated, thus hard to read.
This commit is contained in:
parent
0a760f01ca
commit
740668aab7
@ -17,7 +17,7 @@ URL: https://www.python.org/
|
|||||||
%global prerel b4
|
%global prerel b4
|
||||||
%global upstream_version %{general_version}%{?prerel}
|
%global upstream_version %{general_version}%{?prerel}
|
||||||
Version: %{general_version}%{?prerel:~%{prerel}}
|
Version: %{general_version}%{?prerel:~%{prerel}}
|
||||||
Release: 1%{?dist}
|
Release: 2%{?dist}
|
||||||
License: Python
|
License: Python
|
||||||
|
|
||||||
|
|
||||||
@ -1014,6 +1014,13 @@ ln -s ./python3-debug %{buildroot}%{_bindir}/python-debug
|
|||||||
%endif
|
%endif
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
|
# Remove large, autogenerated sources and keep only the non-optimized pycache
|
||||||
|
for file in %{buildroot}%{pylibdir}/pydoc_data/topics.py $(grep --include='*.py' -lr %{buildroot}%{pylibdir}/encodings -e 'Python Character Mapping Codec .* from .* with gencodec.py'); do
|
||||||
|
directory=$(dirname ${file})
|
||||||
|
module=$(basename ${file%%.py})
|
||||||
|
mv ${directory}/{__pycache__/${module}.cpython-%{pyshortver}.pyc,${module}.pyc}
|
||||||
|
rm ${directory}/{__pycache__/${module}.cpython-%{pyshortver}.opt-?.pyc,${module}.py}
|
||||||
|
done
|
||||||
|
|
||||||
# ======================================================
|
# ======================================================
|
||||||
# Checks for packaging issues
|
# Checks for packaging issues
|
||||||
@ -1595,6 +1602,9 @@ CheckPython optimized
|
|||||||
# ======================================================
|
# ======================================================
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Thu Jul 16 2020 Marcel Plch <mplch@redhat.com> - 3.9.0~b4-2
|
||||||
|
- Remove large, autogenerated Python sources and redundant pycache levels to reduce filesystem footprint
|
||||||
|
|
||||||
* Sat Jul 04 2020 Tomas Hrnciar <thrnciar@redhat.com> - 3.9.0~b4-1
|
* Sat Jul 04 2020 Tomas Hrnciar <thrnciar@redhat.com> - 3.9.0~b4-1
|
||||||
- Update to 3.9.0b4
|
- Update to 3.9.0b4
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user