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

wahwah at users.sourceforge.net wahwah at users.sourceforge.net
Sun Jan 23 09:02:02 CET 2011


Revision: 13062
          http://gar.svn.sourceforge.net/gar/?rev=13062&view=rev
Author:   wahwah
Date:     2011-01-23 08:02:02 +0000 (Sun, 23 Jan 2011)

Log Message:
-----------
pkgdb: Removing package from catalog idempotently

Removing already removed package shouldn't throw an error.

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-01-23 08:01:33 UTC (rev 13061)
+++ csw/mgar/gar/v2/lib/python/checkpkg_lib.py	2011-01-23 08:02:02 UTC (rev 13062)
@@ -1008,15 +1008,18 @@
   def RemoveSrv4(self, sqo_srv4, osrel, arch, catrel):
     sqo_osrel, sqo_arch, sqo_catrel = self.GetSqlobjectTriad(
         osrel, arch, catrel)
-    sqo_srv4_in_cat = m.Srv4FileInCatalog.select(
-        sqlobject.AND(
-          m.Srv4FileInCatalog.q.arch==sqo_arch,
-          m.Srv4FileInCatalog.q.osrel==sqo_osrel,
-          m.Srv4FileInCatalog.q.catrel==sqo_catrel,
-          m.Srv4FileInCatalog.q.srv4file==sqo_srv4)).getOne()
-    # Files belonging to this package should not be removed from the catalog
-    # as the package might be still present in another catalog.
-    sqo_srv4_in_cat.destroySelf()
+    try:
+      sqo_srv4_in_cat = m.Srv4FileInCatalog.select(
+          sqlobject.AND(
+            m.Srv4FileInCatalog.q.arch==sqo_arch,
+            m.Srv4FileInCatalog.q.osrel==sqo_osrel,
+            m.Srv4FileInCatalog.q.catrel==sqo_catrel,
+            m.Srv4FileInCatalog.q.srv4file==sqo_srv4)).getOne()
+      # Files belonging to this package should not be removed from the catalog
+      # as the package might be still present in another catalog.
+      sqo_srv4_in_cat.destroySelf()
+    except sqlobject.dberrors.SQLObjectNotFound, e:
+      logging.warning(e)
 
 
 class Catalog(CatalogMixin):


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