def _apt_packages(to_install=None, pkg_list=None):
    """
    Install packages available via apt-get.
    Note that ``to_install`` and ``pkg_list`` arguments cannot be used simultaneously.

    :type to_install:  list
    :param to_install: A list of strings (ie, groups) present in the ``main.yaml``
                       config file that will be used to filter out the specific
                       packages to be installed.

    :type pkg_list:  list
    :param pkg_list: An explicit list of packages to install. No other files,
                     flavors are considered.
    """
    if "minimal" not in env.flavor.short_name:
        env.logger.info("Update the system")
        with settings(warn_only=True):
            env.safe_sudo("apt-get update")
    if to_install is not None:
        config_file = get_config_file(env, "packages.yaml")
        if "minimal" not in env.flavor.name and "minimal" not in env.flavor.short_name:
            env.flavor.apt_upgrade_system(env=env)
        (packages, _) = _yaml_to_packages(config_file.base, to_install, config_file.dist)
        packages = env.flavor.rewrite_config_items("packages", packages)
    elif pkg_list is not None:
        env.logger.info("Will install specific packages: {0}".format(pkg_list))
        packages = pkg_list
    else:
        raise ValueError("Need a file with packages or a list of packages")
    # A single line install is much faster - note that there is a max
    # for the command line size, so we do 30 at a time
    group_size = 30
    i = 0
    env.logger.info("Installing %i packages" % len(packages))
    while i < len(packages):
        env.logger.info("Package install progress: {0}/{1}".format(i, len(packages)))
        env.safe_sudo("apt-get -y --force-yes install %s" % " ".join(packages[i:i + group_size]))
        i += group_size
    env.safe_sudo("apt-get clean")
dataset/ETHPy150Open chapmanb/cloudbiolinux/cloudbio/package/deb.py/_apt_packages/original