示例#1
0
 def __init__(self):
     ## use IDE for msvc2008 projects
     self.useIDE = False
     ## use IDE for configuring msvc2008 projects, open IDE in make action instead of running command line orientated make
     self.openIDE = False
     ## use CTest instead of the make utility
     self.useCTest = utils.envAsBool("EMERGE_USECTEST")
示例#2
0
    def __init__(self):
        ## options for the dependency generation
        self.features = OptionsFeatures()
        ## options of the fetch action
        self.fetch = OptionsFetch()
        ## options of the unpack action
        self.unpack = OptionsUnpack()
        ## options of the configure action
        self.configure = OptionsConfigure()
        ## options of the configure action
        self.make = OptionsMake()
        ## options of the install action
        self.install = OptionsInstall()
        ## options of the package action
        self.package = OptionsPackage()
        ## options of the merge action
        self.merge = OptionsMerge()
        ## options of the cmake buildSystem
        self.cmake = OptionsCMake()
        ## options of the git module
        self.git = OptionsGit()

        ## this option controls if the build type is used when creating build and install directories.
        # The following example shows the difference:
        # \code
        #                True                                False
        # work/msvc2008-RelWithDebInfo-svnHEAD     work/msvc2008-svnHEAD
        # image-msvc2008-RelWithDebInfo-svnHEAD    image-msvc2008-svnHEAD
        # \endcode
        #
        self.useBuildType = True

        ## this option controls if the active compiler is used when creating build and install directories.
        # The following example shows the difference:
        # \code
        #               True                                  False
        # work/msvc2008-RelWithDebInfo-svnHEAD     work/RelWithDebInfo-svnHEAD
        # image-msvc2008-RelWithDebInfo-svnHEAD    image-RelWithDebInfo-svnHEAD
        # \endcode
        #
        self.useCompilerType = True
        ## skip the related package from debug builds
        self.disableDebugBuild = False
        ## skip the related package from release builds
        self.disableReleaseBuild = False
        ## exit if system command returns errors
        self.exitOnErrors = True
        ## use short pathes (usefull for mingw to
        #  avoid exceeding the maximum path length)
        self.useShortPathes = False

        ## there is a special option available already
        self.buildTests = utils.envAsBool("EMERGE_BUILDTESTS")
        self.buildTools = "False"
        self.buildStatic = "False"

        #### end of user configurable part
        self.__instances = dict()
        self.__verbose = False
        self.__errors = False
示例#3
0
def isInstalled( category, package, version, buildtype='' ):
    """ deprecated, use InstallDB.installdb.isInstalled() instead """
    utils.debug( "isInstalled(%s, %s, %s, %s)" % (category, package, version, buildtype), 2 )
    # find in old style database
    path = utils.etcDir()
    fileName = os.path.join(path,'installed')
    found = False
    if os.path.isfile( fileName ):
        with open( fileName, "rb" ) as f:
            for line in f.read().splitlines():
                (_category, _packageVersion) = line.split( "/" )
                (_package, _version) = utils.packageSplit(_packageVersion)
                if category != '' and version != '' and category == _category and package == _package and version == _version:
                    found = True
                    break
                elif category == '' and version == '' and package == _package:
                    found = True
                    break
        utils.debug("...%s found in main database" % (' ' if found else ' not'), 2 )
        if found:
            return True

    # find in release mode database
    if buildtype != '':
        fileName = os.path.join(path,'installed-' + buildtype )
        if os.path.isfile( fileName ):
            with open( fileName, "rb" ) as f:
                for line in f.read().splitlines():
                    (_category, _packageVersion) = line.split( "/" )
                    (_package, _version) = utils.packageSplit(_packageVersion)
                    if category != '' and version != '' and category == _category and package == _package and version == _version:
                        found = True
                        break
                    elif category == '' and version == '' and package == _package:
                        found = True
                        break
            utils.debug( "...%s found in %s database" % ( (' ' if found else ' not'), buildtype), 2 )
            if found:
                return True

    # try to detect packages from the installer
    binary = utils.checkManifestFile( os.path.join( os.getenv( "KDEROOT" ), "manifest",
            package + "-" + version + "-bin.ver"), category, package, version )
    lib = utils.checkManifestFile( os.path.join( os.getenv( "KDEROOT" ), "manifest",
            package + "-" + version + "-lib.ver"), category, package, version )
    found = found or binary or lib

    if not utils.envAsBool("EMERGE_VERSIONING", default=True) or utils.isSourceOnly():
        # check for any installation except data packages
        if not os.path.exists(os.path.join( os.getenv( "KDEROOT" ), "manifest" ) ):
            return False
        if package.endswith( "-src" ):
            package = package[:-4]
        for filename in os.listdir( os.path.join( os.getenv( "KDEROOT" ), "manifest" ) ):
            if filename.startswith( package ) and not \
                    filename.startswith( package + "-data" ):
                return True
    return False
示例#4
0
    def __init__( self, SRC_URI="", **args ):
        """ the baseclass constructor
        args really should be documented"""
        if "args" in args.keys() and "argv0" in args["args"].keys():
            self.argv0 = args["args"]["argv0"]
        else:
            self.argv0 = sys.argv[ 0 ]

        self.SRC_URI                = SRC_URI
        self.instsrcdir             = ""
        self.instdestdir            = ""
        self.versioned              = False
        self.kdeCustomDefines       = ""
        self.createCombinedPackage  = False
        self._filenames = [] # will be set by self.execute()

        self.subinfo                = info.infoclass()
        self.buildTarget            = self.subinfo.defaultTarget
        self.Targets                = self.subinfo.svnTargets

        self.isoDateToday           = str( datetime.date.today() ).replace('-', '')

        self.msys = msys_build.msys_interface()
        self.kde  = kde_build.kde_interface()

        self.noFetch = utils.envAsBool( "EMERGE_OFFLINE" )
        self.noCopy = utils.envAsBool( "EMERGE_NOCOPY")
        self.noFast = utils.envAsBool( "EMERGE_NOFAST", default=True )
        self.noClean = utils.envAsBool( "EMERGE_NOCLEAN" )
        self.forced = utils.envAsBool( "EMERGE_FORCED" )
        self.buildTests = utils.envAsBool( "EMERGE_BUILDTESTS" )

        # Build type for kdeCompile() / kdeInstall() - packages
        # "" -> debug and release
        Type = os.getenv( "EMERGE_BUILDTYPE" )
        if ( not Type == None ):
            utils.debug( "BuildType: %s" % Type, 1 )
            self.buildType = Type
        else:
            self.buildType = None

        self.setDirectories()

        if COMPILER == "msvc2005":
            self.compiler = "msvc2005"
        elif COMPILER == "msvc2008":
            self.compiler = "msvc2008"
        elif COMPILER == "msvc2010":
            self.compiler = "msvc2010"
        elif COMPILER == "msvc2011":
            self.compiler = "msvc2011"
        elif COMPILER == "mingw":
            self.compiler = "mingw"
        elif COMPILER == "mingw4":
            self.compiler = "mingw4"
        else:
            print >> sys.stderr, "emerge error: KDECOMPILER: %s not understood" % COMPILER
            exit( 1 )
    def packageDestinationDir( self, withBuildType=True ):
        """return absolute path to the directory where binary packages are placed into.
        Default is to optionally append build type subdirectory"""

        utils.debug( "EmergeBase.packageDestinationDir called", 2 )
        dstpath = os.getenv( "EMERGE_PKGDSTDIR" )
        if not dstpath:
            dstpath = os.path.join( self.rootdir, "tmp" )

        if withBuildType:
            if utils.envAsBool( "EMERGE_MERGE_ROOT_WITH_BUILD_TYPE" ):
                dstpath = os.path.join( dstpath, self.buildType())

        if not os.path.exists(dstpath):
            utils.createDir(dstpath)
        return dstpath
示例#6
0
    def setDirectories( self, rootdir, imagedir, workdir, instsrcdir, instdestdir, infoobject ):
        self.subinfo = infoobject

        if self.COMPILER   == "msvc2005" or self.COMPILER == "msvc2008" or self.COMPILER == "msvc2010":
            self.cmakeMakefileGenerator = "NMake Makefiles"
            self.cmakeMakeProgramm      = "nmake"
        elif self.COMPILER == "mingw" or self.COMPILER == "mingw4":
            self.cmakeMakefileGenerator = "MinGW Makefiles"
            self.cmakeMakeProgramm      = "mingw32-make"
        else:
            utils.die( "KDECOMPILER: %s not understood" % self.COMPILER )

        if self.MAKE_PROGRAM:
            self.cmakeMakeProgramm = self.MAKE_PROGRAM
            utils.debug( "set custom make program: %s" % self.MAKE_PROGRAM, 1 )

        if utils.verbose() > 1:
            print "BuildType: %s" % self.BUILDTYPE
        self.buildType = self.BUILDTYPE

        self.noFetch = utils.envAsBool( "EMERGE_OFFLINE" )
        self.noCopy = utils.envAsBool( "EMERGE_NOCOPY")
        self.noFast = utils.envAsBool( "EMERGE_NOFAST", default=True )
        self.noClean = utils.envAsBool( "EMERGE_NOCLEAN" )
        self.forced = utils.envAsBool( "EMERGE_FORCED" )
        self.buildTests = utils.envAsBool( "EMERGE_BUILDTESTS" )

        self.buildNameExt    = None

        self.rootdir         = rootdir
        self.workdir         = workdir
        self.imagedir        = imagedir
        self.instsrcdir      = instsrcdir
        self.instdestdir     = instdestdir

        self.kdesvndir       = self.KDESVNDIR
        self.kdesvnserver    = self.KDESVNSERVER
        self.kdesvnuser      = self.KDESVNUSERNAME
        self.kdesvnpass      = self.KDESVNPASSWORD
        self.svndir = None # set in self.kdeSvnFetch

        if utils.verbose() > 1 and self.kdeSvnPath():
            print "noCopy       : %s" % self.noCopy
            print "kdeSvnPath() : %s" % self.kdeSvnPath().replace("/", "\\")

        if not ( self.noCopy and self.kdeSvnPath() ) :
            if self.kdeSvnPath():
                self.sourcePath = "..\\%s" % self.kdeSvnPath().split('/')[-1]
            else:
                self.sourcePath = "..\\%s" % self.instsrcdir
        else:
            self.sourcePath = "%s" % os.path.join(self.kdesvndir, self.kdeSvnPath() ).replace("/", "\\")
示例#7
0
def readChildren(category, package, version):
    identFileName = getFilename(category, package, version)
    if not os.path.isfile(identFileName):
        utils.die("package name %s/%s-%s unknown" % (category, package, version))

    # if we are an emerge internal package and already in the dictionary, ignore childrens
    # To avoid possible endless recursion this may be also make sense for all packages
    if category == internalCategory and identFileName in modDict.keys():
        return dict(), dict()
    package, subpackage = getSubPackage(category, package)
    if subpackage:
        utils.debug(
            "solving package %s/%s/%s-%s %s"
            % (category, subpackage, package, version, getFilename(category, package, version)),
            2,
        )
    else:
        utils.debug(
            "solving package %s/%s-%s %s" % (category, package, version, getFilename(category, package, version)), 2
        )
    if not identFileName in modDict.keys():
        mod = __import__(identFileName)
        modDict[identFileName] = mod
    else:
        mod = modDict[identFileName]

    if utils.envAsBool("EMERGE_ENABLE_IMPLICID_BUILDTIME_DEPENDENCIES") and hasattr(mod, "Package"):
        _package = mod.Package()
        subinfo = _package.subinfo
    elif hasattr(mod, "subinfo"):
        subinfo = mod.subinfo()
    else:
        return dict(), dict()

    runtimeDependencies = subinfo.runtimeDependencies or dict()
    buildDependencies = subinfo.buildDependencies or dict()

    # hardDependencies
    commonDependencies = subinfo.hardDependencies
    commonDependencies.update(subinfo.dependencies)
    runtimeDependencies.update(commonDependencies)
    buildDependencies.update(commonDependencies)

    return runtimeDependencies, buildDependencies
 def __makeFileGenerator(self):
     """return cmake related make file generator"""
     if self.supportsNinja and utils.envAsBool("EMERGE_USE_NINJA"):
         return "Ninja"
     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:
             if self.isTargetBuild():
                 return "Visual Studio 9.0 Windows Mobile 6 Professional SDK (ARMV4I)"
             else:
                 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:
         utils.die( "unknown %s compiler" % self.compiler() )
示例#9
0
        usage()
        exit ( 1 )
    else:
        packageName = i
        break

if stayQuiet == True:
    utils.setVerbose(0)

# get KDEROOT from env
KDEROOT = os.getenv( "KDEROOT" )
utils.debug( "buildAction: %s" % mainBuildAction )
utils.debug( "doPretend: %s" % doPretend, 1 )
utils.debug( "packageName: %s" % packageName )
utils.debug( "buildType: %s" % os.getenv( "EMERGE_BUILDTYPE" ) )
utils.debug( "buildTests: %s" % utils.envAsBool( "EMERGE_BUILDTESTS" ) )
utils.debug( "verbose: %d" % utils.verbose(), 1 )
utils.debug( "trace: %s" % os.getenv( "EMERGE_TRACE" ), 1 )
utils.debug( "KDEROOT: %s\n" % KDEROOT, 1 )
utils.debug_line()

def unset_var( varname ):
    if not os.getenv( varname ) == None:
        print
        utils.warning( "%s found as environment variable. you cannot override emerge"\
                       " with this - unsetting %s locally" % ( varname, varname ) )
        os.environ[ varname ] = ""

unset_var( "CMAKE_INCLUDE_PATH" )
unset_var( "CMAKE_LIBRARY_PATH" )
unset_var( "CMAKE_FIND_PREFIX" )
    def __init__( self, **args):
        """args really should be documented, see self.argv0 below"""
        # TODO: some __init__  of subclasses need to already have been
        # called here. That is really the wrong way round.
        object.__init__(self)
        utils.debug( "EmergeBase.__init__ called", 2 )

        if not hasattr(self, 'subinfo'):
            # see the TODO above. This helps pylint understand the code, otherwise
            # it generates tons of error messages.
            self.subinfo = None
        if not hasattr(self, 'buildSystemType'):
            self.buildSystemType = None

        # if implicit build time dependency is wanted, depend on internal packages
        # for this class and all of its ancestor classes
        if utils.envAsBool('EMERGE_ENABLE_IMPLICID_BUILDTIME_DEPENDENCIES'):
            for cls in type(self).mro():
                className = cls.__name__
                packageName = 'internal/%s' % className
                if os.path.exists(os.path.join(ROOTDIR, 'emerge', 'portage',
                        'internal', className, '%s-internal.py' % className)):
                    if self.subinfo and not packageName in self.subinfo.buildDependencies:
                        self.subinfo.buildDependencies[packageName] = 'default'

        if hasattr(self,'alreadyCalled'):
            return
        self.alreadyCalled = True
        self.buildTarget = None

        if "args" in args.keys() and "argv0" in args["args"].keys():
            self.argv0 = args["args"]["argv0"]
        else:
            self.argv0 = sys.argv[ 0 ]

        self.versioned              = False
        self.CustomDefines       = ""
        self.createCombinedPackage  = False

        ## specifies if a build type related root directory should be used
        self.useBuildTypeRelatedMergeRoot = False
        if utils.envAsBool("EMERGE_MERGE_ROOT_WITH_BUILD_TYPE"):
            self.useBuildTypeRelatedMergeRoot = True

        self.isoDateToday           = str( datetime.date.today() ).replace('-', '')

        self.noFetch = utils.envAsBool( "EMERGE_OFFLINE" )
        self.noCopy = utils.envAsBool( "EMERGE_NOCOPY")
        self.noFast = utils.envAsBool( "EMERGE_NOFAST", default=True )
        self.noClean = utils.envAsBool( "EMERGE_NOCLEAN" )
        self.forced = utils.envAsBool( "EMERGE_FORCED" )
        self.buildTests = utils.envAsBool( "EMERGE_BUILDTESTS" )

        if COMPILER == "msvc2005":
            self.__compiler = "msvc2005"
        elif COMPILER == "msvc2008":
            self.__compiler = "msvc2008"
        elif COMPILER == "msvc2010":
            self.__compiler = "msvc2010"
        elif COMPILER == "msvc2011":
            self.__compiler = "msvc2011"
        elif COMPILER == "mingw":
            self.__compiler = "mingw"
        elif COMPILER == "mingw4":
            self.__compiler = "mingw4"
        else:
            print >> sys.stderr, "emerge error: KDECOMPILER: '%s' not understood" % COMPILER
            exit( 1 )
        self.rootdir = ROOTDIR
        if self.subinfo:
            self.setup()
示例#11
0
def isDBEnabled():
    """ this function returns whether sqlite database should be used """
    if not os.getenv("EMERGE_ENABLE_SQLITEDB"):
        return True
    return utils.envAsBool("EMERGE_ENABLE_SQLITEDB")