@task
def install_packages(*roles):
    """Install packages for the given roles."""
    config_file = os.path.join(CONF_ROOT, u'packages.conf')
    config = ConfigParser.SafeConfigParser()
    config.read(config_file)
    for role in roles:
        if config.has_section(role):
            # Get ppas
            if config.has_option(role, 'ppas'):
                for ppa in config.get(role, 'ppas').split(' '):
                    system.add_ppa(ppa, update=False)
            # Get sources
            if config.has_option(role, 'sources'):
                for section in config.get(role, 'sources').split(' '):
                    source = config.get(section, 'source')
                    key = config.get(section, 'key')
                    system.add_apt_source(source=source, key=key, update=False)
            sudo(u"apt-get update")
            sudo(u"apt-get install -y %s" % config.get(role, 'packages'))
            sudo(u"apt-get upgrade -y")
dataset/ETHPy150Open python/raspberryio/fabfile.py/install_packages/original