def _resolve_deps(name, pkgs, **kwargs):
 missing_deps = []
 for pkg_file in pkgs:
  deb = apt.debfile.DebPackage(filename=pkg_file, cache=apt.Cache())
  if deb.check():
   missing_deps.extend(deb.missing_deps)
 if missing_deps:
  cmd = ['apt-get', '-q', '-y']
  cmd = (cmd + ['-o', 'DPkg::Options::=--force-confold'])
  cmd = (cmd + ['-o', 'DPkg::Options::=--force-confdef'])
  cmd.append('install')
  cmd.extend(missing_deps)
  ret = __salt__['cmd.retcode'](cmd, env=kwargs.get('env'), python_shell=False)
  if (ret != 0):
   raise CommandExecutionError('Error: unable to resolve dependencies for: {0}'.format(name))
  else:
   try:
    cmd = (['apt-mark', 'auto'] + missing_deps)
    __salt__['cmd.run'](cmd, env=kwargs.get('env'), python_shell=False)
   except MinionError as exc:
    raise CommandExecutionError(exc)
 return

def _resolve_deps ( name , pkgs , ** kwargs ) : missing_deps = [ ] for pkg_file in pkgs : deb = apt . debfile . DebPackage ( filename = pkg_file , cache = apt . Cache ( ) ) if deb . check ( ) : missing_deps . extend ( deb . missing_deps ) if missing_deps : cmd = [ 'apt-get' , '-q' , '-y' ] cmd = ( cmd + [ '-o' , 'DPkg::Options::=--force-confold' ] ) cmd = ( cmd + [ '-o' , 'DPkg::Options::=--force-confdef' ] ) cmd . append ( 'install' ) cmd . extend ( missing_deps ) ret = __salt__ [ 'cmd.retcode' ] ( cmd , env = kwargs . get ( 'env' ) , python_shell = False ) if ( ret != 0 ) : raise CommandExecutionError ( 'Error: unable to resolve dependencies for: {0}' . format ( name ) ) else : try : cmd = ( [ 'apt-mark' , 'auto' ] + missing_deps ) __salt__ [ 'cmd.run' ] ( cmd , env = kwargs . get ( 'env' ) , python_shell = False ) except MinionError as exc : raise CommandExecutionError ( exc ) return
installs missing dependencies and marks them as auto installed so they are removed when no more manually installed packages depend on them .