Sorting was considering less package states than what is shown to the
user. For instance Upgradeable was not taken into account and the
package was sorted just as Installed, that resulted in a list that could
contain Installed, then Upgradeable and then Installed again.
BUG: 382892