def parse_pkginfo(line, osarch=None):
 try:
  (name, epoch, version, release, arch, repoid) = line.split('_|-')
 except ValueError:
  return None
 name = resolve_name(name, arch, osarch)
 if release:
  version += '-{0}'.format(release)
 if (epoch not in ('(none)', '0')):
  version = ':'.join((epoch, version))
 return pkginfo(name, version, arch, repoid)

def parse_pkginfo ( line , osarch = None ) : try : ( name , epoch , version , release , arch , repoid ) = line . split ( '_|-' ) except ValueError : return None name = resolve_name ( name , arch , osarch ) if release : version += '-{0}' . format ( release ) if ( epoch not in ( '(none)' , '0' ) ) : version = ':' . join ( ( epoch , version ) ) return pkginfo ( name , version , arch , repoid )
a small helper to parse an rpm/repoquery commands output .