Skip to main content

specfile.spec_parser

SpecParser

class SpecParser()

Class that represents a spec file parser.

Attributes:

  • sourcedir - Path to sources and patches.
  • macros - List of extra macro definitions.
  • force_parse - Whether to attempt to parse the spec file even if one or more sources required to be present at parsing time are not available. Such sources include sources referenced from shell expansions in tag values and sources included using the %include directive.
  • spec - rpm.spec instance representing parsed spec file.
  • tainted - Indication that parsing of the spec file was forced and one or more sources required to be present at parsing time were not available and were replaced with dummy files.

parse

def parse(
content: str,
extra_macros: Optional[List[Tuple[str,
Optional[str]]]] = None) -> None

Parses the content of a spec file and updates the spec and tainted attributes.

Arguments:

  • content - String representing the content of a spec file.
  • extra_macros - List of extra macro definitions.

Raises:

  • RPMException - If parsing error occurs.