group: disable publishing when aggregating packages
authorEd Bartosh <eduard.bartosh@intel.com>
Wed, 21 May 2014 09:17:58 +0000 (12:17 +0300)
committerEd Bartosh <eduard.bartosh@intel.com>
Wed, 21 May 2014 14:30:09 +0000 (17:30 +0300)
If publishing is enabled OBS publishes repository after each
aggregate operation, which triggers a lot of not needed image
creation and testing events. It can cause wrong test results and
accepting of bad submissions.

Change-Id: Idf6fd28101feb7857fca4b7830acd797e2b4d487
Signed-off-by: Ed Bartosh <eduard.bartosh@intel.com>
RELEASE_NOTES
debian/changelog
packaging/repa.changes
repa/group.py
repa/obs.py

index 6e98e42b1800e13cf84df7c70ed7522a6627d25e..755faa816b00bdc03238fc3f385114f78a574e49 100644 (file)
@@ -24,6 +24,7 @@ Release notes for repa 0.2
     * repa list: Fixed formatting of output for repa list
     * repa group: Fix check for common packages
     * repa list: Fix build status reporting
+    * repa group: disable publishing when aggregating packages
 
 
 Release notes for repa 0.1.1
index 506fa3b7f282ca57ae66254a99ef8f6e0adb37b7..ae88b256d4fac4f22c57fe3cca40a665d64a43c3 100644 (file)
@@ -27,8 +27,9 @@ repa (0.2) unstable; urgency=low
   * common.py: Introduced get_prerelease_projects API
   * Implement repa diff
   * Correct man page for accept and reject subcommands
+  * group: disable publishing when aggregating packages
 
- -- Ed Bartosh <eduard.bartosh@intel.com>  Sat, 29 Mar 2014 21:19:01 +0200
+ -- Ed Bartosh <eduard.bartosh@intel.com>  Wed, 21 May 2014 17:05:10 +0200
 
 repa (0.1.1) unstable; urgency=low
 
index b018e3637701288e9329f3579cf216cea1eb1bd1..c1d32b8dad638688dd2765847cc1e6935c0d5edd 100644 (file)
@@ -1,4 +1,4 @@
-* Tue May 20 2014 Ed Bartosh <eduard.bartosh@intel.com> 0.2
+* Tue May 21 2014 Ed Bartosh <eduard.bartosh@intel.com> 0.2
 - Implement --processes options for repa list (Fixes: #1762)
 - obs/get_projects: retry OBS operations
 - Reduce amount of information in repa list output
@@ -28,6 +28,7 @@
 - Implement repa diff
 - Correct man page for accept and reject subcommands
 - Convert repa.changes into rpm format
+- group: disable publishing when aggregating packages
 
 * Tue Mar 18 2014 Ed Bartosh <eduard.bartosh@intel.com> 0.1.1
 - Fixed crash when rejecting broken package
index 188d82e62a5181d04d94342f17326f5786b7b10f..363e86f80f80b402ce7dce40066447afbfc07342 100755 (executable)
@@ -112,6 +112,7 @@ def create_group_project(obs, submissions, meta, comment):
 def aggregate(obs, bresults, gproject):
     """Aggregate packages into group project."""
     aggregated = set()
+    obs.set_global_flag('publish', 'disable', gproject)
     for subm, prj, results in bresults:
         for res in results.itervalues():
             for pkg, state in res['packages']:
@@ -120,6 +121,8 @@ def aggregate(obs, bresults, gproject):
                     obs.aggregate_package(prj, pkg, gproject, pkg)
                     aggregated.add(pkg)
 
+    obs.set_global_flag('publish', 'enable', gproject)
+
     return aggregated
 
 
index 61b9e203962c08e565b133572a7580353a9bb612..3cf766386192e0e443770681f185d5a0d76a71b3 100644 (file)
@@ -212,3 +212,28 @@ class OBS(OSC):
         for sr in root.findall('request'):
             yield sr.get('id'), sr.find('state').get('name'), \
                   sr.find('description').text
+
+    def set_global_flag(self, flag, value, prj, pkg=None):
+        """
+        Set global flag in meta
+        Supported flag: publish,build,useforbuild,debuginfo
+        Supported values: enable,disable
+        """
+        supported_flags = ('publish', 'build', 'useforbuild', 'debuginfo')
+        if flag not in supported_flags:
+            raise RepaException("flag %s is not supported. "
+                                "supported flags: %s" % \
+                                    (flag, ', '.join(supported_flags)))
+        supported_vals = ('enable', 'disable')
+        if value not in supported_vals:
+            raise RepaException("value %s is not supported. "
+                                "supported values: %s" % \
+                                (value, ', '.join(supported_vals)))
+        meta = self.get_meta(prj, pkg)
+        root = ET.fromstring(meta)
+        elem = root.find(flag)
+        if elem is None:
+            elem = ET.SubElement(root, flag)
+        elem.clear()
+        ET.SubElement(elem, value)
+        self.set_meta(ET.tostring(root), prj, pkg)