[csw-devel] SF.net SVN: gar:[9834] csw/mgar/gar/v2/lib/python
wahwah at users.sourceforge.net
wahwah at users.sourceforge.net
Sat May 8 08:42:31 CEST 2010
Revision: 9834
http://gar.svn.sourceforge.net/gar/?rev=9834&view=rev
Author: wahwah
Date: 2010-05-08 06:42:31 +0000 (Sat, 08 May 2010)
Log Message:
-----------
mGAR v2: checkpkg, better handling of dlopen binaries (Python only for now)
Modified Paths:
--------------
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/dependency_checks.py
===================================================================
--- csw/mgar/gar/v2/lib/python/dependency_checks.py 2010-05-07 19:58:48 UTC (rev 9833)
+++ csw/mgar/gar/v2/lib/python/dependency_checks.py 2010-05-08 06:42:31 UTC (rev 9834)
@@ -11,6 +11,17 @@
"Please use /opt/csw/mysql5/..."),
)
+DLOPEN_LIB_LOCATIONS = (
+ r'^opt/csw/lib/python/site-packages.*',
+)
+
+def IsDlopenLib(binary_path, locations=DLOPEN_LIB_LOCATIONS):
+ for location in locations:
+ location_re = re.compile(location)
+ if location_re.match(binary_path):
+ return True
+ return False
+
def Libraries(pkg_data, error_mgr, logger, path_and_pkg_by_soname):
pkgname = pkg_data["basic_stats"]["pkgname"]
logger.debug("Package %s", pkgname)
@@ -47,8 +58,11 @@
orphan_sonames.append((soname, binary_info["path"]))
orphan_sonames = set(orphan_sonames)
for soname, binary_path in orphan_sonames:
+ if IsDlopenLib(binary_path):
+ # dlopen binaries don't need RPATH and can't be analyzed this way.
+ continue
error_mgr.ReportError(
- pkgname, "soname-not-found", soname,
+ pkgname, "soname-not-found",
"%s is needed by %s" % (soname, binary_path))
# TODO: Report orphan sonames here
return required_deps
Modified: csw/mgar/gar/v2/lib/python/package_checks.py
===================================================================
--- csw/mgar/gar/v2/lib/python/package_checks.py 2010-05-07 19:58:48 UTC (rev 9833)
+++ csw/mgar/gar/v2/lib/python/package_checks.py 2010-05-08 06:42:31 UTC (rev 9834)
@@ -169,7 +169,7 @@
def SetCheckLibraries(pkgs_data, error_mgr, logger, messenger):
- """Second versionof the library checking code.
+ """Second version of the library checking code.
1. Collect all the data from the FS:
{"<basename>": {"/path/1": ["CSWfoo1"], "/path/2": ["CSWfoo2"]}}
@@ -607,7 +607,9 @@
for bad in sorted(not_matching):
logger.debug("Bad rpath: %s", bad)
- error_mgr.ReportError("bad-rpath-entry", bad)
+ error_mgr.ReportError(
+ "bad-rpath-entry",
+ "%s %s" % (bad, binary_info["path"]))
def DisabledCheckForMissingSymbols(pkgs_data, debug):
@@ -673,6 +675,12 @@
"relocation bound to a symbol with STV_PROTECTED visibility"
% (ldd_elem["symbol"], ldd_elem["path"]))
+
+def SetCheckFileCollissions(pkgs_data, error_mgr, logger, messenger):
+ for pkg_data in pkgs_data:
+ pass
+
+
def CheckPythonPackageName(pkg_data, error_mgr, logger, messenger):
"""Checks for CSWpy-* and py_* package names."""
pyfile_re = re.compile(r"/opt/csw/lib/python.*/.*")
@@ -698,4 +706,3 @@
"For example, %s. "
"However, the catalogname doesn't start with 'py_'."
% repr(example_py_file))
-
Modified: csw/mgar/gar/v2/lib/python/package_checks_test.py
===================================================================
--- csw/mgar/gar/v2/lib/python/package_checks_test.py 2010-05-07 19:58:48 UTC (rev 9833)
+++ csw/mgar/gar/v2/lib/python/package_checks_test.py 2010-05-08 06:42:31 UTC (rev 9834)
@@ -436,6 +436,36 @@
self.pkg_data = [self.pkg_data]
+class TestCheckLibrariesDlopenLibs_1(CheckpkgUnitTestHelper, unittest.TestCase):
+ FUNCTION_NAME = 'SetCheckLibraries'
+ def CheckpkgTest(self):
+ binaries_dump_info = self.pkg_data["binaries_dump_info"]
+ binaries_dump_info[0]["runpath"] = []
+ binaries_dump_info[0]["needed sonames"] = ["libnotfound.so"]
+ binaries_dump_info[0]["path"] = 'opt/csw/lib/python/site-packages/foo.so'
+ self.pkg_data["depends"] = tuple()
+ self.pkg_data["binaries_dump_info"] = binaries_dump_info[0:1]
+ self.error_mgr_mock.GetPathsAndPkgnamesByBasename('libnotfound.so').AndReturn({
+ })
+ self.pkg_data = [self.pkg_data]
+
+
+class TestCheckLibrariesDlopenLibs_2(CheckpkgUnitTestHelper, unittest.TestCase):
+ FUNCTION_NAME = 'SetCheckLibraries'
+ def CheckpkgTest(self):
+ binaries_dump_info = self.pkg_data["binaries_dump_info"]
+ binaries_dump_info[0]["runpath"] = []
+ binaries_dump_info[0]["needed sonames"] = ["libnotfound.so"]
+ binaries_dump_info[0]["path"] = 'opt/csw/lib/foo.so'
+ self.pkg_data["depends"] = tuple()
+ self.pkg_data["binaries_dump_info"] = binaries_dump_info[0:1]
+ self.error_mgr_mock.GetPathsAndPkgnamesByBasename('libnotfound.so').AndReturn({
+ })
+ self.error_mgr_mock.ReportError('CSWrsync', 'soname-not-found',
+ 'libnotfound.so is needed by opt/csw/lib/foo.so')
+ self.pkg_data = [self.pkg_data]
+
+
class TestCheckVendorURL_BadUrl(CheckpkgUnitTestHelper, unittest.TestCase):
FUNCTION_NAME = "CheckVendorURL"
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