Esempio n. 1
0
def libc_version():
    locations=['/lib/x86_64-linux-gnu/libc.so.6','/lib/i386-linux-gnu/libc.so.6','/lib/i686-linux-gnu/libc.so.6','/lib/libc.so.6','/lib64/libc.so.6','/lib32/libc.so.6']
    for library in locations:
        if P.isfile(library):
            output = run(library).split('\n')[0]
            return re.search('[^0-9.]*([0-9.]*).*',output).groups()
    return "FAILED"
    def helper(self, *args, **kw):
        '''Run a command line command with some extra argument handling'''
        info(' '.join(args))
        kw['stdout'] = kw.get('stdout', sys.stdout)
        kw['stderr'] = kw.get('stderr', kw['stdout'])

        if kw.get('cwd', None) is None:
            kw['cwd'] = self.workdir
        if kw.get('env', None) is None:
            kw['env'] = self.env
        kw['raise_on_failure'] = False
        kw['want_stderr'] = True

        try:
            out, err = run(*args, **kw)
            if out is None:
                return out, err
            if out is False:
                raise HelperError(args[0], kw['env'], err)
            return out, err
        except (TypeError, ) as e:
            raise Exception('%s\n%s' % (e.message, '\t\n'.join([
                '\t%s=%s%s' % (name, type(value).__name__, value)
                for name, value in kw['env'].iteritems()
                if not isinstance(value, str)
            ])))
        except (OSError, subprocess.CalledProcessError) as e:
            raise HelperError(args[0], kw['env'], e)
Esempio n. 3
0
def libc_version():
    locations=['/lib/x86_64-linux-gnu/libc.so.6', '/lib/i386-linux-gnu/libc.so.6',
               '/lib/i686-linux-gnu/libc.so.6', '/lib/libc.so.6', '/lib64/libc.so.6', '/lib32/libc.so.6']
    for library in locations:
        if P.isfile(library):
            output = run(library).split('\n')[0]
            return re.search('[^0-9.]*([0-9.]*).*',output).groups()
    return "FAILED"
Esempio n. 4
0
def tarball_name():
    arch = get_platform()
    if opt.version is not None:
        return '%s-%s-%s-%s' % (opt.name, opt.version, arch.machine, arch.prettyos)
    else:
        git = run('git', 'describe', '--always', '--dirty', output=False, raise_on_failure=False)
        if git is None: git = ''
        if len(git): git = '%s-' % git.strip()
        return '%s-%s-%s-%s%s' % (opt.name, arch.machine, arch.prettyos, git, time.strftime('%Y-%m-%d_%H-%M-%S', time.localtime()))
Esempio n. 5
0
def tarball_name():
    arch = get_platform()
    if opt.version is not None:
        return '%s-%s-%s-%s%s' % (opt.name, opt.version, arch.machine, arch.dist_name, arch.dist_version)
    else:
        git = run('git', 'describe', '--always', '--dirty', output=False, raise_on_failure=False)
        if git is None: git = ''
        if len(git): git = '%s' % git.strip()
        return '%s-%s-%s%s-%s%s' % (opt.name, arch.machine, arch.dist_name, arch.dist_version, time.strftime('%Y-%m-%d_%H-%M-%S', time.localtime()), git)
Esempio n. 6
0
def tarball_name():
    arch = get_platform()
    if opt.version is not None:
        return "%s-%s-%s-%s%s" % (opt.name, opt.version, arch.machine, arch.dist_name, arch.dist_version)
    else:
        git = run("git", "describe", "--always", "--dirty", output=False, raise_on_failure=False)
        if git is None:
            git = ""
        if len(git):
            git = "%s" % git.strip()
        return "%s-%s-%s%s-%s%s" % (
            opt.name,
            arch.machine,
            arch.dist_name,
            arch.dist_version,
            time.strftime("%Y-%m-%d_%H-%M-%S", time.localtime()),
            git,
        )
Esempio n. 7
0
    if not len(args) == 2:
        usage('Missing required argument: installdir', code)
    tarball = P.realpath(args[0])
    installdir = P.realpath(args[1])
    if not P.exists(tarball):
        usage('Invalid tarball %s (does not exist)' % tarball, code)
    if not (P.exists(installdir)):
        os.makedirs(installdir)
    if not (P.isdir(installdir)):
        usage('Invalid installdir %s (not a directory)' % installdir, code)
    logging.basicConfig(level=opt.loglevel)

    if not opt.skip_extraction:
        print('Extracting tarball')
        run('tar', 'xf', tarball, '-C', installdir, '--strip-components', '1')

    arch = get_platform()
    fix_install_paths(installdir, arch)

    # Replace /home/user with $HOME, looks nicer in the output
    vardir = installdir
    r = re.compile('^' + os.environ["HOME"] + '(.*?)$')
    m = r.search(vardir)
    if m:
        vardir = '$HOME' + m.group(1)

    prefix = '$PWD/build'
    config_file = P.join(installdir, 'config.options.vw')
    write_vw_config(prefix, vardir, arch, config_file)