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

wahwah at users.sourceforge.net wahwah at users.sourceforge.net
Thu Nov 4 10:16:44 CET 2010


Revision: 11490
          http://gar.svn.sourceforge.net/gar/?rev=11490&view=rev
Author:   wahwah
Date:     2010-11-04 09:16:43 +0000 (Thu, 04 Nov 2010)

Log Message:
-----------
mGAR v2: It's okay for *-devel packages to depend on anything.

Modified Paths:
--------------
    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/package_checks.py
===================================================================
--- csw/mgar/gar/v2/lib/python/package_checks.py	2010-11-04 09:15:15 UTC (rev 11489)
+++ csw/mgar/gar/v2/lib/python/package_checks.py	2010-11-04 09:16:43 UTC (rev 11490)
@@ -69,6 +69,12 @@
 # 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 = set([u"CSWcommon", u"CSWcswclassutils", u"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 "
@@ -339,7 +345,7 @@
     missing_dep_groups = depchecks.MissingDepsFromReasonGroups(
         req_pkgs_reasons, declared_deps_set)
     pkgs_to_remove = set()
-    for regex_str in checkpkg.DO_NOT_REPORT_MISSING_RE:
+    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):
@@ -359,7 +365,10 @@
         (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)
-    surplus_deps = surplus_deps.difference(checkpkg.DO_NOT_REPORT_SURPLUS)
+    surplus_deps = surplus_deps.difference(DO_NOT_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()

Modified: csw/mgar/gar/v2/lib/python/package_checks_test.py
===================================================================
--- csw/mgar/gar/v2/lib/python/package_checks_test.py	2010-11-04 09:15:15 UTC (rev 11489)
+++ csw/mgar/gar/v2/lib/python/package_checks_test.py	2010-11-04 09:16:43 UTC (rev 11490)
@@ -215,16 +215,9 @@
     self.error_mgr_mock.GetInstalledPackages().AndReturn(installed)
 
 
-class TestSetCheckDependenciesDoNotReportSurplusForDevel(
-    CheckpkgUnitTestHelper, unittest.TestCase):
-  FUNCTION_NAME = 'SetCheckLibraries'
-  def CheckpkgTest(self):
-    self.pkg_data_single = self.pkg_data
-    self.pkg_data = [self.pkg_data_single]
-    self.pkg_data[0]["basic_stats"]["pkgname"] = "CSWfoo-devel"
-    self.pkg_data[0]["depends"].append(["CSWfoo", ""])
-    self.pkg_data[0]["depends"].append(["CSWbar", ""])
-    self.pkg_data[0]["depends"].append(["CSWlibiconv", ""])
+class DatabaseMockingMixin(object):
+
+  def MockDbInteraction(self):
     # Mocking out the interaction with the database
     self.error_mgr_mock.GetPathsAndPkgnamesByBasename('libc.so.1').AndReturn({
       "/usr/lib": (u"SUNWcsl",)})
@@ -247,9 +240,36 @@
         '/opt/csw/bin/sparcv9', '/opt/csw/share/doc']
     for pth in paths_to_check:
       self.error_mgr_mock.GetPkgByPath(pth).AndReturn(common_path_pkgs)
+
+
+class TestSetCheckDependenciesDoNotReportSurplusForDevel(
+    DatabaseMockingMixin, CheckpkgUnitTestHelper, unittest.TestCase):
+  FUNCTION_NAME = 'SetCheckLibraries'
+  def CheckpkgTest(self):
+    self.pkg_data_single = self.pkg_data
+    self.pkg_data = [self.pkg_data_single]
+    self.pkg_data[0]["basic_stats"]["pkgname"] = "CSWfoo-devel"
+    self.pkg_data[0]["depends"].append(["CSWfoo", ""])
+    self.pkg_data[0]["depends"].append(["CSWbar", ""])
+    self.pkg_data[0]["depends"].append(["CSWlibiconv", ""])
+    self.MockDbInteraction()
     # There should be no error about the dependency on CSWfoo or CSWbar.
 
 
+class TestSetCheckDependenciesDoNotReportSurplusForDev(
+    DatabaseMockingMixin, CheckpkgUnitTestHelper, unittest.TestCase):
+  FUNCTION_NAME = 'SetCheckLibraries'
+  def CheckpkgTest(self):
+    self.pkg_data_single = self.pkg_data
+    self.pkg_data = [self.pkg_data_single]
+    self.pkg_data[0]["basic_stats"]["pkgname"] = "CSWfoo-dev"
+    self.pkg_data[0]["depends"].append(["CSWfoo", ""])
+    self.pkg_data[0]["depends"].append(["CSWbar", ""])
+    self.pkg_data[0]["depends"].append(["CSWlibiconv", ""])
+    self.MockDbInteraction()
+    # There should be no error about the dependency on CSWfoo or CSWbar.
+
+
 class TestCheckDependsOnSelf(CheckpkgUnitTestHelper, unittest.TestCase):
   FUNCTION_NAME = 'CheckDependsOnSelf'
   def CheckpkgTest(self):


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