specfile
specfile copied to clipboard
Whitespace after section header messes up with section namings
What happened? What is the problem?
Hello, I was wondering why there isn't a build or install section found in flowblade.spec.
When I parse the spec, I get:
>>> from specfile import Specfile
>>> specfile = Specfile('flowblade.spec')
>>> with specfile.sections() as sections:
... for section in sections:
... print(section.name, section.options)
...
package
description
prep
generate_buildrequires
build
install
check
files -f flowblade-trunk/%{name}.lang
changelog
>>> with specfile.sections() as sections:
... print("build" in sections)
... print("install" in sections)
...
False
False
I examined the specfile, and I found it has:
%build[space here]
...
%install[spec here]
Indeed, sections.get("build ")
works.
I did not expect this to obfuscate the result of "build" in sections
or sections.build
. This means the only reliable way to get the build section is to iterate all the sections and look at the name.
What did you expect to happen?
I expected the insignificant trailing whitespace to be ignored.
Example URL(s)
https://src.fedoraproject.org/rpms/flowblade/blob/50cab22e213a45b84a6f839057b436f6430e422f/f/flowblade.spec
Steps to reproduce
See above
Workaround
- [X] There is an existing workaround that can be used until this issue is fixed.
Participation
- [ ] I am willing to submit a pull request for this issue. (Packit team is happy to help!)