It takes as inputs a not necessarily complete specifications of flags
assignments, an optional package index as well as platform parameters. If
some flags are not assigned explicitly, this function will try to pick an
assignment that causes this function to succeed. The package index is
optional since on some platforms we cannot determine which packages have
been installed before. When no package index is supplied, every dependency
is assumed to be satisfiable, therefore all not explicitly assigned flags
will get their default values.

This function will fail if it cannot find a flag assignment that leads to
satisfiable dependencies. (It will not try alternative assignments for
explicitly specified flags.) In case of failure it will return a minimum
number of dependencies that could not be satisfied. On success, it will
return the package description and the full flag assignment chosen.

Flatten a generic package description by ignoring all conditions and just
join the field descriptors into on package description. Note, however,
that this may lead to inconsistent field values, since all values are
joined into one field, which may not be possible in the original package
description, due to the use of exclusive choices (if ... else ...).

XXX: One particularly tricky case is defaulting. In the original package
description, e.g., the source directory might either be the default or a
certain, explicitly set path. Since defaults are filled in only after the
package has been resolved and when no explicit value has been set, the
default path will be missing from the package description returned by this
function.