specfile
specfile copied to clipboard
Cannot parse vlc.spec
What happened? What is the problem?
With this script:
#!/usr/bin/python3
from specfile import Specfile
import sys
# this is dump, but do the work
filename = sys.argv[1]
specfile = Specfile(filename, force_parse=True)
with specfile.sections() as sections:
print(sections.changelog)
I cannot parse vlc.spec from Fedora.
It fails with this TB:
Created dummy sources for nonexistent files:
rpm-specs/macros.vlc
Traceback (most recent call last):
File "/usr/lib/python3.12/site-packages/specfile/spec_parser.py", line 226, in get_rpm_spec
return rpm.spec(tmp.name, flags)
^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: can't parse specfile
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/lib/python3.12/site-packages/specfile/spec_parser.py", line 294, in _do_parse
spec = get_rpm_spec(content, rpm.RPMSPEC_ANYARCH | rpm.RPMSPEC_FORCE)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/site-packages/specfile/spec_parser.py", line 228, in get_rpm_spec
raise RPMException(stderr=stderr) from e
specfile.exceptions.RPMException: /tmp/tmp5e9nmd30: line 51: failed to load macro file rpm-specs/macros.vlc
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.12/site-packages/specfile/spec_parser.py", line 226, in get_rpm_spec
return rpm.spec(tmp.name, flags)
^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: can't parse specfile
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/msuchy/projects/license-validate/./print-spec-changelog.py", line 7, in <module>
specfile = Specfile(filename, force_parse=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/site-packages/specfile/specfile.py", line 72, in __init__
self._parser.parse(str(self))
File "/usr/lib/python3.12/site-packages/specfile/spec_parser.py", line 380, in parse
self.spec, self.tainted = self._do_parse(content, extra_macros)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.12/site-packages/specfile/spec_parser.py", line 319, in _do_parse
spec = get_rpm_spec(
^^^^^^^^^^^^^
File "/usr/lib/python3.12/site-packages/specfile/spec_parser.py", line 228, in get_rpm_spec
raise RPMException(stderr=stderr) from e
specfile.exceptions.RPMException: file trigger conditions must begin with '/': %{vlc_plugindir}
What did you expect to happen?
Printing changelog of this specfile.
Example URL(s)
No response
Steps to reproduce
No response
Workaround
- [ ] 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!)