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

wahwah at users.sourceforge.net wahwah at users.sourceforge.net
Sun Mar 14 19:44:14 CET 2010


Revision: 9168
          http://gar.svn.sourceforge.net/gar/?rev=9168&view=rev
Author:   wahwah
Date:     2010-03-14 18:44:14 +0000 (Sun, 14 Mar 2010)

Log Message:
-----------
mGAR v2: checkpkg, throwing an error when linking a shared library against Sun X11.

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-03-14 18:43:48 UTC (rev 9167)
+++ csw/mgar/gar/v2/lib/python/package_checks.py	2010-03-14 18:44:14 UTC (rev 9168)
@@ -46,9 +46,9 @@
 ONLY_ALLOWED_IN_PKG = {
     "CSWcommon": ("/opt", )
 }
+DO_NOT_LINK_AGAINST_THESE_SONAMES = set(["libX11.so.4", "libXext.so.0"])
 
 
-
 def CatalognameLowercase(pkg_data, error_mgr, logger):
   catalogname = pkg_data["basic_stats"]["catalogname"]
   if catalogname != catalogname.lower():
@@ -497,3 +497,13 @@
     for disallowed_path in ONLY_ALLOWED_IN_PKG[allowed_pkgname]:
       if disallowed_path in pkg_paths and pkgname != allowed_pkgname:
         error_mgr.ReportError("disallowed-path", disallowed_path)
+
+
+def CheckLinkingAgainstSunX11(pkg_data, error_mgr, logger):
+  for binary_info in pkg_data["binaries_dump_info"]:
+    for soname in binary_info["needed sonames"]:
+      if (".so" in binary_info["soname"]
+          and
+          soname in 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-03-14 18:43:48 UTC (rev 9167)
+++ csw/mgar/gar/v2/lib/python/package_checks_test.py	2010-03-14 18:44:14 UTC (rev 9168)
@@ -198,5 +198,36 @@
     self.error_mgr_mock.ReportError('rev-tag-missing-in-filename')
 
 
+class TestCheckLinkingAgainstSunX11(CheckpkgUnitTestHelper, unittest.TestCase):
+  FUNCTION_NAME = 'CheckLinkingAgainstSunX11'
+  def CheckpkgTest(self):
+    self.pkg_data["binaries_dump_info"][0]["needed sonames"].append("libX11.so.4")
+
+class TestCheckLinkingAgainstSunX11_Bad(CheckpkgUnitTestHelper, unittest.TestCase):
+  FUNCTION_NAME = 'CheckLinkingAgainstSunX11'
+  def CheckpkgTest(self):
+    self.pkg_data["binaries_dump_info"].append({
+         'base_name': 'libImlib2.so.1.4.2',
+         'needed sonames': ['libfreetype.so.6',
+                            'libz.so',
+                            'libX11.so.4',
+                            'libXext.so.0',
+                            'libdl.so.1',
+                            'libm.so.1',
+                            'libc.so.1'],
+         'path': 'opt/csw/lib/libImlib2.so.1.4.2',
+         'runpath': ['/opt/csw/lib/$ISALIST',
+                     '/opt/csw/lib',
+                     '/usr/lib/$ISALIST',
+                     '/usr/lib',
+                     '/lib/$ISALIST',
+                     '/lib'],
+         'soname': 'libImlib2.so.1',
+         'soname_guessed': False,
+    })
+    self.error_mgr_mock.ReportError('linked-against-discouraged-library',
+                                    'libImlib2.so.1.4.2 libX11.so.4')
+
+
 if __name__ == '__main__':
   unittest.main()


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