def upgrade(*names, **kwargs):
    ret = {'changes': {},
           'result': True,
           'comment': '',
           }

    jail = kwargs.pop('jail', None)
    chroot = kwargs.pop('chroot', None)
    force = kwargs.pop('force', False)
    local = kwargs.pop('local', False)
    dryrun = kwargs.pop('dryrun', False)
    opts = ''
    if force:
        opts += 'f'
    if local:
        opts += 'L'
    if dryrun:
        opts += 'n'
    if not dryrun:
        opts += 'y'
    if opts:
        opts = '-' + opts

    cmd = _pkg(jail, chroot)
    cmd.append('upgrade')
    if opts:
        cmd.append('-' + opts)
    cmd.extend(names)

    old = list_pkgs()
    call = __salt__['cmd.run_all'](cmd,
                                   output_loglevel='trace',
                                   python_shell=False,
                                   redirect_stderr=True)

    if call['retcode'] != 0:
        ret['result'] = False
        if call['stdout']:
            ret['comment'] = call['stdout']

    __context__.pop(_contextkey(jail, chroot), None)
    __context__.pop(_contextkey(jail, chroot, prefix='pkg.origin'), None)
    new = list_pkgs()
    ret['changes'] = salt.utils.compare_dicts(old, new)

    return ret
Upgrade named or all packages (run a ``pkg upgrade``). If <package name> is
dataset/ETHPy150Open saltstack/salt/salt/modules/pkgng.py/upgrade