Move common code in normalize_manifest to a method.