def _parse_reported_packages_from_install_output(output):
    '''
    Parses the output of "opkg install" to determine what packages would have been
    installed by an operation run with the --noaction flag.

    We are looking for lines like:
        Installing <package> (<version>) on <target>
    or
        Upgrading <package> from <oldVersion> to <version> on root
    '''
    reported_pkgs = {}
    install_pattern = re.compile(r'Installing\s(?P<package>.*?)\s\((?P<version>.*?)\)\son\s(?P<target>.*?)')
    upgrade_pattern = re.compile(r'Upgrading\s(?P<package>.*?)\sfrom\s(?P<oldVersion>.*?)\sto\s(?P<version>.*?)\son\s(?P<target>.*?)')
    for line in salt.utils.itertools.split(output, '\n'):
        match = install_pattern.match(line)
        if match is None:
            match = upgrade_pattern.match(line)
        if match:
            reported_pkgs[match.group('package')] = match.group('version')

    return reported_pkgs
def _parse_reported_packages_from_install_output ( output ) : reported_pkgs = { } install_pattern = re . compile ( r'Installing\s(?P<package>.*?)\s\((?P<version>.*?)\)\son\s(?P<target>.*?)' ) upgrade_pattern = re . compile ( r'Upgrading\s(?P<package>.*?)\sfrom\s(?P<oldVersion>.*?)\sto\s(?P<version>.*?)\son\s(?P<target>.*?)' ) for line in salt . utils . itertools . split ( output , '\n' ) : match = install_pattern . match ( line ) if match is None : match = upgrade_pattern . match ( line ) if match : reported_pkgs [ match . group ( 'package' ) ] = match . group ( 'version' ) return reported_pkgs
Parses the output of "opkg install" to determine what packages would have been
    installed by an operation run with the --noaction flag.

    We are looking for lines like:
        Installing <package> (<version>) on <target>
    or
        Upgrading <package> from <oldVersion> to <version> on root