Commit 2aca69e3 authored by Lorenz Hüdepohl's avatar Lorenz Hüdepohl

Ignore old/obsolete attribute values in packages

parent 1a91e33a
......@@ -924,6 +924,10 @@ def sync_projects(api_url, package=None, from_project="software", to_projects=No
to_projects = [p for p in osc.core.meta_get_project_list(api_url)
if p.startswith("software:") and not (p == "software:dist" or p == "software:images")]
allowed_attribute_values = {}
for attribute in package_attributes + config_attributes:
allowed_attribute_values[attribute] = set(get_allowed_attribute_values(api_url, attribute))
for to_project in to_projects:
print("Syncing {0} with {1}".format(to_project, from_project))
......@@ -955,12 +959,13 @@ def sync_projects(api_url, package=None, from_project="software", to_projects=No
for attribute in package_attributes + config_attributes:
try:
attr = get_attribute(api_url, from_project, orig_package, attribute)
values = list(filter(lambda q: q in allowed_attribute_values[attribute],
get_attribute_values(api_url, from_project, orig_package, attribute)))
except UnsetAttributeException:
if has_attribute(api_url, to_project, orig_package, attribute):
remove_attribute(api_url, to_project, orig_package, attribute)
continue
set_attribute(api_url, to_project, orig_package, attr)
set_attribute_values(api_url, to_project, orig_package, attribute, values)
if add_to_maintainers:
from_maintainers = maintainers(api_url, from_project, orig_package)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment