Commit 4457c854 authored by Lorenz Huedepohl's avatar Lorenz Huedepohl
Browse files

Avoid sending unchanged meta-data to server

parent 421ed4fc
...@@ -211,13 +211,17 @@ def mpcdf_enable_repositories(api_url, project, package, verbose=False, filter_r ...@@ -211,13 +211,17 @@ def mpcdf_enable_repositories(api_url, project, package, verbose=False, filter_r
if filter_repos is None: if filter_repos is None:
filter_repos = () filter_repos = ()
root = package_meta(api_url, project, package) pkg_meta = osc.core.show_package_meta(api_url, project, package)
root = ElementTree.fromstringlist(pkg_meta)
build = root.find("./build") build = root.find("./build")
if build is None: if build is None:
build = ElementTree.SubElement(root, "build") build = ElementTree.SubElement(root, "build")
else:
for enable in build.findall("./enable"): pkg_meta = ElementTree.tostring(root, encoding=osc.core.ET_ENCODING)
build.remove(enable)
for enable in build.findall("./enable"):
build.remove(enable)
try: try:
enable_repos = get_attribute_values(api_url, project, package, "MPCDF:enable_repositories") enable_repos = get_attribute_values(api_url, project, package, "MPCDF:enable_repositories")
...@@ -332,9 +336,10 @@ def mpcdf_enable_repositories(api_url, project, package, verbose=False, filter_r ...@@ -332,9 +336,10 @@ def mpcdf_enable_repositories(api_url, project, package, verbose=False, filter_r
if len(build.getchildren()) > 0: if len(build.getchildren()) > 0:
build.getchildren()[-1].tail = "\n " build.getchildren()[-1].tail = "\n "
pkg_meta = ElementTree.tostring(root, encoding=osc.core.ET_ENCODING) new_pkg_meta = ElementTree.tostring(root, encoding=osc.core.ET_ENCODING)
if pkg_meta != new_pkg_meta:
osc.core.edit_meta("pkg", (project, package), data=new_pkg_meta)
osc.core.edit_meta("pkg", (project, package), data=pkg_meta)
return True return True
......
Supports Markdown
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