예제 #1
0
def PackagerFactory(parent, packagerType):
    """provides multi packager type api
    return PackagerBase derived instance for recent settings"""
    EmergeDebug.debug("PackagerFactory called", 2)
    packagers = []

    if packagerType:
        for packagerClass in packagerType:
            if not issubclass(packagerClass, PackagerBase):
                EmergeDebug.die("PackagerFactory: unsupported packager %s" % packagerClass)
            else:
                packager = packagerClass()
                init(packager, parent)
                packagers.append(packager)
    else:
        # automatic detection
        packager = InnoSetupPackager()
        init(packager, parent)

        if packager.configFile() != None:
            packagers.append(packager)

        # default packager
        if len(packagers) == 0:
            packager = KDEWinPackager()
            init(packager, parent)
            packagers.append(packager)
    return packagers
예제 #2
0
    def make(self):
        """implements the make step for cmake projects"""

        self.enterBuildDir()
        utils.prependPath(self.rootdir, self.envPath)

        if self.subinfo.options.cmake.openIDE:
            if compiler.isMSVC2008():
                command = "start %s" % self.__slnFileName()
            elif compiler.isMSVC2010():
                command = "start vcexpress %s" % self.__slnFileName()
        elif self.subinfo.options.cmake.useIDE:
            if compiler.isMSVC2008():
                command = "vcbuild /M1 %s \"%s|WIN32\"" % (
                    self.__slnFileName(), self.buildType())
            elif compiler.isMSVC2015():
                command = "msbuild /maxcpucount %s /t:ALL_BUILD /p:Configuration=\"%s\"" % (
                    self.__slnFileName(), self.buildType())
            elif compiler.isMSVC2010():
                EmergeDebug.die("has to be implemented")
        elif self.subinfo.options.cmake.useCTest:
            # first make clean
            self.system(self.makeProgramm + " clean", "make clean")
            command = "ctest -M " + "Nightly" + " -T Start -T Update -T Configure -T Build -T Submit"
        else:
            command = ' '.join([self.makeProgramm, self.makeOptions()])

        return self.system(command, "make")
 def __makeFileGenerator(self):
     """return cmake related make file generator"""
     if self.supportsNinja and emergeSettings.getboolean("Compile","UseNinja", False):
         return "Ninja"
     if compiler.isMSVC2015():
         if self.subinfo.options.cmake.useIDE or self.subinfo.options.cmake.openIDE:
             return "Visual Studio 14 2015" + " Win64" if compiler.isX64() else ""
         else:
             return "NMake Makefiles"
     if compiler.isMSVC2010():
         if self.subinfo.options.cmake.useIDE or self.subinfo.options.cmake.openIDE:
             return "Visual Studio 10"
         else:
             return "NMake Makefiles"
     elif compiler.isMSVC2008():
         if self.subinfo.options.cmake.useIDE or self.subinfo.options.cmake.openIDE:
             return "Visual Studio 9 2008"
         else:
             return "NMake Makefiles"
     elif compiler.isMSVC() or compiler.isIntel():
         return "NMake Makefiles"
     elif compiler.isMinGW():
         return "MinGW Makefiles"
     else:
         EmergeDebug.die("unknown %s compiler" % self.compiler())
예제 #4
0
def SourceFactory(settings):
    """ return sourceBase derived instance for recent settings"""
    EmergeDebug.trace("SourceFactory called", 1)
    source = None

    if settings.hasTarget():
        if settings.hasMultipleTargets():
            url = settings.targetAt(0)
        else:
            url = settings.target()
        source = ArchiveSource(settings)

    ## \todo move settings access into info class
    if settings.hasSvnTarget():
        url = settings.svnTarget()
        sourceType = utils.getVCSType( url )
        if sourceType == "svn":
            source = SvnSource(settings)
        elif sourceType == "hg":
            source = HgSource(settings)
        elif sourceType == "git":
            source = GitSource(settings)

    if source == None:
        EmergeDebug.die("none or unsupported source system set")
    if not source.subinfo:
        source.subinfo = settings
    source.url = url
    return source
    def make( self ):
        """implements the make step for cmake projects"""

        self.enterBuildDir()
        utils.prependPath(self.rootdir, self.envPath)

        if self.subinfo.options.cmake.openIDE:
            if compiler.isMSVC2008():
                command = "start %s" % self.__slnFileName()
            elif compiler.isMSVC2010():
                command = "start vcexpress %s" % self.__slnFileName()
        elif self.subinfo.options.cmake.useIDE:
            if compiler.isMSVC2008():
                command = "vcbuild /M1 %s \"%s|WIN32\"" % (self.__slnFileName(), self.buildType())
            elif compiler.isMSVC2015():
                command = "msbuild /maxcpucount %s /t:ALL_BUILD /p:Configuration=\"%s\"" % (self.__slnFileName(), self.buildType())
            elif compiler.isMSVC2010():
                EmergeDebug.die("has to be implemented");
        elif self.subinfo.options.cmake.useCTest:
            # first make clean
            self.system( self.makeProgramm + " clean", "make clean" )
            command = "ctest -M " + "Nightly" + " -T Start -T Update -T Configure -T Build -T Submit"
        else:
            command = ' '.join([self.makeProgramm, self.makeOptions()])


        return self.system( command, "make" )
예제 #6
0
 def compile(self):
     if not ("Paths", "Python27") in emergeSettings:
         EmergeDebug.die(
             "Please make sure Paths/Python27 is set in your kdesettings.ini"
         )
     utils.prependPath(emergeSettings.get("Paths", "PYTHON27", ""))
     return Qt5CorePackageBase.compile(self)
예제 #7
0
    def inner(*args, **argv):
        logdir = emergeSettings.get( "General", "EMERGE_LOG_DIR", "" )

        if logdir == "":
            return fn(*args, **argv)

        if os.path.isfile(logdir):
            EmergeDebug.die("EMERGE_LOG_DIR %s is a file" % logdir)

        if not os.path.exists(logdir):
            try:
                os.mkdir(logdir)
            except OSError:
                EmergeDebug.die("EMERGE_LOG_DIR %s can not be created" % logdir)

        logfile = ""
        for a in args:
            logfile += "%s-" % a
        logfile = logfile[:-1]#drop last -
        logfile = "%s.log" % logfile.replace("/","_").replace("\\","_")

        logfile = os.path.join(logdir, logfile)
        f = open(logfile, "at")
        try:
            old_out = sys.stdout
            old_err = sys.stderr
            sys.stdout = f
            sys.stderr = f
            return fn(*args, **argv)
        finally:
            sys.stdout = old_out
            sys.stderr = old_err
            f.close()
예제 #8
0
def PackagerFactory(parent, packagerType):
    """provides multi packager type api
    return PackagerBase derived instance for recent settings"""
    EmergeDebug.debug("PackagerFactory called", 2)
    packagers = []

    if packagerType:
        for packagerClass in packagerType:
            if not issubclass(packagerClass, PackagerBase):
                EmergeDebug.die("PackagerFactory: unsupported packager %s" %
                                packagerClass)
            else:
                packager = packagerClass()
                init(packager, parent)
                packagers.append(packager)
    else:
        # automatic detection
        packager = InnoSetupPackager()
        init(packager, parent)

        if packager.configFile() != None:
            packagers.append(packager)

        # default packager
        if len(packagers) == 0:
            packager = KDEWinPackager()
            init(packager, parent)
            packagers.append(packager)
    return packagers
예제 #9
0
    def generateNSISInstaller(self):
        """ runs makensis to generate the installer itself """

        self.isNsisInstalled()
        self._setDefaults()

        if not self.defines["icon"] == "":
            self.defines[
                "icon"] = "!define MUI_ICON \"%s\"" % self.defines["icon"]

        # make absolute path for output file
        if not os.path.isabs(self.defines["setupname"]):
            dstpath = self.packageDestinationDir()
            self.defines["setupname"] = os.path.join(dstpath,
                                                     self.defines["setupname"])

        definestring = ""
        for key in self.defines:
            definestring += " /D%s=\"%s\"" % (key, self.defines[key])

        EmergeDebug.new_line()
        EmergeDebug.debug("generating installer %s" %
                          self.defines["setupname"])

        verboseString = "/V4" if EmergeDebug.verbose() > 0 else "/V3"

        if self.isNsisInstalled:
            if not utils.systemWithoutShell(
                    "\"%s\" %s %s %s" %
                (self.nsisExe, verboseString, definestring, self.scriptname),
                    cwd=os.path.abspath(self.packageDir())):
                EmergeDebug.die("Error in makensis execution")
예제 #10
0
def embedManifest(executable, manifest):
    '''
       Embed a manifest to an executable using either the free
       kdewin manifest if it exists in dev-utils/bin
       or the one provided by the Microsoft Platform SDK if it
       is installed'
    '''
    if not os.path.isfile(executable) or not os.path.isfile(manifest):
        # We die here because this is a problem with the portage files
        EmergeDebug.die("embedManifest %s or %s do not exist" % (executable, manifest))
    EmergeDebug.debug("embedding ressource manifest %s into %s" % \
          (manifest, executable), 2)
    mtExe = None
    mtExe = os.path.join(EmergeStandardDirs.emergeRoot(), "dev-utils", "bin", "mt.exe")

    if(not os.path.isfile(mtExe)):
        # If there is no free manifest tool installed on the system
        # try to fallback on the manifest tool provided by visual studio
        sdkdir = regQuery("HKLM\SOFTWARE\Microsoft\Microsoft SDKs\Windows",
            "CurrentInstallFolder")
        if not sdkdir:
            EmergeDebug.debug("embedManifest could not find the Registry Key"
                  " for the Windows SDK", 2)
        else:
            mtExe = r'%s' % os.path.join(sdkdir, "Bin", "mt.exe")
            if not os.path.isfile(os.path.normpath(mtExe)):
                EmergeDebug.debug("embedManifest could not find a mt.exe in\n\t %s" % \
                      os.path.dirname(mtExe), 2)
    if os.path.isfile(mtExe):
        return system([mtExe, "-nologo", "-manifest", manifest,
            "-outputresource:%s;1" % executable])
    else:
        return system(["mt", "-nologo", "-manifest", manifest,
            "-outputresource:%s;1" % executable])
예제 #11
0
 def __makeFileGenerator(self):
     """return cmake related make file generator"""
     if self.supportsNinja and emergeSettings.getboolean(
             "Compile", "UseNinja", False):
         return "Ninja"
     if compiler.isMSVC2015():
         if self.subinfo.options.cmake.useIDE or self.subinfo.options.cmake.openIDE:
             return "Visual Studio 14 2015" + " Win64" if compiler.isX64(
             ) else ""
         else:
             return "NMake Makefiles"
     if compiler.isMSVC2010():
         if self.subinfo.options.cmake.useIDE or self.subinfo.options.cmake.openIDE:
             return "Visual Studio 10"
         else:
             return "NMake Makefiles"
     elif compiler.isMSVC2008():
         if self.subinfo.options.cmake.useIDE or self.subinfo.options.cmake.openIDE:
             return "Visual Studio 9 2008"
         else:
             return "NMake Makefiles"
     elif compiler.isMSVC() or compiler.isIntel():
         return "NMake Makefiles"
     elif compiler.isMinGW():
         return "MinGW Makefiles"
     else:
         EmergeDebug.die("unknown %s compiler" % self.compiler())
 def isInstalled(self):
     if not self._isInstalled:
         self._isInstalled = self.__isInstalled()
         if not self._isInstalled:
             EmergeDebug.die("could not find installed nsis package, "
                        "you can install it using emerge nsis or"
                        "download and install it from "
                        "http://sourceforge.net/projects/nsis/")
예제 #13
0
    def unpack(self):
        if not CMakePackageBase.unpack(self):
            return False
        # Check whether compiler is mingw or not...
        if self.compiler() != "mingw" and self.compiler() != "mingw4":
            EmergeDebug.die("This package is currently only compiled with mingw.")

        return True
예제 #14
0
 def isNsisInstalled(self):
     if not self._isInstalled:
         self._isInstalled = self.__isInstalled()
         if not self._isInstalled:
             EmergeDebug.die("could not find installed nsis package, "
                             "you can install it using emerge nsis or"
                             "download and install it from "
                             "http://sourceforge.net/projects/nsis/")
예제 #15
0
def getSimpleCompilerName():
    if isMinGW():
        return "mingw64"
    elif isMSVC():
        return "msvc"
    elif isIntel():
        return "intel"
    else:
        EmergeDebug.die("Unknown Compiler %s" % _compiler())
예제 #16
0
def getSimpleCompilerName():
    if isMinGW():
        return "mingw64"
    elif isMSVC():
        return "msvc"
    elif isIntel():
        return "intel"
    else:
        EmergeDebug.die("Unknown Compiler %s" % _compiler())
예제 #17
0
def getCompilerName():
    if isMinGW():
        return "mingw-w64"
    elif isMSVC():
        return _compiler()
    elif isIntel():
        return "intel-%s-%s" % (os.getenv("TARGET_ARCH"), os.getenv("TARGET_VS"))
    else:
        EmergeDebug.die("Unknown Compiler %s" % _compiler())
예제 #18
0
 def _compress(self, archiveName, sourceDir, destDir):
     utils.deleteFile(archiveName)
     cmd = "%s a -r %s %s/*" % (
         self.packagerExe, os.path.join(destDir, archiveName), sourceDir)
     cmd += " -bsp1"
     if EmergeDebug.verbose() <= 1:
         cmd += " -bso0"
     if not utils.system(cmd):
         EmergeDebug.die("while packaging. cmd: %s" % cmd)
예제 #19
0
def getDirname( category, package ):
    """ return absolute pathname for a given category and package """
    subpackage, package = getSubPackage( category, package )
    if category and package:
        if subpackage:
            return os.path.join( rootDirForPackage( category, subpackage ), category, subpackage, package )
        else:
            return os.path.join( rootDirForPackage( category, package ), category, package )
    else:
        EmergeDebug.die("broken category or package %s/%s" % (category, package))
예제 #20
0
def getCompilerName():
    if isMinGW():
        return "mingw-w64"
    elif isMSVC():
        return _compiler()
    elif isIntel():
        return "intel-%s-%s" % (os.getenv("TARGET_ARCH"),
                                os.getenv("TARGET_VS"))
    else:
        EmergeDebug.die("Unknown Compiler %s" % _compiler())
    def checkoutDir( self, dummyIndex=0 ):
        EmergeDebug.trace("VersionSystemSourceBase checkoutDir", 2)
        if self.subinfo.hasSvnTarget():
            sourcedir = os.path.join(  EmergeStandardDirs.gitDir(), self.package )
        else:
            EmergeDebug.die("svnTarget property not set for this target")

        if self.subinfo.targetSourceSuffix() != None:
            sourcedir = "%s-%s" % (sourcedir, self.subinfo.targetSourceSuffix())

        return os.path.abspath(sourcedir)
예제 #22
0
파일: portage.py 프로젝트: vibhcool/emerge
def rootDirForCategory(category):
    """this function should return the portage directory where it finds the first occurance of the category

throws exception if not found
"""
    # this function should return the portage directory where it finds the
    # first occurance of a category or the default value
    for i in rootDirectories():
        if category and os.path.exists(os.path.join(i, category)):
            return i
    EmergeDebug.die("can't find category %s" % category)
예제 #23
0
def rootDirForCategory( category ):
    """this function should return the portage directory where it finds the first occurance of the category

throws exception if not found
"""
    # this function should return the portage directory where it finds the
    # first occurance of a category or the default value
    for i in rootDirectories():
        if category and os.path.exists( os.path.join( i, category ) ):
            return i
    EmergeDebug.die("can't find category %s" % category)
예제 #24
0
 def __init__( self, parent=None ):
     self.parent = self
     if parent:
         self.parent = parent
     self.output = False
     self.outFile = None
     self.graphVizInstallPath = None
     if not self.isInstalled():
         utils.system("emerge.bat graphviz")
         if not self.isInstalled():
             EmergeDebug.die("could not find installed graphviz package, you may download and install it from http://www.graphviz.org/Download.php")
예제 #25
0
 def __init__( self ):
     BuildSystemBase.__init__(self, "qmake")
     self.platform = ""
     if compiler.isMSVC():
         self.platform = "win32-%s" % self.compiler()
     elif compiler.isMinGW():
         self.platform = "win32-g++"
     elif compiler.isIntel():
         self.platform = "win32-icc"
     else:
         EmergeDebug.die("QMakeBuildSystem: unsupported compiler platform %s" % self.compiler())
예제 #26
0
def cleanDirectory( directory ):
    EmergeDebug.debug("clean directory %s" % directory, 1)
    if ( os.path.exists( directory ) ):
        for root, dirs, files in os.walk( directory, topdown=False):
            for name in files:
                if not OsUtils.rm(os.path.join(root, name), True):
                    EmergeDebug.die("couldn't delete file %s\n ( %s )" % (name, os.path.join(root, name)))
            for name in dirs:
                if not OsUtils.rmDir(os.path.join(root, name), True):
                    EmergeDebug.die("couldn't delete directory %s\n( %s )" % (name, os.path.join(root, name)))
    else:
        os.makedirs( directory )
예제 #27
0
    def checkoutDir(self, dummyIndex=0):
        EmergeDebug.trace("VersionSystemSourceBase checkoutDir", 2)
        if self.subinfo.hasSvnTarget():
            sourcedir = os.path.join(EmergeStandardDirs.gitDir(), self.package)
        else:
            EmergeDebug.die("svnTarget property not set for this target")

        if self.subinfo.targetSourceSuffix() != None:
            sourcedir = "%s-%s" % (sourcedir,
                                   self.subinfo.targetSourceSuffix())

        return os.path.abspath(sourcedir)
예제 #28
0
 def make(self):
     if self.buildTarget == "1_55_0":
         cmd = "build.bat "
         if compiler.isClang():
             cmd += "clang"
         elif compiler.isMinGW():
             cmd += "gcc"
         else:
             if compiler.isMSVC2005():
                 cmd += "vc8"
             elif compiler.isMSVC2008():
                 cmd += "vc9"
             elif compiler.isMSVC2010():
                 cmd += "vc10"
         if EmergeDebug.verbose() >= 1:
             print(cmd)
         utils.system(
             cmd,
             cwd=os.path.join(
                 portage.getPackageInstance("win32libs", "boost-headers").sourceDir(),
                 "tools",
                 "build",
                 "v2",
                 "engine",
             ),
         ) or EmergeDebug.die("command: %s failed" % (cmd))
     else:
         cmd = "bootstrap.bat "
         if compiler.isMinGW():
             cmd += "mingw"
         else:
             if compiler.isMSVC2005():
                 cmd += "vc8"
             elif compiler.isMSVC2008():
                 cmd += "vc9"
             elif compiler.isMSVC2010():
                 cmd += "vc10"
             elif compiler.isMSVC2012():
                 cmd += "vc11"
             elif compiler.isMSVC2013():
                 cmd += "vc12"
             elif compiler.isMSVC2015():
                 cmd += "vc14"
         if EmergeDebug.verbose() >= 1:
             print(cmd)
         utils.system(
             cmd,
             cwd=os.path.join(
                 portage.getPackageInstance("win32libs", "boost-headers").sourceDir(), "tools", "build"
             ),
         ) or EmergeDebug.die("command: %s failed" % (cmd))
     return True
예제 #29
0
    def createPortablePackage(self):
        """create portable 7z package with digest files located in the manifest subdir"""

        if not self.packagerExe:
            EmergeDebug.die("could not find 7za in your path!")

        if not "setupname" in self.defines or not self.defines["setupname"]:
            self.defines["setupname"] = self.binaryArchiveName("")
        if not "srcdir" in self.defines or not self.defines["srcdir"]:
            self.defines["srcdir"] = self.imageDir()

        self._compress(self.defines["setupname"], self.defines["srcdir"],
                       self.packageDestinationDir())
예제 #30
0
    def createPortablePackage( self ):
        """create portable 7z package with digest files located in the manifest subdir"""

        if not self.packagerExe:
            EmergeDebug.die("could not find 7za in your path!")


        if not "setupname" in self.defines or not self.defines[ "setupname" ]:
            self.defines[ "setupname" ] = self._archiveName("")
        if not "srcdir" in self.defines or not self.defines[ "srcdir" ]:
            self.defines[ "srcdir" ] = self.imageDir()
            

        self._compress(self.defines[ "setupname" ], self.defines[ "srcdir" ], self.packageDestinationDir())
예제 #31
0
 def make(self):
     if self.buildTarget == "1_55_0":
         cmd = "build.bat "
         if compiler.isClang():
             cmd += "clang"
         elif compiler.isMinGW():
             cmd += "gcc"
         else:
             if compiler.isMSVC2005():
                 cmd += "vc8"
             elif compiler.isMSVC2008():
                 cmd += "vc9"
             elif compiler.isMSVC2010():
                 cmd += "vc10"
         if EmergeDebug.verbose() >= 1:
             print(cmd)
         utils.system(cmd,
                      cwd=os.path.join(
                          portage.getPackageInstance(
                              'win32libs',
                              'boost-headers').sourceDir(), "tools",
                          "build", "v2", "engine")) or EmergeDebug.die(
                              "command: %s failed" % (cmd))
     else:
         cmd = "bootstrap.bat "
         if compiler.isMinGW():
             cmd += "mingw"
         else:
             if compiler.isMSVC2005():
                 cmd += "vc8"
             elif compiler.isMSVC2008():
                 cmd += "vc9"
             elif compiler.isMSVC2010():
                 cmd += "vc10"
             elif compiler.isMSVC2012():
                 cmd += "vc11"
             elif compiler.isMSVC2013():
                 cmd += "vc12"
             elif compiler.isMSVC2015():
                 cmd += "vc14"
         if EmergeDebug.verbose() >= 1:
             print(cmd)
         utils.system(cmd,
                      cwd=os.path.join(
                          portage.getPackageInstance(
                              'win32libs', 'boost-headers').sourceDir(),
                          "tools", "build")) or EmergeDebug.die(
                              "command: %s failed" % (cmd))
     return True
예제 #32
0
    def __fetchMultipleBranch(self, repopath=None):
        EmergeDebug.trace("GitSource __fetchMultipleBranch", 2)
        # get the path where the repositories should be stored to
        if repopath == None:
            repopath = self.repositoryUrl()
        EmergeDebug.debug("fetching %s" % repopath)

        # in case you need to move from a read only Url to a writeable one, here it gets replaced
        repopath = repopath.replace("[git]", "")
        repoString = utils.replaceVCSUrl(repopath)
        [repoUrl, repoBranch, repoTag] = utils.splitVCSUrl(repoString)

        ret = True
        # only run if wanted (e.g. no --offline is given on the commandline)
        if not self.noFetch:
            self.setProxy()
            safePath = os.environ["PATH"]
            # add the git path to the PATH variable so that git can be called without path
            os.environ["PATH"] = os.path.join(self.rootdir, "git", "bin") + ";" + safePath
            rootCheckoutDir = os.path.join(self.checkoutDir(), ".git")
            if not os.path.exists(rootCheckoutDir):
                # it doesn't exist so clone the repo
                os.makedirs(rootCheckoutDir)
                ret = self.__git("clone", "--mirror", repoUrl, ".", cwd=rootCheckoutDir)
            else:
                ret = self.__git("fetch", cwd=rootCheckoutDir)
                if not ret:
                    EmergeDebug.die("could not fetch remote data")

            if repoBranch == "":
                repoBranch = "master"
            if ret:
                branchDir = os.path.join(self.checkoutDir(), repoBranch)
                if not os.path.exists(branchDir):
                    os.makedirs(branchDir)
                    ret = self.__git(
                        "clone", "--local --shared -b", repoBranch, rootCheckoutDir, branchDir, cwd=branchDir
                    )
                else:
                    ret = self.__git("pull")
                    if not ret:
                        EmergeDebug.die("could not pull into branch %s" % repoBranch)

            if ret:
                # ret = self.__git('checkout', '-f')
                ret = self.__git("checkout", "-f", repoTag or repoBranch, cwd=branchDir)
        else:
            EmergeDebug.debug("skipping git fetch (--offline)")
        return ret
예제 #33
0
def getShortName():
    if isMinGW():
        return getCompilerName()
    elif isMSVC2008():
        return "vc90"
    elif isMSVC2010():
        return "vc100"
    elif isMSVC2012():
        return "vc110"
    elif isMSVC2013():
        return "vc120"
    elif isMSVC2015():
        return "vc140"
    else:
        EmergeDebug.die("Unknown Compiler %s" % _compiler())
예제 #34
0
def getShortName():
    if isMinGW():
        return getCompilerName()
    elif isMSVC2008():
        return "vc90"
    elif isMSVC2010():
        return "vc100"
    elif isMSVC2012():
        return "vc110"
    elif isMSVC2013():
        return "vc120"
    elif isMSVC2015():
        return "vc140"
    else:
        EmergeDebug.die("Unknown Compiler %s" % _compiler())
예제 #35
0
 def _getmakeProgram(self):
     if self.supportsNinja and emergeSettings.getboolean("Compile","UseNinja", False):
         return "ninja"
     makeProgram = emergeSettings.get("Compile", "MakeProgram", "" )
     if makeProgram != "" and self.subinfo.options.make.supportsMultijob:
         EmergeDebug.debug("set custom make program: %s" % makeProgram, 1)
         return makeProgram
     elif not self.subinfo.options.make.supportsMultijob:
         if "MAKE" in os.environ:
             del os.environ["MAKE"]
     if compiler.isMSVC() or compiler.isIntel() :
         return "nmake /NOLOGO"
     elif compiler.isMinGW():
         return "mingw32-make"
     else:
         EmergeDebug.die("unknown %s compiler" % self.compiler())
예제 #36
0
 def _getmakeProgram(self):
     if self.supportsNinja and emergeSettings.getboolean("Compile","UseNinja", False):
         return "ninja"
     makeProgram = emergeSettings.get("Compile", "MakeProgram", "" )
     if makeProgram != "" and self.subinfo.options.make.supportsMultijob:
         EmergeDebug.debug("set custom make program: %s" % makeProgram, 1)
         return makeProgram
     elif not self.subinfo.options.make.supportsMultijob:
         if "MAKE" in os.environ:
             del os.environ["MAKE"]
     if compiler.isMSVC() or compiler.isIntel() :
         return "nmake /NOLOGO"
     elif compiler.isMinGW():
         return "mingw32-make"
     else:
         EmergeDebug.die("unknown %s compiler" % self.compiler())
예제 #37
0
 def __init__(self):
     BuildSystemBase.__init__(self, "qmake")
     self.platform = ""
     if compiler.isMSVC():
         if compiler.isClang():
             self.platform = "win32-clang-%s" % self.compiler()
         else:
             self.platform = "win32-%s" % self.compiler()
     elif compiler.isMinGW():
         self.platform = "win32-g++"
     elif compiler.isIntel():
         self.platform = "win32-icc"
     else:
         EmergeDebug.die(
             "QMakeBuildSystem: unsupported compiler platform %s" %
             self.compiler())
예제 #38
0
    def __fetchMultipleBranch(self, repopath=None):
        EmergeDebug.trace('GitSource __fetchMultipleBranch', 2)
        # get the path where the repositories should be stored to
        if repopath == None:
            repopath = self.repositoryUrl()
        EmergeDebug.debug("fetching %s" % repopath)

        # in case you need to move from a read only Url to a writeable one, here it gets replaced
        repopath = repopath.replace("[git]", "")
        repoString = utils.replaceVCSUrl( repopath )
        [repoUrl, repoBranch, repoTag ] = utils.splitVCSUrl( repoString )

        ret = True
        # only run if wanted (e.g. no --offline is given on the commandline)
        if ( not self.noFetch ):
            self.setProxy()
            safePath = os.environ["PATH"]
            # add the git path to the PATH variable so that git can be called without path
            os.environ["PATH"] = os.path.join( self.rootdir, "git", "bin" ) + ";" + safePath
            rootCheckoutDir = os.path.join(self.checkoutDir(), '.git')
            if not os.path.exists( rootCheckoutDir ):
                # it doesn't exist so clone the repo
                os.makedirs( rootCheckoutDir )
                ret = self.__git('clone', '--mirror', repoUrl, '.', cwd=rootCheckoutDir)
            else:
                ret = self.__git('fetch', cwd=rootCheckoutDir)
                if not ret:
                    EmergeDebug.die("could not fetch remote data")

            if repoBranch == "":
                repoBranch = "master"
            if ret:
                branchDir = os.path.join(self.checkoutDir(), repoBranch)
                if not os.path.exists(branchDir):
                    os.makedirs(branchDir)
                    ret = self.__git('clone', '--local --shared -b', repoBranch, rootCheckoutDir, branchDir, cwd=branchDir)
                else:
                    ret = self.__git('pull')
                    if not ret:
                        EmergeDebug.die("could not pull into branch %s" % repoBranch)

            if ret:
                #ret = self.__git('checkout', '-f')
                ret = self.__git("checkout", "-f", repoTag or repoBranch, cwd=branchDir)
        else:
            EmergeDebug.debug("skipping git fetch (--offline)")
        return ret
예제 #39
0
    def generateNSISInstaller( self ):
        """ runs makensis to generate the installer itself """
        self.isInstalled()
        if self.package.endswith( "-package" ):
            shortPackage = self.package[ : -8 ]
        else:
            shortPackage = self.package
        if not "setupname" in self.defines or not self.defines[ "setupname" ]:
            self.defines[ "setupname" ] = "%s-%s-setup-%s.exe" % ( shortPackage, compiler.architecture(), self.buildTarget )
        if not "srcdir" in self.defines or not self.defines[ "srcdir" ]:
            self.defines[ "srcdir" ] = self.imageDir()
        if not "company" in self.defines or not self.defines[ "company" ]:
            self.defines[ "company" ] = "KDE"
        if not "productname" in self.defines or not self.defines[ "productname" ]:
            self.defines[ "productname" ] = shortPackage.capitalize()
        if not "version" in self.defines or not self.defines[ "version" ]:
            self.defines[ "version" ] = self.buildTarget
        if not "executable" in self.defines or not self.defines[ "executable" ]:
            self.defines[ "executable" ] = ""
        if "license" in self.defines and self.defines[ "license" ]:
            self.defines[ "license" ] = "!insertmacro MUI_PAGE_LICENSE \"%s\"" %  self.defines[ "license" ] 
        else:
            self.defines[ "license" ] = ""
        if "icon" in self.defines and self.defines[ "icon" ]:
            self.defines[ "icon" ] = "!define MUI_ICON \"%s\"" % self.defines[ "icon" ]
        else:
            self.defines[ "icon" ] = ""
        if not self.scriptname:
            self.scriptname = os.path.join( os.path.dirname( __file__ ), "NullsoftInstaller.nsi" )
        self.defines[ "architecture" ] = compiler.architecture()

        # make absolute path for output file
        if not os.path.isabs( self.defines[ "setupname" ] ):
            dstpath = self.packageDestinationDir()
            self.defines[ "setupname" ] = os.path.join( dstpath, self.defines[ "setupname" ] )

        definestring = ""
        for key in self.defines:
            definestring += " /D" + key + "=\"" + self.defines[ key ] + "\""

        EmergeDebug.new_line()
        EmergeDebug.debug("generating installer %s" % self.defines["setupname"])
        if self.isInstalled:
            if not utils.systemWithoutShell( "\"%s\" %s %s" % ( os.path.join(
                    self.nsisInstallPath, 'makensis.exe' ), definestring,
                    self.scriptname ), cwd = os.path.abspath( self.packageDir() ) ):
                EmergeDebug.die("Error in makensis execution")
예제 #40
0
    def fetch( self, repopath = None ):
        """ checkout or update an existing repository path """
        EmergeDebug.trace("SvnSource.fetch", 2)
        if self.noFetch:
            EmergeDebug.debug("skipping svn fetch (--offline)")
            return True

        if not os.path.exists(self.svnInstallDir):
            EmergeDebug.die("required subversion package not installed in %s" % self.svnInstallDir)

        for i in range(self.repositoryUrlCount()):
            if repopath:
                url = repopath
            else:
                url = self.repositoryUrl(i)
            self.__tryCheckoutFromRoot(url, self.checkoutDir(i), self.repositoryUrlOptions(i) != 'norecursive')
        return True
예제 #41
0
    def createPackage(self):
        """create 7z package with digest files located in the manifest subdir"""

        if not self.packagerExe:
            EmergeDebug.die("could not find 7za in your path!")

        if emergeSettings.getboolean("ContinuousIntegration", "CreateCache"):
            dstpath = os.path.join(EmergeStandardDirs.downloadDir(), "binary")
        else:
            dstpath = self.packageDestinationDir()
        self._compress(self.binaryArchiveName(), self.imageDir(), dstpath)
        if not self.subinfo.options.package.packSources:
            return True
        if emergeSettings.getboolean("Packager", "PackageSrc", "True"):
            self._compress(self.binaryArchiveName("-src"), self.sourceDir(),
                           dstpath)
        return True
 def read_blacklist( self, fname ):
     """ Read regular expressions from fname """
     fname = os.path.join( self.packageDir(), fname )
     if not os.path.isfile( fname ):
         EmergeDebug.die("Blacklist not found at: %s" % os.path.abspath(fname))
         return False
     for line in fileinput.input( fname ):
         # Cleanup white spaces / line endings
         line = line.splitlines()
         line = line[ 0 ].rstrip()
         if line.startswith( "#" ) or len( line ) == 0:
             continue
         try:
             exp = re.compile( line, re.IGNORECASE )
             self._blacklist.append( exp )
             EmergeDebug.debug("%s added to blacklist as %s" % (line, exp.pattern), 2)
         except re.error:
             EmergeDebug.debug("%s is not a valid regexp" % line, 1)
예제 #43
0
    def internalCreatePackage( self ):
        """ create a package """
        if not self.noClean:
            EmergeDebug.debug("cleaning imagedir: %s" % self.imageDir())
            utils.cleanDirectory( self.imageDir() )
            for directory, mergeDir, strip  in self.__getImageDirectories():
                imageDir = self.imageDir()
                if mergeDir:
                    imageDir = os.path.join( imageDir, mergeDir )
                if os.path.exists( directory ):
                    self.copyFiles(directory, imageDir, strip)
                else:
                    EmergeDebug.die("image directory %s does not exist!" % directory)

        if not os.path.exists( self.imageDir() ):
            os.makedirs( self.imageDir() )

        return True
예제 #44
0
    def configure( self ):
        self.enterSourceDir()
        
        utils.copyFile( os.path.join( self.packageDir(), "win32-msvc2010" ),
                        os.path.join( self.sourceDir(), "specs" ) )

        cmd = "python configure.py"
        cmd += self.subinfo.options.configure.defines
        os.system(cmd) and EmergeDebug.die("command: %s failed" % (cmd))
        return True
예제 #45
0
    def install( self ):
        self.enterSourceDir()
        cmd = self.makeProgramm + " install"
        os.system(cmd) and EmergeDebug.die("command: %s failed" % cmd)
        
        # fix problem with not copying manifest file
        if not compiler.isMinGW():
            utils.copyFile( os.path.join( self.sourceDir(), "sipgen", "sip.exe.manifest" ),
                            sys.exec_prefix )

        return True
 def read_blacklist(self, fname):
     """ Read regular expressions from fname """
     fname = os.path.join(self.packageDir(), fname)
     if not os.path.isfile(fname):
         EmergeDebug.die("Blacklist not found at: %s" %
                         os.path.abspath(fname))
         return False
     for line in fileinput.input(fname):
         # Cleanup white spaces / line endings
         line = line.splitlines()
         line = line[0].rstrip()
         if line.startswith("#") or len(line) == 0:
             continue
         try:
             exp = re.compile(line, re.IGNORECASE)
             self._blacklist.append(exp)
             EmergeDebug.debug(
                 "%s added to blacklist as %s" % (line, exp.pattern), 2)
         except re.error:
             EmergeDebug.debug("%s is not a valid regexp" % line, 1)
예제 #47
0
    def createPackage(self):
        """create 7z package with digest files located in the manifest subdir"""

        if not self.packagerExe:
            EmergeDebug.die("could not find 7za in your path!")

        dstpath = self.packageDestinationDir()
        print(dstpath)

        pkgSuffix = ""
        if hasattr(self.subinfo.options.package, "packageSuffix") and self.subinfo.options.package.packageSuffix:
            pkgSuffix = self.subinfo.options.package.packageSuffix

        self._compress(self._archiveName(pkgSuffix), self.imageDir(), dstpath)

        if not self.subinfo.options.package.packSources:
            return True

        self._compress(self._archiveName("-src"), self.sourceDir(), dstpath)
        return True
예제 #48
0
    def checkoutDir( self, index=0 ):
        EmergeDebug.trace("SvnSource.checkoutDir", 2)
        if self.subinfo.hasSvnTarget():
            u = self.getUrl(index)
            (url, dummy) = self.splitUrl(u)

            if url.find("://") == -1:
                sourcedir = os.path.join(EmergeStandardDirs.svnDir(), url )
            else:
                sourcedir = os.path.join( EmergeStandardDirs.downloadDir(), "svn-src" )
                sourcedir = os.path.join( sourcedir, self.package )
                _, path = self.__splitPath(url)
                if path and emergeSettings.getboolean("General", "EMERGE_SVN_STDLAYOUT", False):
                    sourcedir = os.path.join( sourcedir, path )
        else:
            EmergeDebug.die("svnTarget property not set for this target")

        if self.subinfo.targetSourceSuffix() != None:
            sourcedir = "%s-%s" % (sourcedir, self.subinfo.targetSourceSuffix())

        return sourcedir
예제 #49
0
    def createPackage(self):
        """create 7z package with digest files located in the manifest subdir"""

        if not self.packagerExe:
            EmergeDebug.die("could not find 7za in your path!")

        dstpath = self.packageDestinationDir()
        print(dstpath)

        pkgSuffix = ''
        if hasattr(self.subinfo.options.package, 'packageSuffix'
                   ) and self.subinfo.options.package.packageSuffix:
            pkgSuffix = self.subinfo.options.package.packageSuffix

        self._compress(self._archiveName(pkgSuffix), self.imageDir(), dstpath)

        if not self.subinfo.options.package.packSources:
            return True

        self._compress(self._archiveName("-src"), self.sourceDir(), dstpath)
        return True
예제 #50
0
    def internalCreatePackage(self):
        """ create a package """

        archiveDir = self.archiveDir()

        if not self.noClean:
            EmergeDebug.debug("cleaning package dir: %s" % archiveDir)
            utils.cleanDirectory(archiveDir)
            for directory, mergeDir, strip in self.__getImageDirectories():
                imageDir = archiveDir
                if mergeDir:
                    imageDir = os.path.join(imageDir, mergeDir)
                if os.path.exists(directory):
                    self.copyFiles(directory, imageDir, strip)
                else:
                    EmergeDebug.die("image directory %s does not exist!" %
                                    directory)

        if not os.path.exists(archiveDir):
            os.makedirs(archiveDir)

        return True
예제 #51
0
 def __toRegExp(self, fname, targetName) -> re:
     """ Read regular expressions from fname """
     fname = os.path.join(self.packageDir(), fname)
     if not os.path.isfile(fname):
         EmergeDebug.die("%s not found at: %s" %
                         (targetName.capitalize(), os.path.abspath(fname)))
     regex = "("
     for line in fileinput.input(fname):
         # Cleanup white spaces / line endings
         line = line.splitlines()
         line = line[0].rstrip()
         if line.startswith("#") or len(line) == 0:
             continue
         try:
             tmp = "^%s$" % line
             regex += "%s|" % tmp
             re.compile(tmp, re.IGNORECASE)  #for debug
             EmergeDebug.debug(
                 "%s added to %s as %s" % (line, targetName, tmp), 2)
         except re.error:
             EmergeDebug.die("%s is not a valid regexp" % tmp)
     return re.compile("%s)" % regex[:-2], re.IGNORECASE)
예제 #52
0
파일: utils.py 프로젝트: TheOneRing/emerge
def cleanDirectory( directory ):
    EmergeDebug.debug("clean directory %s" % directory, 1)
    if ( os.path.exists( directory ) ):
        for root, dirs, files in os.walk( directory, topdown=False):
            for name in files:
                try:
                    os.remove( os.path.join(root, name) )
                except OSError:
                    system( "cmd /C \"attrib -R %s\"" % os.path.join(root, name) )
                    try:
                        os.remove( os.path.join(root, name) )
                    except OSError:
                        EmergeDebug.die("couldn't delete file %s\n ( %s )" % (name, os.path.join(root, name)))
            for name in dirs:
                try:
                    os.rmdir( os.path.join(root, name) )
                except OSError:
                    system( "cmd /C \"attrib -R %s\"" % os.path.join(root, name) )
                    try:
                        os.rmdir( os.path.join(root, name) )
                    except OSError:
                        EmergeDebug.die("couldn't delete directory %s\n( %s )" % (name, os.path.join(root, name)))
    else:
        os.makedirs( directory )