def _yum_pkginfo(output):
 cur = {}
 keys = itertools.cycle(('name', 'version', 'repoid'))
 values = salt.utils.itertools.split(_strip_headers(output))
 osarch = __grains__['osarch']
 for (key, value) in zip(keys, values):
  if (key == 'name'):
   try:
    (cur['name'], cur['arch']) = value.rsplit('.', 1)
   except ValueError:
    cur['name'] = value
    cur['arch'] = osarch
   cur['name'] = salt.utils.pkg.rpm.resolve_name(cur['name'], cur['arch'], osarch)
  else:
   if (key == 'version'):
    value = value.rstrip('-')
   elif (key == 'repoid'):
    value = value.lstrip('@')
   cur[key] = value
   if (key == 'repoid'):
    pkginfo = salt.utils.pkg.rpm.pkginfo(**cur)
    cur = {}
    if (pkginfo is not None):
     (yield pkginfo)

def _yum_pkginfo ( output ) : cur = { } keys = itertools . cycle ( ( 'name' , 'version' , 'repoid' ) ) values = salt . utils . itertools . split ( _strip_headers ( output ) ) osarch = __grains__ [ 'osarch' ] for ( key , value ) in zip ( keys , values ) : if ( key == 'name' ) : try : ( cur [ 'name' ] , cur [ 'arch' ] ) = value . rsplit ( '.' , 1 ) except ValueError : cur [ 'name' ] = value cur [ 'arch' ] = osarch cur [ 'name' ] = salt . utils . pkg . rpm . resolve_name ( cur [ 'name' ] , cur [ 'arch' ] , osarch ) else : if ( key == 'version' ) : value = value . rstrip ( '-' ) elif ( key == 'repoid' ) : value = value . lstrip ( '@' ) cur [ key ] = value if ( key == 'repoid' ) : pkginfo = salt . utils . pkg . rpm . pkginfo ( ** cur ) cur = { } if ( pkginfo is not None ) : ( yield pkginfo )
parse yum/dnf output retrieving the name .