Exemplo n.º 1
0
    def get_installed_version(self):
        import re
        ver_re = '^.*Version\s+(.*)$'

        def get_version_from_output(output):
            mo = re.search(ver_re, output, re.MULTILINE)
            if mo:
                version = mo.groups()[0]
            else:
                version = '<Unable to extract version.>'

            return version

        if os.name == 'nt':
            local_path = os.path.join(self.inst_dir, 'swig.exe')
        else:
            local_path = os.path.join(self.inst_dir, 'bin', 'swig')

        if os.path.exists(local_path):
            status, output = utils.get_status_output('%s -version' %
                                                     (local_path, ))

            if status is None:
                version = get_version_from_output(output)
                return '%s (local)' % (version.strip(), )

        status, output = utils.get_status_output('swig -version')
        if status is None:
            version = get_version_from_output(output)
            return '%s (system)' % (version.strip(), )

        return 'Not found.'
Exemplo n.º 2
0
    def get_installed_version(self):
        import re
        ver_re = '^.*Version\s+(.*)$'

        def get_version_from_output(output):
            mo = re.search(ver_re, output, re.MULTILINE)
            if mo:
                version = mo.groups()[0]
            else:
                version = '<Unable to extract version.>'

            return version

        if os.name == 'nt':
            local_path = os.path.join(self.inst_dir, 'swig.exe')
        else:
            local_path = os.path.join(self.inst_dir, 'bin', 'swig')

        if os.path.exists(local_path):
            status,output = utils.get_status_output('%s -version' %
                    (local_path,))

            if status is None:
                version = get_version_from_output(output)
                return '%s (local)' % (version.strip(),)

        status,output = utils.get_status_output('swig -version')
        if status is None:
            version = get_version_from_output(output)
            return '%s (system)' % (version.strip(),)

        return 'Not found.'
Exemplo n.º 3
0
    def install(self):
        self.copy_devide_to_inst()

        # create versions.py file
        ###################################################

        # first get devide_revision_id
        status, output = utils.get_status_output("%s id %s" % (config.HG, self.inst_dir))
        # on linux, hg id gives "changeset_id tip" (e.g.)
        # on windows build image, only "changeset_id", so we have
        # to remove EOL with strip()
        devide_revision_id = output.split(' ')[0].strip()

        # then write the file
        versions_dict = {
                'devide_version' : config.DEVIDE_DATESTR,
                'devide_revision_id' : devide_revision_id,
                'johannes_revision_id' : config.JOHANNES_REVISION_ID
                }

        utils.output('Writing devide_versions.py')
        versions_fname = os.path.join(self.inst_dir, 'devide_versions.py')
        versions_file = file(versions_fname, 'w')
        cptxt = CONFIG_PY_TEMPLATE % versions_dict
        versions_file.write(cptxt)
        versions_file.close()
Exemplo n.º 4
0
    def install(self):
        self.copy_devide_to_inst()

        # create versions.py file
        ###################################################

        # first get devide_revision_id
        status, output = utils.get_status_output("%s id %s" %
                                                 (config.HG, self.inst_dir))
        # on linux, hg id gives "changeset_id tip" (e.g.)
        # on windows build image, only "changeset_id", so we have
        # to remove EOL with strip()
        devide_revision_id = output.split(' ')[0].strip()

        # then write the file
        versions_dict = {
            'devide_version': config.DEVIDE_DATESTR,
            'devide_revision_id': devide_revision_id,
            'johannes_revision_id': config.JOHANNES_REVISION_ID
        }

        utils.output('Writing devide_versions.py')
        versions_fname = os.path.join(self.inst_dir, 'devide_versions.py')
        versions_file = file(versions_fname, 'w')
        cptxt = CONFIG_PY_TEMPLATE % versions_dict
        versions_file.write(cptxt)
        versions_file.close()
Exemplo n.º 5
0
    def get_installed_version(self):
        version = None

        local_cmake_path = os.path.join(self.inst_dir, 'bin', 'cmake')
        if os.path.exists(local_cmake_path):
            status,output = utils.get_status_output('%s --version' %
                    (local_cmake_path,))

            if status is None:
                return '%s (local)' % (output.strip(),)

        status,output = utils.get_status_output('cmake --version')
        if status is None:
            return '%s (system)' % (output.strip(),)

        return 'Not found.'
Exemplo n.º 6
0
    def get_installed_version(self):
        version = None

        local_cmake_path = os.path.join(self.inst_dir, 'bin', 'cmake')
        if os.path.exists(local_cmake_path):
            status, output = utils.get_status_output('%s --version' %
                                                     (local_cmake_path, ))

            if status is None:
                return '%s (local)' % (output.strip(), )

        status, output = utils.get_status_output('cmake --version')
        if status is None:
            return '%s (system)' % (output.strip(), )

        return 'Not found.'
def postproc_sos():
    if os.name != 'posix':
        return

    print S_PPF, "postproc_sos (strip, chrpath)"

    res = re.compile(
    "^(.*):.*ELF.*(executable|relocatable|shared object).*, not stripped"
    )
    rec = re.compile('.*\.(so$|so\.)')

    # use 'file' command to find all strippable files
    print PPF, "Creating complete file list..."
    all_files, _ = utils.find_files(BDIPaths.dre_dest, '.*')

    print PPF, "Searching for strippable / chrpathable files"
    for f in all_files:
        status, output = utils.get_status_output('%s %s' % (FILE, f))
        mo = re.match(res, output)
        stripped = chrpathed = False
        if mo:
            sfn = mo.groups()[0]
            ret = os.system('%s %s' % (STRIP, sfn))
            if ret != 0:
                print "Error stripping %s." % (sfn,)
            else:
                stripped = True

        # now check if f can be chrpathed
        if re.match(rec, f):
            # remove rpath information
            ret = os.system('%s --delete %s' % (CHRPATH, f))
            if ret != 0:
                print "Error chrpathing %s." % (f,)
            else:
                chrpathed = True

        if stripped or chrpathed:
            actions = [] 
            if stripped:
                actions.append('STRIPPED')
            if chrpathed:
                actions.append('CHRPATHED')
            
            print "%s: %s" % (f, ','.join(actions))
Exemplo n.º 8
0
def postproc_sos():
    if os.name != 'posix':
        return

    print S_PPF, "postproc_sos (strip, chrpath)"

    res = re.compile(
        "^(.*):.*ELF.*(executable|relocatable|shared object).*, not stripped")
    rec = re.compile('.*\.(so$|so\.)')

    # use 'file' command to find all strippable files
    print PPF, "Creating complete file list..."
    all_files, _ = utils.find_files(BDIPaths.dre_dest, '.*')

    print PPF, "Searching for strippable / chrpathable files"
    for f in all_files:
        status, output = utils.get_status_output('%s %s' % (FILE, f))
        mo = re.match(res, output)
        stripped = chrpathed = False
        if mo:
            sfn = mo.groups()[0]
            ret = os.system('%s %s' % (STRIP, sfn))
            if ret != 0:
                print "Error stripping %s." % (sfn, )
            else:
                stripped = True

        # now check if f can be chrpathed
        if re.match(rec, f):
            # remove rpath information
            ret = os.system('%s --delete %s' % (CHRPATH, f))
            if ret != 0:
                print "Error chrpathing %s." % (f, )
            else:
                chrpathed = True

        if stripped or chrpathed:
            actions = []
            if stripped:
                actions.append('STRIPPED')
            if chrpathed:
                actions.append('CHRPATHED')

            print "%s: %s" % (f, ','.join(actions))
def package_dist():
    """4. package and timestamp distributables (nsis on win, tar on
    posix)
    """

    print S_PPF, "package_dist"

    # get devide version (we need this to stamp the executables)
    cmd = '%s -v' % (os.path.join(BDIPaths.dre_dest, 'dre devide'),)
    s,o = utils.get_status_output(cmd)
   
    # s == None if DeVIDE has executed successfully
    if s: 
        raise RuntimeError('Could not exec DeVIDE to extract version.')

    mo = re.search('^DeVIDE\s+(v.*)$', o, re.MULTILINE)
    if mo:
        devide_ver = mo.groups()[0]
    else:
        raise RuntimeError('Could not extract DeVIDE version.')

    # now get 32 or 64bit: we're going to use this in the package
    # naming.
    import platform
    if platform.architecture()[0] == '64bit':
        bits_str = '64'
    else:
        bits_str = '32'

    if os.name == 'nt':

        nsi_dir = 'archive\dre\support'
        os.chdir(os.path.join(
            config.working_dir, nsi_dir))

        if config.WINARCH_STR == 'x64':
            NSI_FILE = 'devide-re-x64.nsi'
            shutil.copy('devide-re.nsi', NSI_FILE)
            # fix redist for win64
            # also fix installation dir to "program files" and not "program
            # files (x86)
            utils.re_sub_filter_file(
                    [('vcredist_x86', 'vcredist_x64'),
                     ('\$PROGRAMFILES\\\\', '$PROGRAMFILES64\\\\')],
                    NSI_FILE)

        else:
            NSI_FILE = 'devide-re.nsi'

        # go to working dir
        os.chdir(config.working_dir)

        # /nocd tells makensis not to change to the directory
        # containing the nsi file.
        cmd = '%s /NOCD archive\dre\support\%s' \
                % (MAKE_NSIS, NSI_FILE)
        ret = os.system(cmd)
        if ret != 0:
            raise RuntimeError('Error running NSIS.')

        # nsis creates devidesetup.exe - we're going to rename to
        # devide-re-v9.8.1234-win64-setup.exe
        platform_str = 'win' + bits_str
        os.rename('devide-re-setup.exe', 
                'devide-re-%s-%s-setup.exe' % \
                        (devide_ver, platform_str))

    else:
        # go to the working dir
        os.chdir(config.working_dir)

        platform_str = 'lin' + bits_str
        # basename will be e.g. devide-re-v9.8.2341-lin64
        basename = '%s-%s-%s' % \
                (BDIPaths.dre_basename, devide_ver, platform_str)
        tarball = '%s.tar.bz2' % (basename,)

        if os.path.exists(tarball):
            print PPF, '%s exists, not repacking.' % (tarball,)
            return

        print PPF, 'Packing %s' % (tarball,)

        os.rename(BDIPaths.dre_basename, basename)

        # create tarball with juicy stuff
        tar = tarfile.open(tarball, 'w:bz2')
        # recursively add directory
        tar.add(basename)
        # finalize
        tar.close()

        # rename devide-version back to distdevide
        os.rename(basename, BDIPaths.dre_basename)

        print PPF, 'DONE.'
Exemplo n.º 10
0
def package_dist():
    """4. package and timestamp distributables (nsis on win, tar on
    posix)
    """

    print S_PPF, "package_dist"

    # get devide version (we need this to stamp the executables)
    cmd = '%s -v' % (os.path.join(BDIPaths.dre_dest, 'dre devide'), )
    s, o = utils.get_status_output(cmd)

    # s == None if DeVIDE has executed successfully
    if s:
        raise RuntimeError('Could not exec DeVIDE to extract version.')

    mo = re.search('^DeVIDE\s+(v.*)$', o, re.MULTILINE)
    if mo:
        devide_ver = mo.groups()[0]
    else:
        raise RuntimeError('Could not extract DeVIDE version.')

    # now get 32 or 64bit: we're going to use this in the package
    # naming.
    import platform
    if platform.architecture()[0] == '64bit':
        bits_str = '64'
    else:
        bits_str = '32'

    if os.name == 'nt':

        nsi_dir = 'archive\dre\support'
        os.chdir(os.path.join(config.working_dir, nsi_dir))

        if config.WINARCH_STR == 'x64':
            NSI_FILE = 'devide-re-x64.nsi'
            shutil.copy('devide-re.nsi', NSI_FILE)
            # fix redist for win64
            # also fix installation dir to "program files" and not "program
            # files (x86)
            utils.re_sub_filter_file(
                [('vcredist_x86', 'vcredist_x64'),
                 ('\$PROGRAMFILES\\\\', '$PROGRAMFILES64\\\\')], NSI_FILE)

        else:
            NSI_FILE = 'devide-re.nsi'

        # go to working dir
        os.chdir(config.working_dir)

        # /nocd tells makensis not to change to the directory
        # containing the nsi file.
        cmd = '%s /NOCD archive\dre\support\%s' \
                % (MAKE_NSIS, NSI_FILE)
        ret = os.system(cmd)
        if ret != 0:
            raise RuntimeError('Error running NSIS.')

        # nsis creates devidesetup.exe - we're going to rename to
        # devide-re-v9.8.1234-win64-setup.exe
        platform_str = 'win' + bits_str
        os.rename('devide-re-setup.exe',
                'devide-re-%s-%s-setup.exe' % \
                        (devide_ver, platform_str))

    else:
        # go to the working dir
        os.chdir(config.working_dir)

        platform_str = 'lin' + bits_str
        # basename will be e.g. devide-re-v9.8.2341-lin64
        basename = '%s-%s-%s' % \
                (BDIPaths.dre_basename, devide_ver, platform_str)
        tarball = '%s.tar.bz2' % (basename, )

        if os.path.exists(tarball):
            print PPF, '%s exists, not repacking.' % (tarball, )
            return

        print PPF, 'Packing %s' % (tarball, )

        os.rename(BDIPaths.dre_basename, basename)

        # create tarball with juicy stuff
        tar = tarfile.open(tarball, 'w:bz2')
        # recursively add directory
        tar.add(basename)
        # finalize
        tar.close()

        # rename devide-version back to distdevide
        os.rename(basename, BDIPaths.dre_basename)

        print PPF, 'DONE.'