Don't measure wheel size with du

The `du` tool estimates disk usage, so filesystem settings
(block size, compression, holes, etc.) might change the result.

Use `stat` instead for a more reproducible result.

Note that I've changed 900 (KiB) to 900000 (bytes) which is in fact not correct
(900 KiB is 921600 bytes),
but I assumed a human-readable round number works better here.
I've updated the comment to say kB instead of KiB.

Fixes https://bugzilla.redhat.com/2143393
This commit is contained in:
Miro Hrončok 2022-11-23 17:03:09 +01:00
parent b61d86b965
commit 8d079510db

View File

@ -180,9 +180,9 @@ install -p %{_pyproject_wheeldir}/%{python_wheel_name} -t %{buildroot}%{python_w
cat pkg_resources/_vendor/vendored.txt setuptools/_vendor/vendored.txt > allvendor.txt cat pkg_resources/_vendor/vendored.txt setuptools/_vendor/vendored.txt > allvendor.txt
%{_rpmconfigdir}/pythonbundles.py allvendor.txt --namespace 'python%{python3_pkgversion}dist' --compare-with '%{bundled}' %{_rpmconfigdir}/pythonbundles.py allvendor.txt --namespace 'python%{python3_pkgversion}dist' --compare-with '%{bundled}'
# Regression test, the wheel should not be larger than 900 KiB # Regression test, the wheel should not be larger than 900 kB
# https://bugzilla.redhat.com/show_bug.cgi?id=1914481#c3 # https://bugzilla.redhat.com/show_bug.cgi?id=1914481#c3
test $(du %{_pyproject_wheeldir}/%{python_wheel_name} | cut -f1) -lt 900 test $(stat --format %%s %{_pyproject_wheeldir}/%{python_wheel_name}) -lt 900000
# Regression test, the tests are not supposed to be installed # Regression test, the tests are not supposed to be installed
test ! -d %{buildroot}%{python3_sitelib}/pkg_resources/tests test ! -d %{buildroot}%{python3_sitelib}/pkg_resources/tests