[csw-devel] SF.net SVN: gar:[10737] csw/mgar/gar/v2-checkpkg-override-relocation/lib/ python/opencsw.py

wahwah at users.sourceforge.net wahwah at users.sourceforge.net
Sat Aug 14 21:50:59 CEST 2010


Revision: 10737
          http://gar.svn.sourceforge.net/gar/?rev=10737&view=rev
Author:   wahwah
Date:     2010-08-14 19:50:59 +0000 (Sat, 14 Aug 2010)

Log Message:
-----------
mGAR v2-checkpkg-override-relocation: checking the new overrides location.

Modified Paths:
--------------
    csw/mgar/gar/v2-checkpkg-override-relocation/lib/python/opencsw.py

Modified: csw/mgar/gar/v2-checkpkg-override-relocation/lib/python/opencsw.py
===================================================================
--- csw/mgar/gar/v2-checkpkg-override-relocation/lib/python/opencsw.py	2010-08-14 19:09:22 UTC (rev 10736)
+++ csw/mgar/gar/v2-checkpkg-override-relocation/lib/python/opencsw.py	2010-08-14 19:50:59 UTC (rev 10737)
@@ -917,17 +917,18 @@
         self.file_paths.extend([f.replace(remove_prefix, "") for f in full_paths])
     return self.file_paths
 
-  def _GetOverridesStream(self):
-    catalogname = self.GetCatalogname()
-    file_path = os.path.join(self.directory,
-                             "root",
-                             "opt/csw/share/checkpkg/overrides",
-                             catalogname)
+  def _GetOverridesStream(self, file_path):
     # This might potentially cause a file descriptor leak, but I'm not going to
     # worry about that at this stage.
+    # NB, the whole catalog run doesn't seem to be suffering. (~2500 packages)
+    #
+    # There is a race condition here, but it's executing sequentially, I don't
+    # expect any concurrency problems.
     if os.path.isfile(file_path):
+      logging.debug("Opening %s override file." % repr(file_path))
       return open(file_path, "r")
     else:
+      logging.debug("Override file %s not found." % repr(file_path))
       return None
 
   def _ParseOverridesStream(self, stream):
@@ -940,11 +941,22 @@
 
   def GetOverrides(self):
     """Returns overrides, a list of overrides.Override instances."""
-    stream = self._GetOverridesStream()
-    if stream:
-      return self._ParseOverridesStream(stream)
-    else:
-      return list()
+    overrides = []
+    catalogname = self.GetCatalogname()
+    override_paths = (
+        [self.directory,
+         "root",
+         "opt/csw/share/checkpkg/overrides", catalogname],
+        [self.directory,
+         "install",
+         "checkpkg_override"],
+    )
+    for override_path in override_paths:
+      file_path = os.path.join(*override_path)
+      stream = self._GetOverridesStream(file_path)
+      if stream:
+        overrides.extend(self._ParseOverridesStream(stream))
+    return overrides
 
   def GetFileContent(self, pkg_file_path):
     if pkg_file_path.startswith("/"):


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