'If the spec already has variants filled in, return.  Otherwise, add
the user preferences from packages.yaml or the default variants from
the package specification.'

def concretize_variants(self, spec):

    changed = False
    preferred_variants = PackagePrefs.preferred_variants(spec.name)
    pkg_cls = spec.package_class
    for (name, variant) in pkg_cls.variants.items():
        if (name not in spec.variants):
            changed = True
            if (name in preferred_variants):
                spec.variants[name] = preferred_variants.get(name)
            else:
                spec.variants[name] = variant.make_default()
    return changed
