def _readMacroFromFile(self, currentPos, lines): macro = rpmMacro() line = lines[currentPos] macro.position = currentPos macro.endposition = currentPos endPos = len(lines) line = " ".join(line.split()) flagindex = line.find(" ") if flagindex != -1: macro.macroFlag = line[flagindex + 1:] macro.macroName = line[:flagindex] else: macro.macroName = line if currentPos + 1 < len(lines) and self._isMacro( lines[currentPos + 1]): return macro, currentPos for j in range(currentPos + 1, endPos): content = lines[j] if j + 1 < endPos and self._isMacro(lines[j + 1]): return macro, j macro.content += content + '\n' macro.endposition = j return macro, endPos
def __init__(self): self.cleanMacro = rpmMacro().setName("clean") self.prepMacro = rpmMacro().setName("prep") self.buildMacro = rpmMacro().setName("build") self.installMacro = rpmMacro().setName("install") self.changelogMacro = rpmMacro().setName("changelog") self.checkMacro = rpmMacro().setName("check") self.packages = {} self.specAdditionalContent = "" self.globalSecurityHardening = "" self.defs = {} self.conditionalCheckMacroEnabled = False self.macro_pattern = re.compile(r'%{(\S+?)\}')
def __init__(self): self.cleanMacro = rpmMacro().setName("clean") self.prepMacro = rpmMacro().setName("prep") self.buildMacro = rpmMacro().setName("build") self.installMacro = rpmMacro().setName("install") self.changelogMacro = rpmMacro().setName("changelog") self.checkMacro = rpmMacro().setName("check") self.packages = {} self.specAdditionalContent = "" self.globalSecurityHardening = "" self.defs = {} self.conditionalCheckMacroEnabled = False self.macro_pattern = re.compile(r'%{(\S+?)\}')
def _readMacroFromFile(self, currentPos, lines): macro = rpmMacro() line = lines[currentPos] macro.position = currentPos macro.endposition = currentPos endPos = len(lines) line = " ".join(line.split()) flagindex = line.find(" ") if flagindex != -1: macro.macroFlag = line[flagindex+1:] macro.macroName = line[:flagindex] else: macro.macroName = line if currentPos + 1 < len(lines) and self._isMacro(lines[currentPos+1]): return macro, currentPos for j in range(currentPos + 1, endPos): content = lines[j] if j+1 < endPos and self._isMacro(lines[j+1]): return macro, j macro.content += content +'\n' macro.endposition = j return macro, endPos