Fixed linking and unlinking repositories
authorEd Bartosh <eduard.bartosh@intel.com>
Mon, 9 Dec 2013 09:32:41 +0000 (11:32 +0200)
committerEd Bartosh <eduard.bartosh@intel.com>
Mon, 9 Dec 2013 09:37:52 +0000 (11:37 +0200)
Linking and unlinking was changing only first repository in the project.
The rest repos were left unchanged.

Fixes: #1530

Change-Id: Ia40fc6249f244644375a1b71f2c9a8ddfccc2067
Signed-off-by: Ed Bartosh <eduard.bartosh@intel.com>
common/buildservice.py

index 2eef25a..97fa82d 100644 (file)
@@ -496,10 +496,8 @@ class BuildService(OSC):
                                            {"project": "%s" %src})
         xml_root.append(link_element)
 
-        # Modify repo attribute
-        repo_element = xml_root.find('repository')
-
-        if repo_element is not None:
+        # Set linkedbuild attribute for all repositories
+        for repo_element in xml_root.findall('repository'):
             repo_element.set('linkedbuild', linktype)
 
         self.set_meta(ElementTree.tostring(xml_root), project)
@@ -519,8 +517,8 @@ class BuildService(OSC):
 
         # remov linked project
         xml_root.remove(xml_root.find('link'))
-        # Modify repo attribute
-        repo_element = xml_root.find('repository')
-        repo_element.attrib.pop('linkedbuild')
+        # Remove linkedbuild attribute from all repositories
+        for repo_element in xml_root.findall('repository'):
+            repo_element.attrib.pop('linkedbuild')
 
         self.set_meta(ElementTree.tostring(xml_root), project)