def get_all_items_with_name(name, cataloglist):
    'Searches the catalogs in a list for all items matching a given name.\n\n    Returns:\n      list of pkginfo items; sorted with newest version first. No precedence\n      is given to catalog order.\n    '

    def item_version(item):
        'Returns a MunkiLooseVersion for pkginfo item'
        return pkgutils.MunkiLooseVersion(item['version'])
    itemlist = []
    name = split_name_and_version(name)[0]
    display.display_debug1('Looking for all items matching: %s...', name)
    for catalogname in cataloglist:
        if (not (catalogname in list(_CATALOG.keys()))):
            continue
        if (name in _CATALOG[catalogname]['named']):
            versionsmatchingname = _CATALOG[catalogname]['named'][name]
            for vers in versionsmatchingname:
                if (vers == 'latest'):
                    continue
                indexlist = _CATALOG[catalogname]['named'][name][vers]
                for index in indexlist:
                    thisitem = _CATALOG[catalogname]['items'][index]
                    if (not (thisitem in itemlist)):
                        display.display_debug1('Adding item %s, version %s from catalog %s...', name, thisitem['version'], catalogname)
                        itemlist.append(thisitem)
    if itemlist:
        itemlist.sort(key=item_version, reverse=True)
    return itemlist
Searches the catalogs in a list for all items matching a given name.

Returns:
  list of pkginfo items; sorted with newest version first. No precedence
  is given to catalog order.
def get_all_items_with_name(name, cataloglist):
    'Searches the catalogs in a list for all items matching a given name.\n\n    Returns:\n      list of pkginfo items; sorted with newest version first. No precedence\n      is given to catalog order.\n    '

    def item_version(item):
        'Returns a MunkiLooseVersion for pkginfo item'
        return pkgutils.MunkiLooseVersion(item['version'])
    itemlist = []
    name = split_name_and_version(name)[0]
    display.display_debug1('Looking for all items matching: %s...', name)
    for catalogname in cataloglist:
        if (not (catalogname in list(_CATALOG.keys()))):
            continue
        if (name in _CATALOG[catalogname]['named']):
            versionsmatchingname = _CATALOG[catalogname]['named'][name]
            for vers in versionsmatchingname:
                if (vers == 'latest'):
                    continue
                indexlist = _CATALOG[catalogname]['named'][name][vers]
                for index in indexlist:
                    thisitem = _CATALOG[catalogname]['items'][index]
                    if (not (thisitem in itemlist)):
                        display.display_debug1('Adding item %s, version %s from catalog %s...', name, thisitem['version'], catalogname)
                        itemlist.append(thisitem)
    if itemlist:
        itemlist.sort(key=item_version, reverse=True)
    return itemlist