[csw-devel] SF.net SVN: gar:[13881] csw/mgar/gar/v2/lib/python/checkpkg_lib.py

wahwah at users.sourceforge.net wahwah at users.sourceforge.net
Sun Mar 20 15:53:48 CET 2011


Revision: 13881
          http://gar.svn.sourceforge.net/gar/?rev=13881&view=rev
Author:   wahwah
Date:     2011-03-20 14:53:48 +0000 (Sun, 20 Mar 2011)

Log Message:
-----------
checkpkg: Support for the overridden field

The error tag table in the database has the 'overridden' field. This
patch add code which sets this field to the right value.  The use of
that field will come in later changes.

Modified Paths:
--------------
    csw/mgar/gar/v2/lib/python/checkpkg_lib.py

Modified: csw/mgar/gar/v2/lib/python/checkpkg_lib.py
===================================================================
--- csw/mgar/gar/v2/lib/python/checkpkg_lib.py	2011-03-20 14:53:29 UTC (rev 13880)
+++ csw/mgar/gar/v2/lib/python/checkpkg_lib.py	2011-03-20 14:53:48 UTC (rev 13881)
@@ -225,8 +225,10 @@
       db_stat_objs_by_pkgname[pkg.pkginst.pkgname] = pkg
     logging.debug("Deleting old errors from the database.")
     sqo_os_rel, sqo_arch, sqo_catrel = self.GetSqlobjectTriad()
+    overrides_by_pkgname = {}
     for pkgname, db_obj in db_stat_objs_by_pkgname.iteritems():
       db_obj.RemoveCheckpkgResults(sqo_os_rel, sqo_arch, sqo_catrel)
+      overrides_by_pkgname[pkgname] = list(db_obj.GetOverridesResult())
     errors, messages, gar_lines = self.GetAllTags(self.sqo_pkgs_list)
     pbar = self.GetProgressBar()
     pbar.maxval = len(errors) + 1
@@ -239,14 +241,24 @@
         if e.pkgname not in db_stat_objs_by_pkgname:
           logging.warning("Not saving an error for %s.", e.pkgname)
           continue
-        db_error = m.CheckpkgErrorTag(srv4_file=db_stat_objs_by_pkgname[e.pkgname],
-                                      pkgname=e.pkgname,
-                                      tag_name=e.tag_name,
-                                      tag_info=e.tag_info,
-                                      msg=e.msg,
-                                      os_rel=sqo_os_rel,
-                                      catrel=sqo_catrel,
-                                      arch=sqo_arch)
+        error_tag_in_db = m.CheckpkgErrorTag(
+            srv4_file=db_stat_objs_by_pkgname[e.pkgname],
+            pkgname=e.pkgname,
+            tag_name=e.tag_name,
+            tag_info=e.tag_info,
+            msg=e.msg,
+            os_rel=sqo_os_rel,
+            catrel=sqo_catrel,
+            arch=sqo_arch)
+        # Check whether any of the overrides apply to this tag, and
+        # store the result.
+        overridden = False
+        for override in overrides_by_pkgname[pkgname]:
+          if override.DoesApply(error_tag_in_db):
+            logging.debug("%s overrides %s", override, error_tag_in_db)
+            overridden = True
+            break
+        error_tag_in_db.overridden = overridden
       pbar.update(count.next())
     pbar.finish()
     flat_error_list = reduce(operator.add, errors.values(), [])


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.


More information about the devel mailing list