Build the control part of the .deb package.
515002
function buildControlFile (tempPath, definition, callback) {
  var self = this

  var author = ''
  if (definition.package.author) {
    author = typeof definition.package.author === 'string'
      ? definition.package.author
      : definition.package.author.name + ' <' + definition.package.author.email + '>'
  }

  self.controlFile = {
    Package: definition.info.name || definition.package.name,
    Version: definition.package.version + '-' + (definition.info.rev || '1'),
    'Installed-Size': Math.ceil(self.pkgSize / 1024),
    Section: 'misc',
    Priority: 'optional',
    Architecture: definition.info.arch || 'all',
    Depends: definition.info.depends || 'lsb-base (>= 3.2)',
    Maintainer: author
  }

  // optional items
  if (definition.package.license) {
    self.controlFile.License = definition.package.license
  }

  // optional items
  if (definition.package.homepage) {
    self.controlFile.Homepage = definition.package.homepage
  }

  self.controlFile.Description = definition.package.description + '\n ' +
    (definition.info.name || definition.package.name) +
    ': ' + definition.package.description

  // create the control file
  async.parallel([
    function createControlFile (prlDone) {
      var controlHeader = ''
      async.forEachOf(self.controlFile, function (value, key, done) {
        controlHeader += key + ': ' + value + '\n'
        done()
      }, function (err) {
        if (err) {
          debug('could not write control file')
          return prlDone(err)
        }

        self.control.entry({name: './control'}, controlHeader, prlDone)
      })
    }, function createHashFile (prlDone) {
      var fileContent = ''
      for (var i = 0; i < self.filesMd5.length; i++) {
        fileContent += self.filesMd5[i].md5 + '  ' + self.filesMd5[i].path.replace(/^\W*/, '') + '\n'
      }
      self.control.entry({name: './md5sums'}, fileContent, prlDone)
    }, function addScripts (prlDone) {
      async.forEachOf(definition.info.scripts, function (path, scriptName, doneScript) {
        debug('processing script ', path)
        async.waterfall([
          fs.access.bind(fs, path, fs.F_OK),
          fs.stat.bind(fs, path),
          function readFile (stats, wtfDone) {
            fs.readFile(path, function (err, data) {
              wtfDone(err, stats, data)
            })
          },
          function addScript (stats, data, wtfDone) {
            debug('adding script ', scriptName)
            self.control.entry({
              name: './' + scriptName,
              size: stats.size,
              mode: parseInt('755', 8)
            }, data, wtfDone)
          }
        ], doneScript)
      }, prlDone)
    }
  ], function (err) {
    if (err) {
      debug('could not write control tarball')
      return callback(err)
    }

    debug('successfully created control file')

    self.control.finalize()

    var file = fs.createWriteStream(path.join(tempPath, 'control.tar.gz'))
    file.on('finish', callback)

    var compress = zlib.createGzip()
    compress.pipe(file)
    self.control.pipe(compress)
  })
}
1004483
def build(ctx, less=False, docs=False, js=False, force=False):
    
    specified = any([less, docs, js])
    buildall = not specified

    if buildall or less:
        less_fname = ctx.pkg.source_less / ctx.pkg.name + '.less'
        if less_fname.exists():
            lessc.LessRule(
                ctx,
                src='{pkg.source_less}/{pkg.name}.less',
                dst='{pkg.django_static}/{pkg.name}/css/{pkg.name}-{version}.min.css',
                force=force
            )
        elif less:
            print("WARNING: build --less specified, but no file at:", less_fname)

    if buildall or docs:
        if WARN_ABOUT_SETTINGS:
            warnings.warn(
                "autodoc might need a dummy settings file in the root of "
                "your package. Since it runs in a separate process you cannot"
                "use settings.configure()"
            )
        doctools.build(ctx, force=force)

    if buildall or js:
        build_js(ctx, force)

    if HAVE_SETTINGS and (force or changed(ctx.pkg.django_static)):
        collectstatic(ctx, DJANGO_SETTINGS_MODULE)
565758
def cli(ctx, board, scons, project_dir, sayyes):
    """"""

    if scons:
        Project().create_sconstruct(project_dir, sayyes)
    elif board:
        Project().create_ini(board, project_dir, sayyes)
    else:
        click.secho(ctx.get_help())
374055
def run():
	
	parser = argparse.ArgumentParser()
	parser.add_argument(
		'--deps-def',
		default=data_lines_from_file("system deps.txt")
		+ data_lines_from_file("build deps.txt"),
		help="A file specifying the dependencies (one per line)",
		type=data_lines_from_file, dest="spec_deps")
	parser.add_argument(
		'--dep', action="append", default=[],
		help="A specific dependency (multiple allowed)", dest="deps")
	parser.add_argument(
		'command', type=shlex.split,
		default=shlex.split("python2.7 setup.py test"),
		help="Command to invoke in the context of the dependencies")
	parser.add_argument(
		'--do-not-remove', default=False, action="store_true",
		help="Keep any installed packages")
	parser.add_argument(
		'--aggressively-remove', default=False,
		action="store_true",
		help="When removing packages, also remove those automatically installed"
		" as dependencies")
	parser.add_argument(
		'-l', '--log-level', default=logging.INFO,
		type=log_level, help="Set log level (DEBUG, INFO, WARNING, ERROR)")
	args = parser.parse_args()
	logging.basicConfig(level=args.log_level)
	context = dependency_context(
		args.spec_deps + args.deps,
		aggressively_remove=args.aggressively_remove)
	with context as to_remove:
		if args.do_not_remove:
			del to_remove[:]
		raise SystemExit(subprocess.Popen(args.command).wait())
687399
def build_single(mode):
    """"""
    if mode == 'force':
        amode = ['-a']
    else:
        amode = []
    if executable.endswith('uwsgi'):
        # hack, might fail in some environments!
        _executable = executable[:-5] + 'python'
    else:
        _executable = executable
    p = subprocess.Popen([_executable, '-m', 'nikola', 'build'] + amode,
                         stderr=subprocess.PIPE)
    p.wait()
    rl = p.stderr.readlines()
    try:
        out = ''.join(rl)
    except TypeError:
        out = ''.join(l.decode('utf-8') for l in rl)
    return (p.returncode == 0), out
1168736
function _managePkgDeps(spkg, tpkg, deps, check) {
  deps = deps||'dependencies';
  const source = spkg[deps]||{};
  const target = tpkg[deps]||{};
  _.keys(source).forEach(function(dep){
    if (!!check && !target[dep]) _state.counters.depAddUpd++;
    _log('[PACKAGE] %s: %s = %s', deps, dep, source[dep]);
    target[dep] = source[dep];
  });
}
1149613
def copy_dependency_docs(tile):
    """"""

    env = Environment(tools=[])

    outputbase = os.path.join('build', 'output', 'doc')
    depbase = os.path.join('build', 'deps')
    for dep in tile.dependencies:
        depdir = os.path.join(depbase, dep['unique_id'], 'doc', dep['unique_id'])
        outputdir = os.path.join(outputbase, dep['unique_id'])

        if os.path.exists(depdir):
            env.Command([outputdir], [depdir], Copy("$TARGET", "$SOURCE"))
1083479
def build_cpp(build_context, target, compiler_config, workspace_dir):
    """"""
    rmtree(workspace_dir)
    binary = join(*split(target.name))
    objects = link_cpp_artifacts(build_context, target, workspace_dir, True)
    buildenv_workspace = build_context.conf.host_to_buildenv_path(
        workspace_dir)
    objects.extend(compile_cc(
        build_context, compiler_config, target.props.in_buildenv,
        get_source_files(target, build_context), workspace_dir,
        buildenv_workspace, target.props.cmd_env))
    bin_file = join(buildenv_workspace, binary)
    link_cmd = (
        [compiler_config.linker, '-o', bin_file] +
        objects + compiler_config.link_flags)
    build_context.run_in_buildenv(
        target.props.in_buildenv, link_cmd, target.props.cmd_env)
    target.artifacts.add(AT.binary, relpath(join(workspace_dir, binary),
                         build_context.conf.project_root), binary)
856931
def Build(self):
    """"""
    self.SetupVars()
    self.Clean()

    if not os.path.exists(args.grr_src):
      self.GitCheckoutGRR()
    proto_sdist = self.MakeProtoSdist()
    core_sdist = self.MakeCoreSdist()
    client_sdist = self.MakeClientSdist()
    client_builder_sdist = self.MakeClientBuilderSdist()

    self.InstallGRR(proto_sdist)
    self.InstallGRR(core_sdist)
    self.InstallGRR(client_sdist)
    self.InstallGRR(client_builder_sdist)
    self.BuildTemplates()
    if args.test_repack_install:
      self._RepackTemplates()
      self._InstallInstallers()
77766
def dump(self):
        """"""
        id = self.get("id")
        if not id:
            id = "(none)"
        else:
            id = id[0]

        parent = self.get("parent")
        if not parent:
            parent = "(none)"
        else:
            parent = parent[0]

        print "'%s'" % id
        print "Parent project:%s", parent
        print "Requirements:%s", self.get("requirements")
        print "Default build:%s", string.join(self.get("debuild-build"))
        print "Source location:%s", string.join(self.get("source-location"))
        print "Projects to build:%s", string.join(self.get("projects-to-build").sort());
458898
def expand_dependencies_section(section, kwargs):
    """"""
    deps = []

    for dep in section:
        for dep_type, dep_list in dep.items():
            if dep_type in ['call', 'use']:
                deps.extend(Command(dep_type, dep_list, kwargs).run())
            elif dep_type.startswith('if ') or dep_type == 'else':
                deps.append({dep_type: expand_dependencies_section(dep_list, kwargs)})
            else:
                deps.append({dep_type: dep_list})

    return deps
1321
def main():
    """"""
    conf = init_and_get_conf()
    logger = make_logger(__name__)
    logger.info('YaBT version {}', __version__)
    handlers = {
        'build': YabtCommand(func=cmd_build, requires_project=True),
        'dot': YabtCommand(func=cmd_dot, requires_project=True),
        'test': YabtCommand(func=cmd_test, requires_project=True),
        'tree': YabtCommand(func=cmd_tree, requires_project=True),
        'version': YabtCommand(func=cmd_version, requires_project=False),
        'list-builders': YabtCommand(func=cmd_list, requires_project=False),
    }
    command = handlers[conf.cmd]
    if command.requires_project and not conf.in_yabt_project():
        fatal('Not a YABT project (or any of the parent directories): {}',
              BUILD_PROJ_FILE)
    try:
        command.func(conf)
    except Exception as ex:
        fatal('{}', ex)
686999
def make_blastcmd_builder(
    mode, outdir, format_exe=None, blast_exe=None, prefix="ANIBLAST"
):
    """"""
    if mode == "ANIb":  # BLAST/formatting executable depends on mode
        blastcmds = BLASTcmds(
            BLASTfunctions(construct_makeblastdb_cmd, construct_blastn_cmdline),
            BLASTexes(
                format_exe or pyani_config.MAKEBLASTDB_DEFAULT,
                blast_exe or pyani_config.BLASTN_DEFAULT,
            ),
            prefix,
            outdir,
        )
    else:
        blastcmds = BLASTcmds(
            BLASTfunctions(construct_formatdb_cmd, construct_blastall_cmdline),
            BLASTexes(
                format_exe or pyani_config.FORMATDB_DEFAULT,
                blast_exe or pyani_config.BLASTALL_DEFAULT,
            ),
            prefix,
            outdir,
        )
    return blastcmds
44230
def build(self):
        """"""
        if os.path.exists(self.build_path) and not os.path.isdir(self.build_path):
            self._logger.error('Output path must be a folder if it already exists')
            return
        Compiler._mkdir(self.build_path)
        self._execute_backend_on_spec()
33725
def build(self):
        
        pkg_security([self.name])
        self.error_uns()
        if self.FAULT:
            print("")
            self.msg.template(78)
            print("| Package {0} {1} {2} {3}".format(self.prgnam, self.red,
                                                     self.FAULT, self.endc))
            self.msg.template(78)
        else:
            sources = []
            if not os.path.exists(self.meta.build_path):
                os.makedirs(self.meta.build_path)
            if not os.path.exists(self._SOURCES):
                os.makedirs(self._SOURCES)
            os.chdir(self.meta.build_path)
            Download(self.meta.build_path, self.sbo_dwn.split(),
                     repo="sbo").start()
            Download(self._SOURCES, self.source_dwn, repo="sbo").start()
            script = self.sbo_dwn.split("/")[-1]
            for src in self.source_dwn:
                sources.append(src.split("/")[-1])
            BuildPackage(script, sources, self.meta.build_path,
                         auto=False).build()
            slack_package(self.prgnam)
469720
def build_deb(ctx, target):
    
    if target not in ('ubuntu-trusty',):
        print('Error: unknown target "{0}"!'.format(target), file=sys.stderr)
        sys.exit(1)

    os.chdir(PROJECT_DIR)
    debbuild_dir = os.path.join(DIST_DIR, 'deb')

    # Create directories layout
    ctx.run('mkdir -p {0}'.format(debbuild_dir))

    # Copy the sources
    build_src(ctx, dest=debbuild_dir)
    src_archive = glob.glob(os.path.join(debbuild_dir, 'mssh-copy-id-*.tar.gz'))[0]
    ctx.run('tar -xvf {0} -C {1}'.format(src_archive, debbuild_dir))
    src_dir = src_archive[:-7]  # uncompressed directory
    ctx.run('cp -r {0} {1}'.format(os.path.join(PROJECT_DIR, 'deb/debian'), src_dir))

    # Build the deb
    ctx.run('docker run -e LOCAL_USER_ID={local_user_id} -v {local}:{cont} {img}'
            .format(local_user_id=os.getuid(),
                    local=debbuild_dir,
                    cont='/deb',
                    img=DOCKER_IMGS[target]['name']))

    ctx.run('mv -f {0} {1}'.format(os.path.join(debbuild_dir, 'mssh-copy-id_*.deb'), DIST_DIR))
628341
def build_db_cmd(self, fname):
        """"""
        return self.funcs.db_func(fname, self.outdir, self.exes.format_exe)[0]