def _install_brew_baseline(env, brew_cmd, ipkgs, packages):
    for dep in ["openssl"]:
        _safe_link_pkg(env, dep, brew_cmd)
    for dep in ["expat", "pkg-config", "xz", "unzip"]:
        _install_pkg(env, dep, brew_cmd, ipkgs)
    # check if we have an older git and need to install it from brew
    git_version = None
    with quiet():
        with settings(warn_only=True):
            git_version = env.safe_run_output("git --version").strip().split()[-1]
    if git_version and LooseVersion(git_version) < LooseVersion("1.7"):
        _install_pkg(env, "git", brew_cmd, ipkgs)
    for dep in ["sambamba"]:  # Avoid conflict with homebrew-science sambamba
        env.safe_run("{brew_cmd} remove --force {dep}".format(**locals()))
    for dependency in ["htslib"]:
        if dependency in packages:
            if (dependency in ipkgs["outdated"] or "chapmanb/cbl/%s" % dependency in ipkgs["outdated"]
                  or dependency not in ipkgs["current"]):
                _install_pkg_latest(env, dependency, [], brew_cmd, ipkgs)
    if "cpanminus" in packages:
        _install_pkg_latest(env, "cpanminus", [], brew_cmd, ipkgs)
        _install_pkg_latest(env, "samtools-library-0.1", [], brew_cmd, ipkgs)
        cpan.install_packages(env)
    # Ensure paths we may have missed on install are accessible to regular user
    if env.use_sudo:
        paths = ["share", "share/java"]
        for path in paths:
            with quiet():
                test_access = env.safe_run("test -d %s/%s && test -O %s/%s" % (env.system_install, path,
                                                                               env.system_install, path))
            if test_access.failed and env.safe_exists("%s/%s" % (env.system_install, path)):
                env.safe_sudo("chown %s %s/%s" % (env.user, env.system_install, path))
Install baseline brew components not handled by dependency system.
dataset/ETHPy150Open chapmanb/cloudbiolinux/cloudbio/package/brew.py/_install_brew_baseline