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

wahwah at users.sourceforge.net wahwah at users.sourceforge.net
Mon Dec 20 12:56:27 CET 2010


Revision: 12032
          http://gar.svn.sourceforge.net/gar/?rev=12032&view=rev
Author:   wahwah
Date:     2010-12-20 11:56:26 +0000 (Mon, 20 Dec 2010)

Log Message:
-----------
checkpkg: Support for NeedFile()

A new style of dependency declaration.  Any check can simply call
NeedFile(filename, reason) which will cause checkpkg to look up owners
of these files and require them as dependencies.

If multiple files are listed with the same reason, any of the owners
will be sufficient.  When declaring reasons, it's important to include
some specific information (such as soname) in the reason.

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/common_constants.py
    csw/mgar/gar/v2/lib/python/dependency_checks.py
    csw/mgar/gar/v2/lib/python/package_checks.py
    csw/mgar/gar/v2/lib/python/package_checks_test.py

Modified: csw/mgar/gar/v2/lib/python/checkpkg_lib.py
===================================================================
--- csw/mgar/gar/v2/lib/python/checkpkg_lib.py	2010-12-20 11:55:48 UTC (rev 12031)
+++ csw/mgar/gar/v2/lib/python/checkpkg_lib.py	2010-12-20 11:56:26 UTC (rev 12032)
@@ -9,6 +9,7 @@
 import package_stats
 import package_checks
 import sqlobject
+import collections
 import itertools
 import progressbar
 import database
@@ -22,6 +23,7 @@
 import sharedlib_utils
 import mute_progressbar
 import cPickle
+import dependency_checks
 from sqlobject import sqlbuilder
 
 
@@ -230,6 +232,9 @@
     return (exit_code, screen_report, tags_report)
 
 
+NeededFile = collections.namedtuple('NeededFile', 'pkgname full_path reason')
+
+
 class CheckInterfaceBase(object):
   """Provides an interface for checking functions.
 
@@ -248,7 +253,17 @@
       self.lines_dict = lines_dict
     else:
       self.lines_dict = {}
+    self.needed_files = []
+    self.__errors = []
 
+  def GetErrors(self):
+    return self.__errors
+
+  errors = property(GetErrors)
+
+  def AddError(self, error):
+    self.__errors.append(error)
+
   def GetPathsAndPkgnamesByBasename(self, basename):
     """Proxies calls to class member."""
     return self.catalog.GetPathsAndPkgnamesByBasename(
@@ -288,7 +303,23 @@
       lines.extend(self._GetPathsForArch(arch))
     return lines
 
+  def _NeedFile(self, pkgname, full_path, reason):
+    """Declares that a package requires one of the files for a reason.
 
+    Special attention needs to be paid to reasons.  If multiple files
+    are needed for the same reason, it's understood that any of them
+    satisfies the dependency.  Reasons passed to this function have to
+    be specific, e.g. "provides libfoo.so.1".  A good example of a bad
+    reason would be "a shared library" - it doesn't provide any
+    specifics.
+    """
+    self.needed_files.append(NeededFile(pkgname, full_path, reason))
+
+  def ReportErrorForPkgname(self, pkgname, tag_name, tag_info=None, msg=None):
+    checkpkg_tag = tag.CheckpkgTag(pkgname, tag_name, tag_info, msg=msg)
+    self.AddError(checkpkg_tag)
+
+
 class IndividualCheckInterface(CheckInterfaceBase):
   """To be passed to the checking functions.
 
@@ -298,30 +329,34 @@
   def __init__(self, pkgname, osrel, arch, catrel, catalog=None):
     super(IndividualCheckInterface, self).__init__(osrel, arch, catrel, catalog)
     self.pkgname = pkgname
-    self.errors = []
 
   def ReportError(self, tag_name, tag_info=None, msg=None):
     logging.debug("self.error_mgr_mock.ReportError(%s, %s, %s)",
                   repr(tag_name), repr(tag_info), repr(msg))
-    checkpkg_tag = tag.CheckpkgTag(self.pkgname, tag_name, tag_info, msg=msg)
-    self.errors.append(checkpkg_tag)
+    self.ReportErrorForPkgname(
+        self.pkgname, tag_name, tag_info, msg=msg)
 
+  def NeedFile(self, full_path, reason):
+    "See base class _NeedFile."
+    self._NeedFile(self.pkgname, full_path, reason)
 
+
 class SetCheckInterface(CheckInterfaceBase):
   """To be passed to set checking functions."""
 
   def __init__(self, osrel, arch, catrel, catalog=None):
     super(SetCheckInterface, self).__init__(osrel, arch, catrel, catalog)
-    self.errors = []
 
+  def NeedFile(self, pkgname, full_path, reason):
+    "See base class _NeedFile."
+    self._NeedFile(pkgname, full_path, reason)
+
   def ReportError(self, pkgname, tag_name, tag_info=None, msg=None):
     logging.debug("self.error_mgr_mock.ReportError(%s, %s, %s, %s)",
                   repr(pkgname),
                   repr(tag_name), repr(tag_info), repr(msg))
-    checkpkg_tag = tag.CheckpkgTag(pkgname, tag_name, tag_info, msg=msg)
-    self.errors.append(checkpkg_tag)
+    self.ReportErrorForPkgname(pkgname, tag_name, tag_info, msg)
 
-
 class CheckpkgMessenger(object):
   """Class responsible for passing messages from checks to the user."""
   def __init__(self):
@@ -373,6 +408,45 @@
           logging.debug("Registering set check %s", repr(member_name))
           self._RegisterSetCheck(member)
 
+  def _ReportDependencies(self, checkpkg_interface, messenger, pkgname,
+      declared_deps):
+    """Creates error tags based on needed files.
+
+    Needed files are extracted from the Interface objects.
+    """
+    # The idea behind reasons is that if two packages are necessary for
+    # the same reason, any of them would be satisfactory.
+    # For example:
+    # (CSWfoo, /opt/csw/bin/foo, "provides foo support"),
+    # (CSWbar, /opt/csw/bin/bar, "provides foo support"),
+    # In such case, either of CSWfoo or CSWbar is satisfactory.
+    #
+    # If the package under examination already depends on any of
+    # packages for a single reason, the dependency is considered
+    # satisfied.
+    reasons_by_pkg = {}
+    pkgs_by_reasons = {}
+    for pkgname, full_path, reason in checkpkg_interface.needed_files:
+      needed_pkgs = checkpkg_interface.GetPkgByPath(full_path)
+      for needed_pkgname in needed_pkgs:
+        reasons_by_pkg.setdefault(needed_pkgname, [])
+        reasons_by_pkg[needed_pkgname].append(reason)
+        pkgs_by_reasons.setdefault(reason, [])
+        pkgs_by_reasons[reason].append(needed_pkgname)
+    # We'll reuse ReportMissingDependencies from dependency_checks, but
+    # we have to adapt the data structure.
+    req_pkgs_reasons = []
+    for reason in pkgs_by_reasons:
+      reason_group = []
+      for needed_pkg in pkgs_by_reasons[reason]:
+        reason_group.append((needed_pkg, reason))
+      req_pkgs_reasons.append(reason_group)
+    dependency_checks.ReportMissingDependencies(checkpkg_interface, 
+                                                pkgname,
+                                                declared_deps,
+                                                req_pkgs_reasons)
+
+
   def GetAllTags(self, stats_obj_list):
     errors = {}
     catalog = Catalog()
@@ -397,6 +471,11 @@
         if check_interface.errors:
           errors[pkgname] = check_interface.errors
         pbar.update(count.next())
+      # Ideally, this class wouldn't know anything about these data
+      # structures, but I don't see a better place for it at the moment.
+      declared_deps = frozenset(x[0] for x in pkg_data["depends"])
+      self._ReportDependencies(
+          check_interface, messenger, pkgname, declared_deps)
     pbar.finish()
     # Set checks
     logging.info("Tasting them all at once...")

Modified: csw/mgar/gar/v2/lib/python/checkpkg_lib_test.py
===================================================================
--- csw/mgar/gar/v2/lib/python/checkpkg_lib_test.py	2010-12-20 11:55:48 UTC (rev 12031)
+++ csw/mgar/gar/v2/lib/python/checkpkg_lib_test.py	2010-12-20 11:56:26 UTC (rev 12032)
@@ -12,16 +12,13 @@
 import inspective_package
 import mox
 import test_base
+import cPickle
 
 from testdata.neon_stats import pkgstats as neon_stats
 
 
-class CheckpkgManager2UnitTest(unittest.TestCase):
+class CheckpkgManager2UnitTest(mox.MoxTestBase):
 
-  def setUp(self):
-    super(CheckpkgManager2UnitTest, self).setUp()
-    self.mox = mox.Mox()
-
   def testSingleTag(self):
     m = checkpkg_lib.CheckpkgManager2(
             "testname", [], "5.9", "sparc", "unstable")
@@ -51,7 +48,44 @@
                 u'CSWfoo: baz-tag\n')
     self.assertEqual(expected, unicode(tags_report))
 
+  def testGetAllTags(self):
+    # Does not run any checks, because they are unregistered.
+    self.mox.StubOutWithMock(checkpkg_lib, 'IndividualCheckInterface',
+        use_mock_anything=True)
+    catalog_mock = self.mox.CreateMock(checkpkg_lib.Catalog)
+    # checkpkg_interface_mock = self.mox.CreateMock(
+    #     checkpkg_lib.IndividualCheckInterface)
+    # Throws:
+    # UnknownMethodCallError: Method called is not a member of the
+    # object: GetPkgByPath
+    checkpkg_interface_mock = self.mox.CreateMockAnything()
+    checkpkg_interface_mock.needed_files = [
+        checkpkg_lib.NeededFile("CSWfoo", "/opt/csw/bin/foo", "Because!"),
+    ]
+    checkpkg_interface_mock.GetPkgByPath("/opt/csw/bin/foo").AndReturn(
+        ["CSWbar", "CSWbaz"])
+    self.mox.StubOutWithMock(checkpkg_lib, 'Catalog',
+        use_mock_anything=True)
+    checkpkg_lib.Catalog().AndReturn(catalog_mock)
+    checkpkg_lib.IndividualCheckInterface(
+        'CSWneon', '5.9', 'sparc', 'unstable', catalog_mock).AndReturn(
+            checkpkg_interface_mock)
+    stat_obj = self.mox.CreateMockAnything()
+    data_obj = self.mox.CreateMockAnything()
+    stat_obj.data_obj = data_obj
+    pkg_stats = copy.deepcopy(neon_stats[0])
+    # Resetting the dependencies so that it doesn't report surplus deps.
+    pkg_stats["depends"] = []
+    data_obj.pickle = cPickle.dumps(pkg_stats)
+    checkpkg_interface_mock.ReportErrorForPkgname(
+        'CSWfoo', 'missing-dependency', 'CSWbar or CSWbaz')
+    self.mox.ReplayAll()
+    m = checkpkg_lib.CheckpkgManager2(
+            "testname", [], "5.9", "sparc", "unstable")
+    # m._AutoregisterChecks()
+    self.assertEquals(({}, [], []), m.GetAllTags([stat_obj]))
 
+
 class CheckpkgManager2DatabaseIntegrationTest(
     test_base.SqlObjectTestMixin, unittest.TestCase):
 
@@ -70,5 +104,47 @@
     self.assertTrue(list(models.CheckpkgErrorTag.select()))
 
 
+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)
+    # Test that when you declare a file is needed, the right error
+    # functions are called.
+    checkpkg_lib.Catalog().AndReturn(catalog_mock)
+    self.mox.ReplayAll()
+    ici = checkpkg_lib.IndividualCheckInterface(
+        'CSWfoo', 'AlienOS5.1', 'amd65', 'calcified')
+    ici.NeedFile("/opt/csw/bin/foo", "Because.")
+    # This might look like encapsulation violation, but I think this is
+    # a reasonable interface to that class.
+    self.assertEqual(1, len(ici.needed_files))
+    needed_file = ici.needed_files[0]
+    self.assertEqual("CSWfoo", needed_file.pkgname)
+    self.assertEqual("/opt/csw/bin/foo", needed_file.full_path)
+    self.assertEqual("Because.", needed_file.reason)
+
+
+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)
+    # Test that when you declare a file is needed, the right error
+    # functions are called.
+    checkpkg_lib.Catalog().AndReturn(catalog_mock)
+    self.mox.ReplayAll()
+    sci = checkpkg_lib.SetCheckInterface(
+        'AlienOS5.1', 'amd65', 'calcified')
+    sci.NeedFile("CSWfoo", "/opt/csw/bin/foo", "Because.")
+    # This might look like encapsulation violation, but I think this is
+    # a reasonable interface to that class.
+    self.assertEqual(1, len(sci.needed_files))
+    needed_file = sci.needed_files[0]
+    self.assertEqual("CSWfoo", needed_file.pkgname)
+    self.assertEqual("/opt/csw/bin/foo", needed_file.full_path)
+    self.assertEqual("Because.", needed_file.reason)
+
+
 if __name__ == '__main__':
   unittest.main()

Modified: csw/mgar/gar/v2/lib/python/common_constants.py
===================================================================
--- csw/mgar/gar/v2/lib/python/common_constants.py	2010-12-20 11:55:48 UTC (rev 12031)
+++ csw/mgar/gar/v2/lib/python/common_constants.py	2010-12-20 11:56:26 UTC (rev 12032)
@@ -57,3 +57,11 @@
     'stable',
     ])
 
+# At some point, it was used to prevent people from linking against
+# libX11.so.4, but due to issues with 3D acceleration.
+DO_NOT_LINK_AGAINST_THESE_SONAMES = set([])
+
+# Regarding surplus libraries reports
+DO_NOT_REPORT_SURPLUS = [r"^CSWcommon$", r"^CSWcswclassutils$", r"^CSWcas-", r"^CSWisaexec$"]
+DO_NOT_REPORT_SURPLUS_FOR = [r"CSW[a-z\-]+dev(el)?"]
+DO_NOT_REPORT_MISSING_RE = [r"\*?SUNW.*"]

Modified: csw/mgar/gar/v2/lib/python/dependency_checks.py
===================================================================
--- csw/mgar/gar/v2/lib/python/dependency_checks.py	2010-12-20 11:55:48 UTC (rev 12031)
+++ csw/mgar/gar/v2/lib/python/dependency_checks.py	2010-12-20 11:56:26 UTC (rev 12032)
@@ -5,6 +5,9 @@
 import re
 import ldd_emul
 import sharedlib_utils
+import common_constants
+import operator
+import logging
 
 # This shared library is present on Solaris 10 on amd64, but it's missing on
 # Solaris 8 on i386.  It's okay if it's missing.
@@ -289,3 +292,80 @@
       % (pkgname, pkgname))
   messenger.SuggestGarLine(
       "# The end of %s definition" % pkgname)
+
+
+def ReportMissingDependencies(error_mgr, pkgname, declared_deps, req_pkgs_reasons):
+  """Processes data structures with dependency data and reports errors.
+
+  Args:
+    error_mgr: SetCheckInterface
+    pkgname: pkgname, a string
+    declared_deps: An iterable with declared dependencies
+    req_pkgs_reasons: Groups of reasons
+
+  data structure:
+    [
+      [
+        ("CSWfoo1", "reason"),
+        ("CSWfoo2", "reason"),
+      ],
+      [
+        ( ... ),
+      ]
+    ]
+  """
+  missing_reasons_by_pkg = {}
+  for reason_group in req_pkgs_reasons:
+    for pkg, reason in reason_group:
+      missing_reasons_by_pkg.setdefault(pkg, [])
+      if len(missing_reasons_by_pkg[pkg]) < 4:
+        missing_reasons_by_pkg[pkg].append(reason)
+      elif len(missing_reasons_by_pkg[pkg]) == 4:
+        missing_reasons_by_pkg[pkg].append("...and more.")
+  missing_dep_groups = MissingDepsFromReasonGroups(
+      req_pkgs_reasons, declared_deps)
+  pkgs_to_remove = set()
+  for regex_str in common_constants.DO_NOT_REPORT_MISSING_RE:
+    regex = re.compile(regex_str)
+    for dep_pkgname in reduce(operator.add, missing_dep_groups, []):
+      if re.match(regex, dep_pkgname):
+        pkgs_to_remove.add(dep_pkgname)
+  if pkgname in reduce(operator.add, missing_dep_groups, []):
+    pkgs_to_remove.add(pkgname)
+  logging.debug("Removing %s from the list of missing pkgs.", pkgs_to_remove)
+  new_missing_dep_groups = set()
+  for missing_deps in missing_dep_groups:
+    new_missing_deps = set()
+    for dep in missing_deps:
+      if dep not in pkgs_to_remove:
+        new_missing_deps.add(dep)
+    if new_missing_deps:
+      new_missing_dep_groups.add(tuple(new_missing_deps))
+  potential_req_pkgs = set(
+      (x for x, y in reduce(operator.add, req_pkgs_reasons, [])))
+  missing_dep_groups = new_missing_dep_groups
+  surplus_deps = declared_deps.difference(potential_req_pkgs)
+  no_report_surplus = set()
+  for sp_regex in common_constants.DO_NOT_REPORT_SURPLUS:
+    for maybe_surplus in surplus_deps:
+      if re.match(sp_regex, maybe_surplus):
+        no_report_surplus.add(maybe_surplus)
+  surplus_deps = surplus_deps.difference(no_report_surplus)
+  for regex_str in common_constants.DO_NOT_REPORT_SURPLUS_FOR:
+    if surplus_deps and re.match(regex_str, pkgname):
+      surplus_deps = set()
+  # Using an index to avoid duplicated reasons.
+  missing_deps_reasons_by_pkg = []
+  missing_deps_idx = set()
+  for missing_deps in missing_dep_groups:
+    error_mgr.ReportErrorForPkgname(
+        pkgname, "missing-dependency", " or ".join(missing_deps))
+    for missing_dep in missing_deps:
+      item = (missing_dep, tuple(missing_reasons_by_pkg[missing_dep]))
+      if item not in missing_deps_idx:
+        missing_deps_reasons_by_pkg.append(item)
+        missing_deps_idx.add(item)
+  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/package_checks.py
===================================================================
--- csw/mgar/gar/v2/lib/python/package_checks.py	2010-12-20 11:55:48 UTC (rev 12031)
+++ csw/mgar/gar/v2/lib/python/package_checks.py	2010-12-20 11:56:26 UTC (rev 12032)
@@ -78,16 +78,6 @@
     re.compile(r".*dev(el)?$"),
 ]
 
-# At some point, it was used to prevent people from linking against
-# libX11.so.4, but due to issues with 3D acceleration.
-DO_NOT_LINK_AGAINST_THESE_SONAMES = set([])
-
-# Regarding surplus libraries reports
-DO_NOT_REPORT_SURPLUS = [r"^CSWcommon$", r"^CSWcswclassutils$", r"^CSWcas-", r"^CSWisaexec$"]
-DO_NOT_REPORT_SURPLUS_FOR = [r"CSW[a-z\-]+dev(el)?"]
-DO_NOT_REPORT_MISSING = set([])
-DO_NOT_REPORT_MISSING_RE = [r"\*?SUNW.*"]
-
 DISCOURAGED_FILE_PATTERNS = (
     (r"\.py[co]$", ("Python compiled files are supposed to be compiled using"
                     "the cswpycompile class action script. For more "
@@ -347,70 +337,18 @@
   # Resolving sonames for each binary
   for pkg_data in pkgs_data:
     pkgname = pkg_data["basic_stats"]["pkgname"]
+    declared_deps = frozenset(x[0] for x in pkg_data["depends"])
     check_args = (pkg_data, error_mgr, logger, messenger,
                   path_and_pkg_by_basename, pkg_by_path)
     req_pkgs_reasons = depchecks.Libraries(*check_args)
     req_pkgs_reasons.extend(depchecks.ByFilename(*check_args))
     # This test needs more work, or potentially, architectural changes.
-    # by_directory_reasons = depchecks.ByDirectory(*check_args)
+    # by_directory_reasons = ByDirectory(*check_args)
     # req_pkgs_reasons.extend(by_directory_reasons)
-    missing_reasons_by_pkg = {}
-    for reason_group in req_pkgs_reasons:
-      for pkg, reason in reason_group:
-        if pkg not in missing_reasons_by_pkg:
-          missing_reasons_by_pkg[pkg] = []
-        if len(missing_reasons_by_pkg[pkg]) < 4:
-          missing_reasons_by_pkg[pkg].append(reason)
-        elif len(missing_reasons_by_pkg[pkg]) == 4:
-          missing_reasons_by_pkg[pkg].append("...and more.")
-    declared_deps = pkg_data["depends"]
-    declared_deps_set = set([x[0] for x in declared_deps])
-    missing_dep_groups = depchecks.MissingDepsFromReasonGroups(
-        req_pkgs_reasons, declared_deps_set)
-    pkgs_to_remove = set()
-    for regex_str in DO_NOT_REPORT_MISSING_RE:
-      regex = re.compile(regex_str)
-      for dep_pkgname in reduce(operator.add, missing_dep_groups, []):
-        if re.match(regex, dep_pkgname):
-          pkgs_to_remove.add(dep_pkgname)
-    if pkgname in reduce(operator.add, missing_dep_groups, []):
-      pkgs_to_remove.add(pkgname)
-    logger.debug("Removing %s from the list of missing pkgs.", pkgs_to_remove)
-    new_missing_dep_groups = set()
-    for missing_deps in missing_dep_groups:
-      new_missing_deps = set()
-      for dep in missing_deps:
-        if dep not in pkgs_to_remove:
-          new_missing_deps.add(dep)
-      if new_missing_deps:
-        new_missing_dep_groups.add(tuple(new_missing_deps))
-    potential_req_pkgs = set(
-        (x for x, y in reduce(operator.add, req_pkgs_reasons, [])))
-    missing_dep_groups = new_missing_dep_groups
-    surplus_deps = declared_deps_set.difference(potential_req_pkgs)
-    no_report_surplus = set()
-    for sp_regex in DO_NOT_REPORT_SURPLUS:
-      for maybe_surplus in surplus_deps:
-        if re.match(sp_regex, maybe_surplus):
-          no_report_surplus.add(maybe_surplus)
-    surplus_deps = surplus_deps.difference(no_report_surplus)
-    for regex_str in DO_NOT_REPORT_SURPLUS_FOR:
-      if surplus_deps and re.match(regex_str, pkgname):
-        surplus_deps = set()
-    # Using an index to avoid duplicated reasons.
-    missing_deps_reasons_by_pkg = []
-    missing_deps_idx = set()
-    for missing_deps in missing_dep_groups:
-      error_mgr.ReportError(pkgname,
-                            "missing-dependency",
-                            " or ".join(missing_deps))
-      for missing_dep in missing_deps:
-        item = (missing_dep, tuple(missing_reasons_by_pkg[missing_dep]))
-        if item not in missing_deps_idx:
-          missing_deps_reasons_by_pkg.append(item)
-          missing_deps_idx.add(item)
-    for surplus_dep in surplus_deps:
-      error_mgr.ReportError(pkgname, "surplus-dependency", surplus_dep)
+    (missing_deps_reasons_by_pkg,
+     surplus_deps,
+     missing_dep_groups) = depchecks.ReportMissingDependencies(
+       error_mgr, pkgname, declared_deps, req_pkgs_reasons)
     namespace = {
         "pkgname": pkgname,
         "missing_deps": missing_deps_reasons_by_pkg,
@@ -777,7 +715,7 @@
     for soname in binary_info["needed sonames"]:
       if (binary_info["path"] in shared_libs
           and
-          soname in DO_NOT_LINK_AGAINST_THESE_SONAMES):
+          soname in common_constants.DO_NOT_LINK_AGAINST_THESE_SONAMES):
         error_mgr.ReportError("linked-against-discouraged-library",
                               "%s %s" % (binary_info["base_name"], soname))
 

Modified: csw/mgar/gar/v2/lib/python/package_checks_test.py
===================================================================
--- csw/mgar/gar/v2/lib/python/package_checks_test.py	2010-12-20 11:55:48 UTC (rev 12031)
+++ csw/mgar/gar/v2/lib/python/package_checks_test.py	2010-12-20 11:56:26 UTC (rev 12032)
@@ -405,7 +405,7 @@
         '/opt/csw/share/doc').AndReturn([u"CSWcommon"])
     self.error_mgr_mock.GetPkgByPath(
         '/opt/csw/lib/sparcv9').AndReturn([u"CSWcommon"])
-    self.error_mgr_mock.ReportError(
+    self.error_mgr_mock.ReportErrorForPkgname(
         'CSWdjvulibrert', 'missing-dependency', u'CSWiconv')
 
 
@@ -707,7 +707,7 @@
         'CSWbar',
         'soname-not-found',
         'libfoo.so.1 is needed by opt/csw/bin/bar')
-    self.error_mgr_mock.ReportError('CSWbar', 'surplus-dependency', 'CSWlibfoo')
+    self.error_mgr_mock.ReportErrorForPkgname('CSWbar', 'surplus-dependency', 'CSWlibfoo')
     self.pkg_data = [self.CSWbar_DATA, self.CSWlibfoo_DATA]
 
 
@@ -1041,7 +1041,7 @@
     self.error_mgr_mock.GetPathsAndPkgnamesByBasename('libComUnidraw.so').AndReturn({})
     self.error_mgr_mock.GetPkgByPath('/opt/csw').AndReturn([u"CSWcommon"])
     self.error_mgr_mock.GetPkgByPath('/opt/csw/lib').AndReturn([u"CSWcommon"])
-    self.error_mgr_mock.ReportError('CSWivtools', 'missing-dependency', u'CSWcommon')
+    self.error_mgr_mock.ReportErrorForPkgname('CSWivtools', 'missing-dependency', u'CSWcommon')
 
 
 class TestSetCheckDirectoryDependenciesTree(CheckpkgUnitTestHelper,
@@ -1337,14 +1337,14 @@
       u'CSWgnomedesktop', u'CSWnautilus', u'CSWlibofx', u'CSWgamin',
       u'CSWpkgutil', u'CSWgcc3core', u'CSWgnomemime2', u'CSWglib'])
 
-    self.error_mgr_mock.ReportError('CSWjavasvn', 'missing-dependency', u'CSWneon')
-    self.error_mgr_mock.ReportError('CSWjavasvn', 'missing-dependency', u'CSWapache2rt')
-    self.error_mgr_mock.ReportError('CSWjavasvn', 'missing-dependency', u'CSWoldaprt')
-    self.error_mgr_mock.ReportError('CSWjavasvn', 'missing-dependency', u'CSWggettextrt')
-    self.error_mgr_mock.ReportError('CSWjavasvn', 'missing-dependency', u'CSWapache2rt or CSWapr')
-    self.error_mgr_mock.ReportError('CSWjavasvn', 'missing-dependency', u'CSWexpat')
-    self.error_mgr_mock.ReportError('CSWjavasvn', 'missing-dependency', u'CSWsvn')
-    self.error_mgr_mock.ReportError('CSWjavasvn', 'missing-dependency', u'CSWiconv')
+    self.error_mgr_mock.ReportErrorForPkgname('CSWjavasvn', 'missing-dependency', u'CSWneon')
+    self.error_mgr_mock.ReportErrorForPkgname('CSWjavasvn', 'missing-dependency', u'CSWapache2rt')
+    self.error_mgr_mock.ReportErrorForPkgname('CSWjavasvn', 'missing-dependency', u'CSWoldaprt')
+    self.error_mgr_mock.ReportErrorForPkgname('CSWjavasvn', 'missing-dependency', u'CSWggettextrt')
+    self.error_mgr_mock.ReportErrorForPkgname('CSWjavasvn', 'missing-dependency', u'CSWapache2rt or CSWapr')
+    self.error_mgr_mock.ReportErrorForPkgname('CSWjavasvn', 'missing-dependency', u'CSWexpat')
+    self.error_mgr_mock.ReportErrorForPkgname('CSWjavasvn', 'missing-dependency', u'CSWsvn')
+    self.error_mgr_mock.ReportErrorForPkgname('CSWjavasvn', 'missing-dependency', u'CSWiconv')
     self.messenger.Message(u'Dependency issues of CSWjavasvn:')
     self.messenger.Message(u'CSWapache2rt, reasons:')
     self.messenger.Message(u' - provides /opt/csw/apache2/lib/libaprutil-1.so.0 needed by opt/csw/lib/svn/libsvnjavahl-1.so.0.0.0')


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