%pyproject_save_files: Add a workaround error for spaces and [brackets]

See the added links for details.
We cannot fix this for now,
so we error out early instead of producing a broken filelist.
This commit is contained in:
Miro Hrončok 2021-09-08 23:14:57 +02:00
parent 27cff80a5f
commit 5b8bb42933
2 changed files with 12 additions and 1 deletions

View File

@ -115,6 +115,7 @@ export HOSTNAME="rpmbuild" # to speedup tox in network-less mock, see rhbz#1856
%changelog
* Thu Sep 09 2021 Miro Hrončok <mhroncok@redhat.com> - 0-47
- %%pyproject_save_files: Expand the namespace error message, also display it with /
- %%pyproject_save_files: Add a workaround error for spaces and [brackets]
* Fri Jul 23 2021 Miro Hrončok <miro@hroncok.cz> - 0-46
- %%pyproject_buildrequires now fails when it encounters an invalid requirement

View File

@ -240,7 +240,8 @@ def escape_rpm_path(path):
unless we put it in "quotes".
Or a literal % symbol in path might be expanded as a macro if not escaped.
Due to limitations in RPM, paths with spaces and double quotes are not supported.
Due to limitations in RPM,
some paths with spaces and other special characters are not supported.
Examples:
@ -263,6 +264,11 @@ def escape_rpm_path(path):
Traceback (most recent call last):
...
NotImplementedError: ...
>>> escape_rpm_path('/usr/share/data/spaces and [square brackets]')
Traceback (most recent call last):
...
NotImplementedError: ...
"""
orig_path = path = str(path)
if "%" in path:
@ -275,6 +281,10 @@ def escape_rpm_path(path):
# As far as we know, RPM cannot list such file individually
# See this thread http://lists.rpm.org/pipermail/rpm-list/2021-June/002048.html
raise NotImplementedError(f'" symbol in path with spaces is not supported by %pyproject_save_files: {orig_path!r}')
if "[" in path or "]" in path:
# See https://bugzilla.redhat.com/show_bug.cgi?id=1990879
# and https://github.com/rpm-software-management/rpm/issues/1749
raise NotImplementedError(f'[ or ] symbol in path with spaces is not supported by %pyproject_save_files: {orig_path!r}')
return f'"{path}"'
return path