def _get_pkg_ds_avail():
 avail = '/var/lib/dpkg/available'
 if ((not salt.utils.which('dselect')) or (not os.path.exists(avail))):
  return dict()
 ret = dict()
 pkg_mrk = 'Package:'
 pkg_name = 'package'
 with salt.utils.fopen(avail) as fp_:
  for pkg_info in fp_.read().split(pkg_mrk):
   nfo = dict()
   for line in (pkg_mrk + pkg_info).split(os.linesep):
    line = line.split(': ', 1)
    if (len(line) != 2):
     continue
    (key, value) = line
    if value.strip():
     nfo[key.lower()] = value
   if nfo.get(pkg_name):
    ret[nfo[pkg_name]] = nfo
 return ret

def _get_pkg_ds_avail ( ) : avail = '/var/lib/dpkg/available' if ( ( not salt . utils . which ( 'dselect' ) ) or ( not os . path . exists ( avail ) ) ) : return dict ( ) ret = dict ( ) pkg_mrk = 'Package:' pkg_name = 'package' with salt . utils . fopen ( avail ) as fp_ : for pkg_info in fp_ . read ( ) . split ( pkg_mrk ) : nfo = dict ( ) for line in ( pkg_mrk + pkg_info ) . split ( os . linesep ) : line = line . split ( ': ' , 1 ) if ( len ( line ) != 2 ) : continue ( key , value ) = line if value . strip ( ) : nfo [ key . lower ( ) ] = value if nfo . get ( pkg_name ) : ret [ nfo [ pkg_name ] ] = nfo return ret
get the package information of the available packages .