Skip to main content

specfile.sourcelist

SourcelistEntry

class SourcelistEntry()

Class that represents a spec file source/patch in a %sourcelist/%patchlist.

Attributes:

  • location - Literal location of the source/patch as stored in the spec file.
  • comments - List of comments associated with the source/patch.
  • valid - Whether the entry is not located in a false branch of a condition.

__init__

def __init__(location: str,
comments: Comments,
valid: bool = True,
context: Optional["Specfile"] = None) -> None

Initializes a sourcelist entry object.

Arguments:

  • location - Literal location of the source/patch as stored in the spec file.
  • comments - List of comments associated with the source/patch.
  • valid - Whether the entry is not located in a false branch of a condition.
  • context - Specfile instance that defines the context for macro expansions.

expanded_location

@property
def expanded_location() -> str

URL of the source/patch after expanding macros.

Sourcelist

class Sourcelist(UserList[SourcelistEntry])

Class that represents entries in a %sourcelist/%patchlist section.

Attributes:

  • data - List of individual sources/patches.

__init__

def __init__(data: Optional[List[SourcelistEntry]] = None,
remainder: Optional[List[str]] = None) -> None

Initializes a sourcelist object.

Arguments:

  • data - List of individual sources/patches.
  • remainder - Leftover lines in a section that can't be parsed into sources/patches.

parse

@classmethod
def parse(cls,
section: Section,
context: Optional["Specfile"] = None) -> "Sourcelist"

Parses a section into sources/patches.

Arguments:

  • section - %sourcelist/%patchlist section.
  • context - Specfile instance that defines the context for macro expansions.

Returns:

New instance of Sourcelist class.

get_raw_section_data

def get_raw_section_data() -> List[str]

Reconstructs section data from sources/patches.

Returns:

List of lines forming the reconstructed section data.