Esempio n. 1
0
def guessSVNLocation(package):
    """
        If you don't know where a project's SVN repository is located,
        this function may provide a reasonable hint.

        'package' must be a canonical project path.
    """
    from ToolBOSCore.Settings.ToolBOSSettings import getConfigOption

    requireIsCanonicalPath(package)

    url = None

    try:
        # first check if we have ground truth information available...
        url = getSVNLocationFromFilesystem(package)
    except (AssertionError, KeyError, IOError):
        pass

    if not url:
        # otherwise use default server and path as good guess
        server = getConfigOption('defaultSVNServer')
        path = getConfigOption('defaultSVNRepositoryPath')
        url = 'svn+ssh://%s%s/%s' % (server, path, package)
        logging.debug('guessing SVN location: %s' % url)

    Any.requireIsMatching(url, ".*://.*")
    Any.requireMsg(url[0] != "'", 'invalid URL string')
    Any.requireMsg(url[0] != '"', 'invalid URL string')

    return url
Esempio n. 2
0
    def _setHostEnv( self ):
        """
            Set some environment variables which are used by some
            CMakeLists.txt / packageVar.cmake files.

            Note: Target-related env.variables (TARGETARCH etc.) will be
                  temp. modified by self._switchToTargetEnv() and
                  set back with self._switchToHostEnv().
        """
        hostArch = Platforms.getHostArch()
        hostOS   = Platforms.getHostOS()

        clangEnv = FastScript.getEnv( 'BST_USE_CLANG' )

        if clangEnv is None:
            try:
                useClang = PkgInfo.getPkgInfoContent()['BST_useClang']
            except ( AssertionError, KeyError ):
                useClang = getConfigOption( 'BST_useClang' )

            clangEnv = 'TRUE' if useClang else 'FALSE'

        else:
            useClang = True if clangEnv == 'TRUE' else False


        logging.debug( 'use Clang/LLVM: %s', useClang )

        envSettings  = { 'BST_USE_CLANG': clangEnv,
                         'HOSTARCH':      hostArch,
                         'HOSTOS':        hostOS,
                         'TARGETARCH':    hostArch,
                         'TARGETOS':      hostOS }

        FastScript.getEnv().update( envSettings )
Esempio n. 3
0
def getHostArch():
    """
        Returns a short phony identifier for the current system architecture.
        On PCs this is typically either 'i686' (32 bit) or 'amd64' (64 bit).
    """
    from platform import machine
    from ToolBOSCore.Settings.ToolBOSSettings import getConfigOption

    # check configfile
    try:
        hostArch = getConfigOption( 'hostArch' )
        Any.requireIsTextNonEmpty( hostArch )
        return hostArch

    except ( IOError, KeyError ):
        pass


    # fallback
    arch   = machine()
    system = getSystemType()
    result = arch

    if system == 'linux':

        if arch == 'i386':
            result = 'i686'

        elif arch == 'x86_64':
            result = 'amd64'

        elif arch == 'armv7l':
            result = 'armv7'

    return result
Esempio n. 4
0
    def _createMainDoxyfile(self):

        if self.details.isPythonPackage() and \
           getConfigOption( 'BST_useDoxypy' ) == True:
            fileName = 'Doxyfile-Python'
        else:
            fileName = 'Doxyfile'

        content = ''
        template = os.path.join(FastScript.getEnv('TOOLBOSCORE_ROOT'), 'etc',
                                fileName)
        Any.requireIsFileNonEmpty(template)

        if os.path.isdir(os.path.join(self.details.topLevelDir, 'examples')):
            logging.debug('doxygen: indexing examples')
            content += 'EXAMPLE_PATH           = ../examples\n' + \
                       'EXAMPLE_PATTERNS       =\n' + \
                       'EXAMPLE_RECURSIVE      = YES\n'

        if self.details.isComponent():
            logging.debug('doxygen: indexing src/*.{c,cpp}')
            content += 'FILE_PATTERNS          = *.c *.cpp *.h\n'

        content = FastScript.getFileContent(template) + content
        FastScript.setFileContent(self.mainDoxyfile, content)
Esempio n. 5
0
    def _findMatdoc(self):
        sitPath = SIT.getRootPath()
        package = getConfigOption('package_matdoc')
        fileName = 'matdoc'
        exePath = os.path.join(sitPath, package, 'bin', fileName)

        if os.path.exists(exePath):
            return exePath
        else:
            logging.warning('%s: No such file', exePath)
            return fileName  # default to 'matdoc'
Esempio n. 6
0
def getBuildRequirements():
    """
        Returns a list of essential packages needed for a minimalistic
        software installation tree (SIT).

        Opposed to getMinRequirements() this contains everything needed to
        build software packages.
    """
    from ToolBOSCore.Settings.ToolBOSSettings import getConfigOption

    result = getConfigOption('SIT_bootstrapFull')

    Any.requireIsListNonEmpty(result)
    return result
Esempio n. 7
0
def getMinRequirements():
    """
        Returns a list of essential packages needed for a minimalistic
        software installation tree (SIT).

        Opposed to getBuildRequirements() this only contains the minimal
        requirements for executing / distributing software.
    """
    from ToolBOSCore.Settings.ToolBOSSettings import getConfigOption

    result = getConfigOption('SIT_bootstrapMin')

    Any.requireIsListNonEmpty(result)
    return result
Esempio n. 8
0
def getHostOS():
    """
        Returns the short lowercase form of the general operating system
        type of the host machine, e.g. 'linux' or 'win'.
    """
    # check configfile
    try:
        from ToolBOSCore.Settings.ToolBOSSettings import getConfigOption
        hostOS = getConfigOption( 'hostOS' )
        Any.requireIsTextNonEmpty( hostOS )

        return hostOS

    except ( IOError, KeyError ):
        pass


    # fallback
    return getSystemType()
Esempio n. 9
0
def getHostPlatform():
    """
        Returns a short phony identifier for the current system platform.

        On Linux this is typically a combination of O.S. release name
        and CPU wordsize. On Windows also the compiler name is encoded.
    """
    # possible to override with environment variable
    forcedPlatform = FastScript.getEnv( 'MAKEFILE_PLATFORM' )

    if forcedPlatform:
        hostPlatform = forcedPlatform

    else:
        from ToolBOSCore.Settings.ToolBOSSettings import getConfigOption
        hostPlatform = getConfigOption( 'hostPlatform' )

    Any.requireIsTextNonEmpty( hostPlatform )

    return hostPlatform
Esempio n. 10
0
    def _findDoxygen(self):
        sitPath = SIT.getRootPath()
        package = getConfigOption('package_doxygen')
        hostPlatform = getHostPlatform()
        fileName = 'doxygen'
        exePath = os.path.join(sitPath, package, 'bin', hostPlatform, fileName)

        if os.path.exists(exePath):
            return exePath

        else:
            logging.debug('%s: No such file', exePath)
            logging.debug('falling back to "doxygen" in $PATH')

            found = ProcessEnv.which('doxygen')

            if found:
                logging.debug('using doxygen from $PATH: %s', found)
                return found
            else:
                raise EnvironmentError(
                    '"doxygen" neither found in SIT nor installed locally')
    def _setBugtrackerURL(self):
        try:
            bugtrackURL = getConfigOption('bugtrackURL')
            self._supportInfo = '\nPlease report bugs on JIRA (%s).' % \
                                bugtrackURL

        except AttributeError:
            # This happens within ToolBOS-Setup.py: In a brand-new user
            # environment TOOLBOSCORE_ROOT is not defined, yet.
            # Hence we are not able to determine the location of the
            # fallback ToolBOS.conf.
            #
            # In such case do not show the bugtrackURL.
            pass

        except KeyError:
            # In CIA the CIA-Start.sh script sets TOOLBOSCORE_ROOT to point
            # into the new SIT location which does not exist, yet.
            # In this case, its etc/ToolBOS.conf won't be found.
            #
            # The same applies while debugging incomplete setups.
            # Fine to not show bugtrackURL in such cornercases, too.
            pass
Esempio n. 12
0
    def _detectModulePath( self ):
        # in out-of-tree build situations add the source-directory's
        # ToolBOS.conf to the extra search path for "getConfigOption()"
        # (TBCORE-1052)

        tconfExtraDir = [ self._sourceTree ] if self._outOfTree else None

        if tconfExtraDir:
            logging.debug( 'registering extra ToolBOS.conf dir: %s', tconfExtraDir )

        cmakeModPath  = getConfigOption( 'BST_modulePath', tconfExtraDir )
        cmakeModPath  = FastScript.expandVars( cmakeModPath )

        if self._outOfTree and not os.path.isabs( cmakeModPath ):
            cmakeModPath = os.path.abspath( os.path.join( self._sourceTree, cmakeModPath ) )

        try:
            Any.requireIsDirNonEmpty( cmakeModPath )
        except AssertionError as details:
            logging.error( 'invalid setting of BST_modulePath in ToolBOS.conf' )
            logging.error( details )
            raise

        self._cmakeModPath = cmakeModPath