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

wahwah at users.sourceforge.net wahwah at users.sourceforge.net
Wed Dec 22 13:56:07 CET 2010


Revision: 12069
          http://gar.svn.sourceforge.net/gar/?rev=12069&view=rev
Author:   wahwah
Date:     2010-12-22 12:56:07 +0000 (Wed, 22 Dec 2010)

Log Message:
-----------
checkpkg: Random cleanup

Whitespace, comments, logging.

Modified Paths:
--------------
    csw/mgar/gar/v2/lib/python/checkpkg_lib.py
    csw/mgar/gar/v2/lib/python/checkpkg_lib_test.py
    csw/mgar/gar/v2/lib/python/dependency_checks.py
    csw/mgar/gar/v2/lib/python/ldd_emul.py
    csw/mgar/gar/v2/lib/python/package_checks.py

Modified: csw/mgar/gar/v2/lib/python/checkpkg_lib.py
===================================================================
--- csw/mgar/gar/v2/lib/python/checkpkg_lib.py	2010-12-22 12:55:38 UTC (rev 12068)
+++ csw/mgar/gar/v2/lib/python/checkpkg_lib.py	2010-12-22 12:56:07 UTC (rev 12069)
@@ -298,8 +298,14 @@
 
   def GetPkgByPath(self, file_path):
     """Proxies calls to self.system_pkgmap."""
-    return self.catalog.GetPkgByPath(
+    response = self.catalog.GetPkgByPath(
         file_path, self.osrel, self.arch, self.catrel)
+    logging_response = response
+    if u"CSWcommon" in logging_response:
+      logging_response = frozenset([u"CSWcommon"])
+    logging.debug("GetPkgByPath(%s).AndReturn(%s)"
+                  % (file_path, logging_response))
+    return response
 
   def GetInstalledPackages(self):
     return self.catalog.GetInstalledPackages(
@@ -395,6 +401,7 @@
                   repr(tag_name), repr(tag_info), repr(msg))
     self.ReportErrorForPkgname(pkgname, tag_name, tag_info, msg)
 
+
 class CheckpkgMessenger(object):
   """Class responsible for passing messages from checks to the user."""
   def __init__(self):
@@ -447,7 +454,7 @@
           self._RegisterSetCheck(member)
 
   def _ReportDependencies(self, checkpkg_interface, needed_files, needed_pkgs,
-      messenger, pkgname, declared_deps):
+      messenger, declared_deps_by_pkgname):
     """Creates error tags based on needed files.
 
     Needed files are extracted from the Interface objects.
@@ -580,6 +587,8 @@
     self._ReportDependencies(check_interface,
         needed_files, needed_pkgs, messenger, declared_deps_by_pkgname)
     errors = self.SetErrorsToDict(check_interface.errors, errors)
+    # open("/home/maciej/debug.py", "w").write(pprint.pformat(
+    #     (needed_files, needed_pkgs, pkgname, declared_deps_by_pkgname)))
     messages = messenger.messages + messenger.one_time_messages.values()
     return errors, messages, messenger.gar_lines
 
@@ -691,8 +700,6 @@
     # Memoization won't buy us much.  Perhaps we can fetch all the files
     # belonging to the same package, so that we quickly prepopulate the cache.
 
-    logging.debug("GetPkgByPath(%s, %s, %s, %s)"
-                  % (full_file_path, osrel, arch, catrel))
     key = (full_file_path, osrel, arch, catrel)
     if key not in self.pkgs_by_path_cache:
       file_path, basename = os.path.split(full_file_path)

Modified: csw/mgar/gar/v2/lib/python/checkpkg_lib_test.py
===================================================================
--- csw/mgar/gar/v2/lib/python/checkpkg_lib_test.py	2010-12-22 12:55:38 UTC (rev 12068)
+++ csw/mgar/gar/v2/lib/python/checkpkg_lib_test.py	2010-12-22 12:56:07 UTC (rev 12069)
@@ -146,7 +146,7 @@
 
 
 class IndividualCheckInterfaceUnitTest(mox.MoxTestBase):
-  
+
   def testNeededFile(self):
     catalog_mock = self.mox.CreateMock(checkpkg_lib.Catalog)
     self.mox.StubOutWithMock(checkpkg_lib, 'Catalog', use_mock_anything=True)
@@ -185,7 +185,7 @@
 
 
 class SetCheckInterfaceUnitTest(mox.MoxTestBase):
-  
+
   def testNeededFile(self):
     catalog_mock = self.mox.CreateMock(checkpkg_lib.Catalog)
     self.mox.StubOutWithMock(checkpkg_lib, 'Catalog', use_mock_anything=True)

Modified: csw/mgar/gar/v2/lib/python/dependency_checks.py
===================================================================
--- csw/mgar/gar/v2/lib/python/dependency_checks.py	2010-12-22 12:55:38 UTC (rev 12068)
+++ csw/mgar/gar/v2/lib/python/dependency_checks.py	2010-12-22 12:56:07 UTC (rev 12069)
@@ -385,4 +385,3 @@
   for surplus_dep in surplus_deps:
     error_mgr.ReportErrorForPkgname(pkgname, "surplus-dependency", surplus_dep)
   return missing_deps_reasons_by_pkg, surplus_deps, missing_dep_groups
-

Modified: csw/mgar/gar/v2/lib/python/ldd_emul.py
===================================================================
--- csw/mgar/gar/v2/lib/python/ldd_emul.py	2010-12-22 12:55:38 UTC (rev 12068)
+++ csw/mgar/gar/v2/lib/python/ldd_emul.py	2010-12-22 12:56:07 UTC (rev 12069)
@@ -113,9 +113,10 @@
       # in the path_list.
       for expanded_p in expanded_p_list:
         original_paths_by_expanded_paths[expanded_p] = p
-    logging.debug(
-        "%s: looking for %s in %s",
-        soname, runpath_list, original_paths_by_expanded_paths.keys())
+    # This debugging line is sometimes useful, but generates a lot of output.
+    # logging.debug(
+    #     "%s: looking for %s in %s",
+    #     soname, runpath_list, original_paths_by_expanded_paths.keys())
     for runpath_expanded in runpath_list:
       if runpath_expanded in original_paths_by_expanded_paths:
         # logging.debug("Found %s",

Modified: csw/mgar/gar/v2/lib/python/package_checks.py
===================================================================
--- csw/mgar/gar/v2/lib/python/package_checks.py	2010-12-22 12:55:38 UTC (rev 12068)
+++ csw/mgar/gar/v2/lib/python/package_checks.py	2010-12-22 12:56:07 UTC (rev 12069)
@@ -344,8 +344,6 @@
     # This test needs more work, or potentially, architectural changes.
     # by_directory_reasons = ByDirectory(*check_args)
     # req_pkgs_reasons.extend(by_directory_reasons)
-    # logging.debug("SetCheckLibraries(): required package reasons: %s",
-    #               req_pkgs_reasons)
 
 
 def SetCheckDependencies(pkgs_data, error_mgr, logger, messenger):


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