示例#1
0
        print('Untarring base system')
        for base in opt.base:
            run('tar', 'xf', base, '-C', build_env['INSTALL_DIR'],
                '--strip-components', '1')
        fix_install_paths(build_env['INSTALL_DIR'], arch)

    # This must happen after untarring the base system,
    # as perhaps cache will be found there.
    if opt.ccache:

        try:
            ccache_path = findfile('ccache', build_env['PATH'])
        except:
            # If could not find ccache, build it.
            print("\n========== Building: %s ==========" % ccache.__name__)
            Package.build(ccache(build_env.copy_set_default()))
            ccache_path = findfile('ccache', build_env['PATH'])

        new = dict(
            CC=P.join(compiler_dir, build_env['CC']),
            CXX=P.join(compiler_dir, build_env['CXX']),
        )

        subprocess.check_call(['ln', '-sf', ccache_path, new['CC']])
        subprocess.check_call(['ln', '-sf', ccache_path, new['CXX']])
        build_env.update(new)

    modes = dict(all=lambda pkg: Package.build(pkg, skip_fetch=False),
                 fetch=lambda pkg: pkg.fetch(),
                 nofetch=lambda pkg: Package.build(pkg, skip_fetch=True))
示例#2
0
    else:
        build = (globals()[pkg] for pkg in args)

    if opt.pretend:
        info('I want to build:\n%s' % ' '.join(map(lambda x: x.__name__, build)))
        summary(e)
        sys.exit(0)

    makelink(opt.build_root, 'last-run')

    if opt.base:
        print('Untarring base system')
    for base in opt.base:
        run('tar', 'xf', base, '-C', e['INSTALL_DIR'], '--strip-components', '1')

    modes = dict(
        all     = lambda pkg : Package.build(pkg, skip_fetch=False),
        fetch   = lambda pkg : pkg.fetch(),
        nofetch = lambda pkg : Package.build(pkg, skip_fetch=True))

    try:
        for pkg in build:
            modes[opt.mode](pkg(e.copy_set_default()))
    except PackageError, e:
        die(e)

    makelink(opt.build_root, 'last-completed-run')

    info('\n\nAll done!')
    summary(e)
示例#3
0
    if opt.base and not opt.resume:
        print('Untarring base system')
        for base in opt.base:
            run('tar', 'xf', base, '-C', build_env['INSTALL_DIR'], '--strip-components', '1')
        fix_install_paths(build_env['INSTALL_DIR'], arch)

    # This must happen after untarring the base system,
    # as perhaps cache will be found there.
    if opt.ccache:

        try:
            ccache_path = findfile('ccache', build_env['PATH'])
        except:
            # If could not find ccache, build it.
            print("\n========== Building: %s ==========" % ccache.__name__)
            Package.build(ccache(build_env.copy_set_default()))
            ccache_path = findfile('ccache', build_env['PATH'])

        new = dict(
            CC  = P.join(compiler_dir, build_env['CC']),
            CXX = P.join(compiler_dir, build_env['CXX']),
        )

        subprocess.check_call(['ln', '-sf', ccache_path, new['CC']])
        subprocess.check_call(['ln', '-sf', ccache_path, new['CXX']])
        build_env.update(new)

    modes = dict(
        all     = lambda pkg : Package.build(pkg, skip_fetch=False),
        fetch   = lambda pkg : pkg.fetch(),
        nofetch = lambda pkg : Package.build(pkg, skip_fetch=True))
示例#4
0
 # Build the packages, skipping the ones already done
 done_file = opt.build_root + "/done.txt"
 done = read_done(done_file)
 try:
     for pkg in build:
         name = pkg.__name__
         if name in done and name != 'binarybuilder':
             print("Package %s was already built, skipping" % name)
             continue
         print("\n========== Building: %s ==========" % name)
         # Make several attempts, perhaps the servers are down.
         num = 10
         for i in range(0, num):
             try:
                 # Build
                 modes[opt.mode](pkg(build_env.copy_set_default()))
                 # Mark as done
                 name = pkg.__name__
                 chksum = get_chksum(name)
                 done[name] = chksum
                 # Save the status after each package was built,
                 # in case the process gets interrupted.
                 write_done(done, done_file)
                 break
             except Exception as e:
                 print("Failed to build %s in attempt %d %s" %
                       (name, i, str(e)))
                 raise
                 #if i < num-1:
                 #    print("Sleep for 60 seconds and try again")
                 #    time.sleep(60)