pacman: implement universal transactions
This allows using -S, -U and -R in one command:
pacman -S foo -R bar
To make this work some breaking changes have made.
Targets have to come after the operation:
pacman -S foo //works
pacman -Syu //works
pacman -yuS //works
pacman foo -S //doesn't work
This could be supported with some code to copy all targets before the first operation into the first operation's target list.
And -u as a short for --unneeded has been removed as it conflicts with
--sysupgrade. However as -u/--sysupgrade is bound to -S, accidently
doing pacman -Ru
will not accidently cause a system upgrade.
Another quirk with the UI is that -S has many non transaction related
flags, -Sc -Sg -Sl -Si. These have been split off as "sync only" flags.
Meaning they show up with pacman -Si foo
but will be invalid on
pacman -R bar -Si foo
.
Also when -R'ing and -S'ing the same package in some command it's treated as a full uninstall then reinstall. The backup files are .pacsave'd and the install reason is set to explicit. I feel like this behavious is good. This also allows you to wipe config files which is what --nokeep was intending to solve.
Other flags just have to have the op they belong to to be used for them to be valid.
For example:
pacman -Rn foo //works
pacman -S -Rn //works
pacman -Sn //doesn't work
pacman -Sn -R //works
We could posibly drop these flags belonging to each operation and just make them generic transaction flags.
Implements FS#9694
Signed-off-by: morganamilo <morganamilo(a)archlinux.org>