def _set_state(pkg, state):
 ret = {}
 valid_states = ('hold', 'noprune', 'user', 'ok', 'installed', 'unpacked')
 if (state not in valid_states):
  raise SaltInvocationError('Invalid state: {0}'.format(state))
 oldstate = _get_state(pkg)
 cmd = ['opkg', 'flag']
 cmd.append(state)
 cmd.append(pkg)
 _out = __salt__['cmd.run'](cmd, python_shell=False)
 ret[pkg] = {'old': oldstate, 'new': state}
 return ret

def _set_state ( pkg , state ) : ret = { } valid_states = ( 'hold' , 'noprune' , 'user' , 'ok' , 'installed' , 'unpacked' ) if ( state not in valid_states ) : raise SaltInvocationError ( 'Invalid state: {0}' . format ( state ) ) oldstate = _get_state ( pkg ) cmd = [ 'opkg' , 'flag' ] cmd . append ( state ) cmd . append ( pkg ) _out = __salt__ [ 'cmd.run' ] ( cmd , python_shell = False ) ret [ pkg ] = { 'old' : oldstate , 'new' : state } return ret
change package state on the opkg database the state can be any of: - hold - noprune - user - ok - installed - unpacked this command is commonly used to mark a specific package to be held from being upgraded .