discovery: Add a NewStringFromApp function.

The produced string will be reproducible: apps with same name and identical
labels will procuce the same string.
The first three labels, if available, will be (in order): version, os, arch and
the other labels will be ordered by name.