+ if (pkgs->count < 2)
+ return;
+ /* sort and unify */
+ solv_sort(pkgs->elements, pkgs->count, sizeof(Id), selection_solvables_sortcmp, NULL);
+ lastid = pkgs->elements[0];
+ for (i = j = 1; i < pkgs->count; i++)
+ if (pkgs->elements[i] != lastid)
+ pkgs->elements[j++] = lastid = pkgs->elements[i];
+ queue_truncate(pkgs, j);
+}
+
+static void
+selection_flatten(Pool *pool, Queue *selection)
+{
+ Queue q;
+ int i;
+ if (selection->count <= 1)
+ return;
+ for (i = 0; i < selection->count; i += 2)
+ if ((selection->elements[i] & SOLVER_SELECTMASK) == SOLVER_SOLVABLE_ALL)
+ {
+ selection->elements[0] = selection->elements[i];
+ selection->elements[1] = selection->elements[i + 1];
+ queue_truncate(selection, 2);
+ return;
+ }
+ queue_init(&q);
+ selection_solvables(pool, selection, &q);