Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot parse linux-system-roles.spec #234

Open
2 tasks
xsuchy opened this issue May 31, 2023 · 2 comments
Open
2 tasks

Cannot parse linux-system-roles.spec #234

xsuchy opened this issue May 31, 2023 · 2 comments
Labels
kind/bug Something isn't working.

Comments

@xsuchy
Copy link
Contributor

xsuchy commented May 31, 2023

What happened? What is the problem?

During parsing linux-system-roles.spec I get:

Created dummy sources for nonexistent files:                             
/tmp/rpm-specs/extrasources.inc
Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/specfile/spec_parser.py", line 201, 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.11/site-packages/specfile/spec_parser.py", line 269, in _do_parse
    spec = get_rpm_spec(content, rpm.RPMSPEC_ANYARCH | rpm.RPMSPEC_FORCE)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/specfile/spec_parser.py", line 203, in get_rpm_spec
    raise RPMException(stderr=stderr) from e
specfile.exceptions.RPMException: Unable to open /tmp/rpm-specs/extrasources.inc: No such file or directory

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/specfile/spec_parser.py", line 201, 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/specfile/tests/test-parsing/./parse.py", line 8, in <module>
    specfile = Specfile(filename, force_parse=True)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/specfile/specfile.py", line 71, in __init__
    self._parser.parse(str(self))
  File "/usr/lib/python3.11/site-packages/specfile/spec_parser.py", line 353, in parse
    self.spec, self.tainted = self._do_parse(content, extra_macros)
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/specfile/spec_parser.py", line 294, in _do_parse
    spec = get_rpm_spec(
           ^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/specfile/spec_parser.py", line 203, in get_rpm_spec
    raise RPMException(stderr=stderr) from e
specfile.exceptions.RPMException: Unable to open /tmp/rpm-specs/ansible-packaging.inc: No such file or directory
Error parsing linux-system-roles.spec

This seems to be because of:



  | # Includes with definitions/tags that differ between RHEL and Fedora
-- | --
  | Source1001: extrasources.inc
  |  
  | %include %{SOURCE1001}
  |  
  | # Includes with ansible_collection_build/_install that differ between RHEL versions
  | Source1002: ansible-packaging.inc
  |  
  | %include %{SOURCE1002}

The source1001 is created by 1002 not.

What did you expect to happen?

No response

Example URL(s)

No response

Steps to reproduce

1.
2.
3.

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!)
@xsuchy xsuchy added the kind/bug Something isn't working. label May 31, 2023
@nforro
Copy link
Member

nforro commented Jun 1, 2023

Thanks, I can confirm this is a bug, it looks like macro context will have to be repopulated on each occurence of %include.

@mfocko
Copy link
Member

mfocko commented Jun 20, 2024

Still relevant, not an easy fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working.
Projects
Status: backlog
Development

No branches or pull requests

3 participants