[csw-devel] SF.net SVN: gar:[11215] csw/mgar/gar/v2/lib/python
wahwah at users.sourceforge.net
wahwah at users.sourceforge.net
Sun Oct 10 22:34:01 CEST 2010
Revision: 11215
http://gar.svn.sourceforge.net/gar/?rev=11215&view=rev
Author: wahwah
Date: 2010-10-10 20:34:01 +0000 (Sun, 10 Oct 2010)
Log Message:
-----------
mGAR v2: work towards the shared library separation policy. There's a failing unit test that requires more work.
Modified Paths:
--------------
csw/mgar/gar/v2/lib/python/package_checks.py
csw/mgar/gar/v2/lib/python/package_checks_test.py
csw/mgar/gar/v2/lib/python/sharedlib_utils.py
csw/mgar/gar/v2/lib/python/sharedlib_utils_test.py
Modified: csw/mgar/gar/v2/lib/python/package_checks.py
===================================================================
--- csw/mgar/gar/v2/lib/python/package_checks.py 2010-10-10 20:33:30 UTC (rev 11214)
+++ csw/mgar/gar/v2/lib/python/package_checks.py 2010-10-10 20:34:01 UTC (rev 11215)
@@ -985,7 +985,6 @@
def CheckSharedLibraryNamingPolicy(pkg_data, error_mgr, logger, messenger):
- placement_re = re.compile("/opt/csw/lib")
pkgname = pkg_data["basic_stats"]["pkgname"]
shared_libs = set(su.GetSharedLibs(pkg_data))
for binary_info in pkg_data["binaries_dump_info"]:
@@ -1024,13 +1023,34 @@
because the latter is used for linking during compilation, and the former is
a shared object that needs to be phased out at some point.
"""
- placement_re = re.compile("/opt/csw/lib")
pkgname = pkg_data["basic_stats"]["pkgname"]
shared_libs = set(su.GetSharedLibs(pkg_data))
+ shared_libs = filter(su.IsLibraryLinkable, shared_libs)
if shared_libs:
# If the package contains shared libraries, it must not contain
# corrersponding .so files, which are used during linking.
- pass
+ for entry in pkg_data["pkgmap"]:
+ if entry["path"]:
+ if entry["path"].endswith(".so") and entry["type"] == "s":
+ error_mgr.ReportError(
+ "shared-lib-package-contains-so-symlink",
+ "file=%s" % entry["path"])
+ messenger.Message(
+ "The package contains shared libraries together with the "
+ "symlink of the form libfoo.so -> libfoo.so.1. "
+ "In this case: %s. "
+ "This kind of symlink should not be together with the shared "
+ "libraries; it is only used during compiling and linking. "
+ "The best practice "
+ "is to put the shared libraries into a separate package, and "
+ "the .so file together with the header files in the devel "
+ "package." % entry["path"])
+
def CheckPackagesWithHeaderFilesMustContainTheSoFile(pkg_data, error_mgr, logger, messenger):
+ """Generated two kinds of messages:
+
+ 1. Contains .h but not .so
+ 2. Contains .so but not .h
+ """
pass
Modified: csw/mgar/gar/v2/lib/python/package_checks_test.py
===================================================================
--- csw/mgar/gar/v2/lib/python/package_checks_test.py 2010-10-10 20:33:30 UTC (rev 11214)
+++ csw/mgar/gar/v2/lib/python/package_checks_test.py 2010-10-10 20:34:01 UTC (rev 11215)
@@ -1336,5 +1336,15 @@
"expected=['CSWlibneon27', 'CSWlibneon-27']")
+class TestCheckSharedLibraryPkgDoesNotHaveTheSoFile(CheckpkgUnitTestHelper, unittest.TestCase):
+ FUNCTION_NAME = 'CheckSharedLibraryPkgDoesNotHaveTheSoFile'
+ def CheckpkgTest(self):
+ self.pkg_data = neon_stats[0]
+ self.error_mgr_mock.ReportError(
+ 'shared-lib-package-contains-so-symlink', 'file=/opt/csw/lib/libneon.so')
+ self.error_mgr_mock.ReportError(
+ 'shared-lib-package-contains-so-symlink', 'file=/opt/csw/lib/sparcv9/libneon.so')
+
+
if __name__ == '__main__':
unittest.main()
Modified: csw/mgar/gar/v2/lib/python/sharedlib_utils.py
===================================================================
--- csw/mgar/gar/v2/lib/python/sharedlib_utils.py 2010-10-10 20:33:30 UTC (rev 11214)
+++ csw/mgar/gar/v2/lib/python/sharedlib_utils.py 2010-10-10 20:34:01 UTC (rev 11215)
@@ -21,7 +21,7 @@
+ INTEL_386_PATHS + AMD64_PATHS)
# Need to escape the plus signs because of the regex usage below.
arch_subdirs = [x.replace(r"+", r"\+") for x in arch_subdirs]
- linkable_re = re.compile(r"^opt/csw(/[^\/]+)*/lib(/(%s))?$"
+ linkable_re = re.compile(r"^opt/csw(/([^\/]+(?!lib)))*/lib(/(%s))?$"
% "|".join(arch_subdirs))
file_dir, file_basename = os.path.split(file_path)
return bool(linkable_re.match(file_dir))
Modified: csw/mgar/gar/v2/lib/python/sharedlib_utils_test.py
===================================================================
--- csw/mgar/gar/v2/lib/python/sharedlib_utils_test.py 2010-10-10 20:33:30 UTC (rev 11214)
+++ csw/mgar/gar/v2/lib/python/sharedlib_utils_test.py 2010-10-10 20:34:01 UTC (rev 11215)
@@ -42,6 +42,11 @@
p = "opt/csw/lib/gnucash/libgncmod-stylesheets.so.0.0.0"
self.assertEqual(False, su.IsLibraryLinkable(p))
+ def testIsLibraryLinkablePrivateLib(self):
+ self.assertEqual(False, su.IsLibraryLinkable(
+ "opt/csw/lib/erlang/lib/megaco-3.6.0.1/priv/lib"
+ "/megaco_flex_scanner_drv_mt.so"))
+
def testMakePackageNameBySonameSimple(self):
soname = "libfoo.so.0"
expected = (
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