Пример #1
0
 def update(self) -> None:
     # explicitly discard old instance to prevent rpm from destroying
     # "sources" and "patches" lua tables after new instance is created
     self.spc = None
     self.spc = RpmHelper.get_rpm_spec(self.path, self.sources_location, self.predefined_macros)
     self.header = RpmHeader(self.spc.sourceHeader)
     self.spec_content = self._read_spec_content()
     self.tags = Tags(self.spec_content, SpecContent(self.spc.parsed))
     self._update_data()
Пример #2
0
    def __init__(self, path: str, sources_location: str = '', predefined_macros: Optional[Dict[str, str]] = None,
                 lookaside_cache_preset: str = 'fedpkg', keep_comments: bool = False):
        # Initialize attributes
        self.path: str = path
        self.sources_location: str = sources_location
        self.predefined_macros: Dict[str, str] = predefined_macros or {}
        self.lookaside_cache_preset: str = lookaside_cache_preset
        self.keep_comments: bool = keep_comments
        self.prep_section: str = ''
        self.sources: List[str] = []
        self.patches: Dict[str, List[PatchObject]] = {}
        self.removed_patches: List[str] = []
        self.category: Optional[PackageCategory] = None
        self.spc: rpm.spec = RpmHelper.get_rpm_spec(self.path, self.sources_location, self.predefined_macros)
        self.header: RpmHeader = RpmHeader(self.spc.sourceHeader)
        self.spec_content: SpecContent = self._read_spec_content()
        self.tags: Tags = Tags(self.spec_content, SpecContent(self.spc.parsed))

        # Load rpm information
        self._update_data()