Exemplo n.º 1
0
    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
Exemplo n.º 2
0
 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+?)\}')
Exemplo n.º 3
0
 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+?)\}')
Exemplo n.º 4
0
    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