def list_upgrades(refresh=False, root=None):
    upgrades = {}
    cmd = ['pacman', '-S', '-p', '-u', '--print-format', '%n %v']

    if root is not None:
        cmd.extend(('-r', root))

    if refresh:
        cmd.append('-y')

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

    if call['retcode'] != 0:
        comment = ''
        if 'stderr' in call:
            comment += call['stderr']
        if 'stdout' in call:
            comment += call['stdout']
        if comment:
            comment = ': ' + comment
        raise CommandExecutionError('Error listing upgrades' + comment)
    else:
        out = call['stdout']

    for line in salt.utils.itertools.split(out, '\n'):
        comps = line.split(' ')
        if len(comps) != 2:
            continue
        upgrades[comps[0]] = comps[1]
    return upgrades
Format the layer as a printable string.
dataset/ETHPy150Open saltstack/salt/salt/modules/pacman.py/list_upgrades--crossover with--dataset/ETHPy150Open NervanaSystems/neon/neon/layers/layer.py/Layer.__str__