def install_packages(env, to_install=None, packages=None): """Install packages using the home brew package manager. Handles upgrading brew, tapping required repositories and installing or upgrading packages as appropriate. `to_install` is a CloudBioLinux compatible set of top level items to add, alternatively `packages` is a list of raw package names. """ config_file = get_config_file(env, "packages-homebrew.yaml") if to_install: (packages, _) = _yaml_to_packages(config_file.base, to_install, config_file.dist) # if we have no packages to install, do not try to install or update brew if len(packages) == 0: return system.install_homebrew(env) brew_cmd = _brew_cmd(env) formula_repos = ["homebrew/science", "chapmanb/cbl"] current_taps = set([x.strip() for x in env.safe_run_output("%s tap" % brew_cmd).split()]) _safe_update(env, brew_cmd, formula_repos, current_taps) for repo in formula_repos: if repo not in current_taps: env.safe_run("%s tap %s" % (brew_cmd, repo)) env.safe_run("%s tap --repair" % brew_cmd) ipkgs = {"outdated": set([x.strip() for x in env.safe_run_output("%s outdated" % brew_cmd).split()]), "current": _get_current_pkgs(env, brew_cmd)} _install_brew_baseline(env, brew_cmd, ipkgs, packages) for pkg_str in packages: _install_pkg(env, pkg_str, brew_cmd, ipkgs)
def _setup_macosx(env): # XXX Only framework in place; needs testing env.logger.info("MacOSX setup") # XXX Ensure XCode is installed and provide useful directions if not system.install_homebrew(env) # XXX find java correctly env.java_home = ""
def install_packages(env, to_install=None, packages=None): """Install packages using the home brew package manager. Handles upgrading brew, tapping required repositories and installing or upgrading packages as appropriate. `to_install` is a CloudBioLinux compatible set of top level items to add, alternatively `packages` is a list of raw package names. """ config_file = get_config_file(env, "packages-homebrew.yaml") if to_install: (packages, _) = _yaml_to_packages(config_file.base, to_install, config_file.dist) # if we have no packages to install, do not try to install or update brew if len(packages) == 0: _remove_old(env, config_file.base) return system.install_homebrew(env) brew_cmd = _brew_cmd(env) formula_repos = ["homebrew/science", "chapmanb/cbl", "homebrew/dupes"] current_taps = set( [x.strip() for x in env.safe_run_output("%s tap" % brew_cmd).split()]) _safe_update(env, brew_cmd, formula_repos, current_taps) current_taps = set( [x.strip() for x in env.safe_run_output("%s tap" % brew_cmd).split()]) for repo in formula_repos: if repo not in current_taps: env.safe_run("%s tap %s" % (brew_cmd, repo)) env.safe_run("%s tap --repair" % brew_cmd) ipkgs = { "outdated": set([ x.strip() for x in env.safe_run_output("%s outdated" % brew_cmd).split() ]), "current": _get_current_pkgs(env, brew_cmd) } _install_brew_baseline(env, brew_cmd, ipkgs, packages) ipkgs = { "outdated": set([ x.strip() for x in env.safe_run_output("%s outdated" % brew_cmd).split() ]), "current": _get_current_pkgs(env, brew_cmd) } for pkg_str in packages: _install_pkg(env, pkg_str, brew_cmd, ipkgs) for pkg_str in ["pkg-config", "openssl", "cmake", "unzip"]: _safe_unlink_pkg(env, pkg_str, brew_cmd) with open(config_file.base) as in_handle: to_remove = yaml.load(in_handle).get("to_remove", []) for pkg_str in ["curl"] + to_remove: _safe_uninstall_pkg(env, pkg_str, brew_cmd)
def install_brew(p=None, flavor=None): """Top level access to homebrew/linuxbrew packages. p is a package name to install, or all configured packages if not specified. """ _setup_logging(env) _configure_fabric_environment(env, flavor, ignore_distcheck=True) system.install_homebrew(env) if p is not None: brew.install_packages(env, packages=[p]) else: pkg_install = _read_main_config()[0] brew.install_packages(env, to_install=pkg_install)
def install_brew(p=None, version=None, flavor=None): """Top level access to homebrew/linuxbrew packages. p is a package name to install, or all configured packages if not specified. """ _setup_logging(env) _configure_fabric_environment(env, flavor, ignore_distcheck=True) system.install_homebrew(env) if p is not None: if version: p = "%s==%s" % (p, version) brew.install_packages(env, packages=[p]) else: pkg_install = _read_main_config()[0] brew.install_packages(env, to_install=pkg_install)