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

chninkel at users.sourceforge.net chninkel at users.sourceforge.net
Tue Apr 30 00:28:34 CEST 2013


Revision: 20904
          http://gar.svn.sourceforge.net/gar/?rev=20904&view=rev
Author:   chninkel
Date:     2013-04-29 22:28:33 +0000 (Mon, 29 Apr 2013)
Log Message:
-----------
Stop gathering ldd data that are not used

Modified Paths:
--------------
    csw/mgar/gar/v2/lib/python/inspective_package.py
    csw/mgar/gar/v2/lib/python/inspective_package_test.py

Modified: csw/mgar/gar/v2/lib/python/inspective_package.py
===================================================================
--- csw/mgar/gar/v2/lib/python/inspective_package.py	2013-04-29 18:40:43 UTC (rev 20903)
+++ csw/mgar/gar/v2/lib/python/inspective_package.py	2013-04-29 22:28:33 UTC (rev 20904)
@@ -539,69 +539,9 @@
     if m:
       response = {}
       d = m.groupdict()
-      if "soname" in d and d["soname"]:
-        # it was found
-        response["state"] = "OK"
-        response["soname"] = d["soname"]
-        response["path"] = d["path_found"]
-        response["symbol"] = None
-      elif "symbol" in d and d["symbol"]:
-        response["state"] = "symbol-not-found"
-        response["soname"] = None
-        response["path"] = d["path_not_found"]
-        response["symbol"] = d["symbol"]
-      elif "binary" in d and d["binary"] and binary == d["binary"]:
+      if "binary" in d and d["binary"] and binary == d["binary"]:
         response["state"] = "soname-unused"
         response["soname"] = os.path.basename(d["object"])
-        response["path"] = None
-        response["symbol"] = None
-      elif d["path_only"]:
-        response["state"] = "OK"
-        response["soname"] = None
-        response["path"] = d["path_only"]
-        response["symbol"] = None
-      elif d["soname_version_not_found"]:
-        response["state"] = "version-not-found"
-        response["soname"] = d["soname_version_not_found"]
-        response["path"] = None
-        response["symbol"] = None
-      elif d["relocation_symbol"]:
-        response["state"] = 'relocation-bound-to-a-symbol-with-STV_PROTECTED-visibility'
-        response["soname"] = None
-        response["path"] = d["relocation_path"]
-        response["symbol"] = d["relocation_symbol"]
-      elif d["sizes_differ_symbol"]:
-        response["state"] = 'sizes-differ'
-        response["soname"] = None
-        response["path"] = None
-        response["symbol"] = d["sizes_differ_symbol"]
-      elif d["sizediff_file1"]:
-        response["state"] = 'sizes-diff-info'
-        response["soname"] = None
-        response["path"] = "%s %s" % (d["sizediff_file1"], d["sizediff_file2"])
-        response["symbol"] = None
-      elif d["sizediffused_file"]:
-        response["state"] = 'sizes-diff-one-used'
-        response["soname"] = None
-        response["path"] = "%s" % (d["sizediffused_file"])
-        response["symbol"] = None
-      elif d["move_offset"]:
-        response["state"] = 'move-offset-error'
-        response["soname"] = None
-        response["path"] = None
-        response["symbol"] = None
-        response["move_offset"] = d['move_offset']
-        response["move_index"] = d['move_index']
-      elif d["reloc_symbol"]:
-        response["state"] = 'relocation-issue'
-        response["soname"] = None
-        response["path"] = None
-        response["symbol"] = d['reloc_symbol']
-      elif d["copy_reloc_symbol"]:
-        response["state"] = 'relocation-issue'
-        response["soname"] = None
-        response["path"] = None
-        response["symbol"] = d['copy_reloc_symbol']
 
     else:
       raise package.StdoutSyntaxError("Could not parse %s with %s"

Modified: csw/mgar/gar/v2/lib/python/inspective_package_test.py
===================================================================
--- csw/mgar/gar/v2/lib/python/inspective_package_test.py	2013-04-29 18:40:43 UTC (rev 20903)
+++ csw/mgar/gar/v2/lib/python/inspective_package_test.py	2013-04-29 22:28:33 UTC (rev 20904)
@@ -14,6 +14,7 @@
 \tsymbol not found: check_encoding_conversion_args    (/opt/csw/lib/postgresql/8.4/utf8_and_gbk.so)
 \tsymbol not found: LocalToUtf    (/opt/csw/lib/postgresql/8.4/utf8_and_gbk.so)
 \tsymbol not found: UtfToLocal    (/opt/csw/lib/postgresql/8.4/utf8_and_gbk.so)
+\tunreferenced object=/lib/libsocket.so.1; unused dependency of /opt/csw/lib/libfoo.so.1
 \tlibm.so.2 =>   /lib/libm.so.2
 \t/usr/lib/secure/s8_preload.so.1
 \tlibXext.so.0 (SUNW_1.1) =>\t (version not found)
@@ -451,91 +452,59 @@
     line = 'foo'
     self.assertEqual(None, self.ip._ParseNmSymLine(line))
 
-  def test_ParseLddDashRlineFound(self):
-    line = '\tlibc.so.1 =>  /lib/libc.so.1'
+  def test_ParseLddSonameUnusued(self):
+    line = '\tunreferenced object=/lib/libsocket.so.1; unused dependency of /opt/csw/lib/libfoo.so.1'
     expected = {
-        'state': 'OK',
-        'soname': 'libc.so.1',
-        'path': '/lib/libc.so.1',
-        'symbol': None,
+        'soname': 'libsocket.so.1',
+        'state': 'soname-unused'
     }
-    self.assertEqual(expected, self.ip._ParseLddDashRline(line))
+    result = self.ip._ParseLddDashRline(line, '/opt/csw/lib/libfoo.so.1')
+    self.assertEqual(expected, result)
 
+  def test_ParseLddDashRlineFound(self):
+    line = '\tlibc.so.1 =>  /lib/libc.so.1'
+    expected = {}
+    self.assertEqual(expected,self.ip._ParseLddDashRline(line))
+
   def test_ParseLddDashRlineSymbolMissing(self):
     line = ('\tsymbol not found: check_encoding_conversion_args    '
             '(/opt/csw/lib/postgresql/8.4/utf8_and_gbk.so)')
-    expected = {
-        'state': 'symbol-not-found',
-        'soname': None,
-        'path': '/opt/csw/lib/postgresql/8.4/utf8_and_gbk.so',
-        'symbol': 'check_encoding_conversion_args',
-    }
+    expected = {}
     self.assertEqual(expected, self.ip._ParseLddDashRline(line))
 
   def test_ParseLddDashRlineFound(self):
     line = '\t/usr/lib/secure/s8_preload.so.1'
-    expected = {
-        'state': 'OK',
-        'soname': None,
-        'path': '/usr/lib/secure/s8_preload.so.1',
-        'symbol': None,
-    }
+    expected = {}
     self.assertEqual(expected, self.ip._ParseLddDashRline(line))
 
   def test_ParseLdd_VersionNotFound(self):
     line = '\tlibXext.so.0 (SUNW_1.1) =>\t (version not found)'
-    expected = {
-        'symbol': None,
-        'soname': 'libXext.so.0',
-        'path': None,
-        'state': 'version-not-found',
-    }
+    expected = {}
     self.assertEqual(expected, self.ip._ParseLddDashRline(line))
 
   def test_ParseLdd_StvProtectedVisibility(self):
     line = ('\trelocation R_SPARC_COPY symbol: ASN1_OCTET_STRING_it: '
             'file /opt/csw/lib/sparcv8plus+vis/libcrypto.so.0.9.8: '
             'relocation bound to a symbol with STV_PROTECTED visibility')
-    expected = {
-        'symbol': 'ASN1_OCTET_STRING_it',
-        'soname': None,
-        'path': '/opt/csw/lib/sparcv8plus+vis/libcrypto.so.0.9.8',
-        'state': 'relocation-bound-to-a-symbol-with-STV_PROTECTED-visibility',
-    }
+    expected = {}
     self.assertEqual(expected, self.ip._ParseLddDashRline(line))
 
   def test_ParseLdd_SizesDiffer(self):
     line = '\trelocation R_SPARC_COPY sizes differ: _ZTI7QWidget'
-    expected = {
-        'symbol': '_ZTI7QWidget',
-        'soname': None,
-        'path': None,
-        'state': 'sizes-differ',
-    }
+    expected = {}
     self.assertEqual(expected, self.ip._ParseLddDashRline(line))
 
   def test_ParseLdd_SizesDifferInfo(self):
     line = ('\t\t(file /tmp/pkg_GqCk0P/CSWkdeartworkgcc/root/opt/csw/kde-gcc/bin/'
             'kslideshow.kss size=0x28; '
             'file /opt/csw/kde-gcc/lib/libqt-mt.so.3 size=0x20)')
-    expected = {
-        'symbol': None,
-        'path': ('/tmp/pkg_GqCk0P/CSWkdeartworkgcc/root/opt/csw/kde-gcc/'
-                 'bin/kslideshow.kss /opt/csw/kde-gcc/lib/libqt-mt.so.3'),
-        'state': 'sizes-diff-info',
-        'soname': None,
-    }
+    expected = {}
     self.assertEqual(expected, self.ip._ParseLddDashRline(line))
 
   def test_ParseLdd_SizesDifferOneUsed(self):
     line = ('\t\t/opt/csw/kde-gcc/lib/libqt-mt.so.3 size used; '
             'possible insufficient data copied')
-    expected = {
-        'symbol': None,
-        'path': '/opt/csw/kde-gcc/lib/libqt-mt.so.3',
-        'state': 'sizes-diff-one-used',
-        'soname': None,
-    }
+    expected = {}
     self.assertEqual(expected, self.ip._ParseLddDashRline(line))
 
   def test_ParseLddDashRlineManyLines(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