%doc and %license sorting is not stable
Opened this issue · 2 comments
when using pyp2rpm
with Django
or any other package that has multiple license or documentation files, the sorting is not stable
e.g. from a recent build of mine:
%license django/dispatch/license.txt django/contrib/gis/gdal/LICENSE django/contrib/gis/geos/LICENSE django/contrib/admin/static/admin/js/vendor/xregexp/LICENSE.txt django/contrib/admin/static/admin/js/vendor/jquery/LICENSE.txt django/contrib/admin/static/admin/js/vendor/select2/LICENSE.md django/contrib/admin/static/admin/css/vendor/select2/LICENSE-SELECT2.md django/contrib/admin/static/admin/fonts/LICENSE.txt django/contrib/admin/static/admin/img/LICENSE docs/_theme/djangodocs/static/fontawesome/LICENSE.txt LICENSE LICENSE.python
%doc django/contrib/admin/static/admin/fonts/README.txt django/contrib/admin/static/admin/img/README.txt docs/_theme/djangodocs/static/fontawesome/README.md tests/README.rst README.rst extras/README.TXT
%license LICENSE LICENSE.python django/contrib/admin/static/admin/css/vendor/select2/LICENSE-SELECT2.md django/contrib/admin/static/admin/fonts/LICENSE.txt django/contrib/admin/static/admin/img/LICENSE django/contrib/admin/static/admin/js/vendor/jquery/LICENSE.txt django/contrib/admin/static/admin/js/vendor/select2/LICENSE.md django/contrib/admin/static/admin/js/vendor/xregexp/LICENSE.txt django/contrib/gis/gdal/LICENSE django/contrib/gis/geos/LICENSE django/dispatch/license.txt docs/_theme/djangodocs/static/fontawesome/LICENSE.txt
%doc README.rst django/contrib/admin/static/admin/fonts/README.txt django/contrib/admin/static/admin/img/README.txt docs/_theme/djangodocs/static/fontawesome/README.md extras/README.TXT tests/README.rst
It's easiest to unmangle by putting each file on a distinct %license or %doc file. The collection of licenses or README files can actually exceed the maximum line length that RPM can parse, and does so with the current "ansible" python package. with ewll over 200 distinct README files and LICENSE files.
There is an even better way to do this: for bulky tools like ansible with hundreds of license files, use something like this:
Pre-stage licenses and docs into local dirs, to avoud path stripping
install -d %{buildroot}%{_defaultdocdir}/%{pypi_realname}-%{version}/%{pypi_realname}/
rsync -a --prune-empty-dirs %{pypi_realname}/
--exclude=docs/
--include=/
--include=README
--include=readme
--exclude=
%{buildroot}%{_defaultdocdir}/%{pypi_realname}-%{version}/%{pypi_realname}/