Exemplo n.º 1
0
 def printBanner( self ):
     print( "KDEROOT     : %s" % EmergeStandardDirs.emergeRoot( ), file = sys.stderr )
     print( "KDECOMPILER : %s" % compiler.getCompilerName( ), file = sys.stderr )
     print( "KDESVNDIR   : %s" % EmergeStandardDirs.svnDir( ), file = sys.stderr )
     print( "KDEGITDIR   : %s" % EmergeStandardDirs.gitDir( ), file = sys.stderr )
     print( "DOWNLOADDIR : %s" % EmergeStandardDirs.downloadDir( ), file = sys.stderr )
     print( "PYTHONPATH  : %s" % emergeSettings.get( "Paths", "Python" ), file = sys.stderr )
Exemplo n.º 2
0
    def getEnv( self ):
        out = dict( )
        if compiler.isMSVC( ):
            compilerDirs = {
                "msvc2010": "VS100COMNTOOLS",
                "msvc2012": "VS110COMNTOOLS",
                "msvc2013": "VS120COMNTOOLS",
                "msvc2015": "VS140COMNTOOLS"
            }
            architectures = { "x86": "x86", "x64": "amd64", "x64_cross": "x86_amd64" }
            crossmodifier = ""
            if not compiler.isNative(): crossmodifier="_cross"
            status, result = subprocess.getstatusoutput( "\"%s\\..\\..\\VC\\vcvarsall.bat\" %s > NUL && set" % (
                os.getenv( compilerDirs[ compiler.getCompilerName( ) ] ), architectures[ compiler.architecture( ) + crossmodifier ]) )
            if status != 0:
                print( "Failed to setup msvc compiler", file = sys.stderr )
            out = self.stringToEnv( result )

        elif compiler.isIntel( ):
            architectures = { "x86": "ia32", "x64": "intel64" }
            programFiles = os.getenv( "ProgramFiles(x86)" ) or os.getenv( "ProgramFiles" )
            status, result = subprocess.getstatusoutput(
                "\"%s\\Intel\\Composer XE\\bin\\compilervars.bat\" %s > NUL && set" % (
                    programFiles, architectures[ compiler.architecture( ) ]) )
            if status != 0:
                print( "Failed to setup intel compiler", file = sys.stderr )
            out = self.stringToEnv( result )
        elif compiler.isMinGW( ):
            out = { "Path": os.getenv( "Path" ) }
        return out
Exemplo n.º 3
0
def handlePackage( category, packageName, buildAction, continueFlag, skipUpToDateVcs ):
    EmergeDebug.debug_line()
    EmergeDebug.info("Handling package: %s, action: %s" % (packageName, buildAction))

    success = True
    package = portage.getPackageInstance( category, packageName )
    if package is None:
        raise portage.PortageException( "Package not found", category, packageName )

    if buildAction in [ "all", "full-package", "update", "update-all" ]:
        success = success and doExec( package, "fetch", continueFlag )
        if success and skipUpToDateVcs and package.subinfo.hasSvnTarget( ):
            revision = package.sourceVersion( )
            for p in InstallDB.installdb.getInstalledPackages( category, packageName ):
                if p.getRevision( ) == revision:
                    EmergeDebug.info("Skipping further actions, package is up-to-date")
                    return True

        success = success and doExec( package, "unpack", continueFlag )
        success = success and doExec( package, "compile" )
        success = success and doExec( package, "cleanimage" )
        success = success and doExec( package, "install" )
        if buildAction in [ "all", "update", "update-all" ]:
            success = success and doExec( package, "qmerge" )
        if buildAction == "full-package":
            success = success and doExec( package, "package" )
        success = success or continueFlag
    elif buildAction in [ "fetch", "unpack", "configure", "compile", "make", "checkdigest",
                          "dumpdeps", "test",
                          "package", "unmerge", "cleanimage", "cleanbuild", "createpatch",
                          "geturls",
                          "print-revision",
                          "print-files"
                        ]:
        success = doExec( package, buildAction, continueFlag )
    elif buildAction == "install":
        success = doExec( package, "cleanimage" )
        success = success and doExec( package, "install", continueFlag )
    elif buildAction == "qmerge":
        #success = doExec( package, "cleanimage" )
        #success = success and doExec( package, "install")
        success = success and doExec( package, "qmerge" )
    elif buildAction == "generate-jenkins-job":
        success = jenkins.generateJob(package)
    elif buildAction == "print-source-version":
        print( "%s-%s" % ( packageName, package.sourceVersion( ) ) )
        success = True
    elif buildAction == "print-package-version":
        print( "%s-%s-%s" % ( packageName, compiler.getCompilerName( ), package.sourceVersion( ) ) )
        success = True
    elif buildAction == "print-targets":
        portage.printTargets( category, packageName )
        success = True
    else:
        success = EmergeDebug.error("could not understand this buildAction: %s" % buildAction)

    return success
Exemplo n.º 4
0
    def imageDirPattern(self):
        """return base directory name for package related image directory"""
        directory = "image"

        if self.subinfo.options.useCompilerType == True:
            directory += '-' + compiler.getCompilerName()
        if self.subinfo.options.useBuildType == True:
            directory += '-' + self.buildType()
        directory += '-' + self.buildTarget
        return directory
Exemplo n.º 5
0
    def imageDirPattern(self):
        """return base directory name for package related image directory"""
        directory = "image"

        if self.subinfo.options.useCompilerType == True:
            directory += '-' + compiler.getCompilerName()
        if self.subinfo.options.useBuildType == True:
            directory += '-' + self.buildType()
        directory += '-' + self.buildTarget
        return directory
Exemplo n.º 6
0
 def printBanner(self):
     print("KDEROOT     : %s" % EmergeStandardDirs.emergeRoot(),
           file=sys.stderr)
     print("KDECOMPILER : %s" % compiler.getCompilerName(), file=sys.stderr)
     print("KDESVNDIR   : %s" % EmergeStandardDirs.svnDir(),
           file=sys.stderr)
     print("KDEGITDIR   : %s" % EmergeStandardDirs.gitDir(),
           file=sys.stderr)
     print("DOWNLOADDIR : %s" % EmergeStandardDirs.downloadDir(),
           file=sys.stderr)
     print("PYTHONPATH  : %s" % emergeSettings.get("Paths", "Python"),
           file=sys.stderr)
Exemplo n.º 7
0
 def workDirPattern(self):
     """return base directory name for package related work directory"""
     directory = ""
     if self.subinfo.options.useCompilerType == True:
         directory += "%s-" % compiler.getCompilerName()
     if self.subinfo.options.cmake.useIDE or self.subinfo.options.cmake.openIDE:
         directory += "ide-"
     if self.subinfo.options.useBuildType == False:
         directory += "%s" % (self.buildTarget)
     elif( self.buildType() == None ):
         directory += "%s-%s" % ("default", self.buildTarget)
     else:
         directory += "%s-%s" % (self.buildType(), self.buildTarget)
     return directory
Exemplo n.º 8
0
 def workDirPattern(self):
     """return base directory name for package related work directory"""
     directory = ""
     if self.subinfo.options.useCompilerType == True:
         directory += "%s-" % compiler.getCompilerName()
     if self.subinfo.options.cmake.useIDE or self.subinfo.options.cmake.openIDE:
         directory += "ide-"
     if self.subinfo.options.useBuildType == False:
         directory += "%s" % (self.buildTarget)
     elif (self.buildType() == None):
         directory += "%s-%s" % ("default", self.buildTarget)
     else:
         directory += "%s-%s" % (self.buildType(), self.buildTarget)
     return directory
Exemplo n.º 9
0
    def imageDirPattern(self):
        """return base directory name for package related image directory"""
        directory = "image"

        # we assume that binary packages are for all compiler and targets
        ## \todo add image directory support for using binary packages for a specific compiler and build type
        if self.buildSystemType == 'binary':
            return directory

        if self.subinfo.options.useCompilerType == True:
            directory += '-' + compiler.getCompilerName()
        if self.subinfo.options.useBuildType == True:
            directory += '-' + self.buildType()
        directory += '-' + self.buildTarget
        return directory
Exemplo n.º 10
0
    def getEnv(self):
        out = dict()
        if compiler.isMSVC():
            compilerDirs = {
                "msvc2010": "VS100COMNTOOLS",
                "msvc2012": "VS110COMNTOOLS",
                "msvc2013": "VS120COMNTOOLS",
                "msvc2015": "VS140COMNTOOLS"
            }
            architectures = {
                "x86": "x86",
                "x64": "amd64",
                "x64_cross": "x86_amd64"
            }
            crossmodifier = ""
            if not compiler.isNative(): crossmodifier = "_cross"
            status, result = subprocess.getstatusoutput(
                "\"%s\\..\\..\\VC\\vcvarsall.bat\" %s > NUL && set" %
                (os.getenv(compilerDirs[compiler.getCompilerName()]),
                 architectures[compiler.architecture() + crossmodifier]))
            if status != 0:
                print("Failed to setup msvc compiler", file=sys.stderr)
                exit(1)
            out = self.stringToEnv(result)

        elif compiler.isIntel():
            architectures = {"x86": "ia32", "x64": "intel64"}
            programFiles = os.getenv("ProgramFiles(x86)") or os.getenv(
                "ProgramFiles")
            status, result = subprocess.getstatusoutput(
                "\"%s\\Intel\\Composer XE\\bin\\compilervars.bat\" %s > NUL && set"
                % (programFiles, architectures[compiler.architecture()]))
            if status != 0:
                print("Failed to setup intel compiler", file=sys.stderr)
                exit(1)
            out = self.stringToEnv(result)
        elif compiler.isMinGW():
            out = {"Path": os.getenv("Path")}
        return out
Exemplo n.º 11
0
 def compiler(self):
     """deprecated"""
     """return currently selected compiler"""
     return compiler.getCompilerName()
Exemplo n.º 12
0
def handlePackage(category, packageName, buildAction, continueFlag,
                  skipUpToDateVcs):
    with EmergeTimer.Timer("HandlePackage %s/%s" % (category, packageName),
                           3) as timer:
        EmergeDebug.debug_line()
        EmergeDebug.info("Handling package: %s, action: %s" %
                         (packageName, buildAction))

        success = True
        package = portage.getPackageInstance(category, packageName)
        if package is None:
            raise portage.PortageException("Package not found", category,
                                           packageName)

        if buildAction in ["all", "full-package", "update", "update-all"]:
            success = success and doExec(package, "fetch", continueFlag)
            skip = False
            if success and skipUpToDateVcs and package.subinfo.hasSvnTarget():
                revision = package.sourceVersion()
                for p in InstallDB.installdb.getInstalledPackages(
                        category, packageName):
                    if p.getRevision() == revision:
                        EmergeDebug.info(
                            "Skipping further actions, package is up-to-date")
                        skip = True
            if not skip:
                success = success and doExec(package, "unpack", continueFlag)
                success = success and doExec(package, "compile")
                success = success and doExec(package, "cleanimage")
                success = success and doExec(package, "install")
                if buildAction in ["all", "update", "update-all"]:
                    success = success and doExec(package, "qmerge")
                if buildAction == "full-package":
                    success = success and doExec(package, "package")
                success = success or continueFlag
        elif buildAction in [
                "fetch", "unpack", "configure", "compile", "make",
                "checkdigest", "dumpdeps", "test", "package", "unmerge",
                "cleanimage", "cleanbuild", "createpatch", "geturls",
                "print-revision", "print-files"
        ]:
            success = doExec(package, buildAction, continueFlag)
        elif buildAction == "install":
            success = doExec(package, "cleanimage")
            success = success and doExec(package, "install", continueFlag)
        elif buildAction == "qmerge":
            #success = doExec( package, "cleanimage" )
            #success = success and doExec( package, "install")
            success = success and doExec(package, "qmerge")
        elif buildAction == "print-source-version":
            print("%s-%s" % (packageName, package.sourceVersion()))
            success = True
        elif buildAction == "print-package-version":
            print("%s-%s-%s" % (packageName, compiler.getCompilerName(),
                                package.sourceVersion()))
            success = True
        elif buildAction == "print-targets":
            portage.printTargets(category, packageName)
            success = True
        else:
            success = EmergeDebug.error(
                "could not understand this buildAction: %s" % buildAction)

        timer.stop()
        utils.notify(
            "Emerge %s %s" %
            (buildAction, "succeeded" if success else "failed"),
            "%s of %s/%s %s after %s" %
            (buildAction, category, packageName,
             "succeeded" if success else "failed", timer), buildAction)
        return success
Exemplo n.º 13
0

def _replaceSetting(reg,new,text):
        return re.compile(reg, re.MULTILINE).sub(new,text)

def resetSettings():
    with open( os.path.join( EmergeStandardDirs.etcDir(), "kdesettings.ini.backup"),"rt+") as fin:
        text = fin.read()
    text = _replaceSetting("^PACKAGE_IGNORES.*$", "PACKAGE_IGNORES =", text)
    text = _replaceSetting("^EMERGE_USE_CCACHE.*$", "#EMERGE_USE_CCACHE = True", text)
    text = _replaceSetting("^Python =.*$", "Python = C:\python34", text)
    text = _replaceSetting("^DOWNLOADDIR =.*$", "#DOWNLOADDIR = C:\kde\download", text)
    with open( os.path.join( EmergeStandardDirs.etcDir(), "kdesettings.ini"),"wt+") as fout:
        fout.write(text)

if __name__ == "__main__":
    EmergeDebug.setVerbose(3)
    # we don't use the db directly and the file must not be locked
    del InstallDB.installdb
    backup()
    removeFromDB("dev-util")
    removeFromDB("gnuwin32")
    # we cant use the ini support to modify the settings as it would kill the comments
    resetSettings()
    utils.system("cd %s && git clean -xdf" % os.path.join(EmergeStandardDirs.emergeRoot(), "emerge"))
    utils.createDir(EmergeStandardDirs.tmpDir())
    archiveName = os.path.join(EmergeStandardDirs.tmpDir(), "framewroks-sdk-%s-%s-%s.7z" % (compiler.getCompilerName(), compiler.architecture(), datetime.datetime.fromtimestamp(time.time()).strftime('%Y-%m-%d')))
    utils.deleteFile(archiveName)
    utils.system("7za  a %s %s -x!build -x!msys -x!dev-utils -x!tmp -x!mingw* -x!etc/kdesettings.ini.backup -x!etc/portage/install.db.backup" % ( archiveName, EmergeStandardDirs.emergeRoot()))
    #utils.copyFile(os.path.join( EmergeStandardDirs.etcDir(), "kdesettings.ini"), os.path.join( EmergeStandardDirs.etcDir(), "kdesettings.ini.backup2"),linkOnly=False)
    restore()
Exemplo n.º 14
0
 def compiler(self):
     """deprecated"""
     """return currently selected compiler"""
     return compiler.getCompilerName()