[csw-devel] SF.net SVN: gar:[7796] csw/mgar/gar/v2-checkpkg/bin/checkpkg.d
wahwah at users.sourceforge.net
wahwah at users.sourceforge.net
Wed Dec 30 20:20:41 CET 2009
Revision: 7796
http://gar.svn.sourceforge.net/gar/?rev=7796&view=rev
Author: wahwah
Date: 2009-12-30 19:20:41 +0000 (Wed, 30 Dec 2009)
Log Message:
-----------
mGAR v2-checkpkg: Setting the default RUNPATH even when the field is not there in the binary; added a test for it. Reporting the list of binaries with missing sonames.
Modified Paths:
--------------
csw/mgar/gar/v2-checkpkg/bin/checkpkg.d/checkpkg-libs.py
csw/mgar/gar/v2-checkpkg/bin/checkpkg.d/checkpkg.py
csw/mgar/gar/v2-checkpkg/bin/checkpkg.d/checkpkg_test.py
Added Paths:
-----------
csw/mgar/gar/v2-checkpkg/bin/checkpkg.d/testdata/dump_output_2.py
Modified: csw/mgar/gar/v2-checkpkg/bin/checkpkg.d/checkpkg-libs.py
===================================================================
--- csw/mgar/gar/v2-checkpkg/bin/checkpkg.d/checkpkg-libs.py 2009-12-30 16:58:09 UTC (rev 7795)
+++ csw/mgar/gar/v2-checkpkg/bin/checkpkg.d/checkpkg-libs.py 2009-12-30 19:20:41 UTC (rev 7796)
@@ -26,7 +26,7 @@
stdout, stderr = isalist_proc.communicate()
ret = isalist_proc.wait()
if ret:
- logging.error("Calling isalist has failed.")
+ logging.error("Calling isalist has failed.")
isalist = re.split(r"\s+", stdout.strip())
return isalist
@@ -80,10 +80,16 @@
ret = dump_proc.wait()
binary_data = checkpkg.ParseDumpOutput(stdout)
needed_sonames_by_binary[binary_base_name] = binary_data
- if checkpkg.SONAME in binary_data:
- filenames_by_soname[binary_data[checkpkg.SONAME]] = binary_base_name
+ if checkpkg.SONAME not in binary_data:
+ logging.info("The %s shared library doesn't provide a SONAME.",
+ binary_base_name)
+ # The shared library doesn't tell its SONAME. We're guessing it's the
+ # same as the base file name.
+ binary_data[checkpkg.SONAME] = binary_base_name
+ filenames_by_soname[binary_data[checkpkg.SONAME]] = binary_base_name
+
isalist = GetIsalist()
-
+
# Building indexes by soname to simplify further processing
# These are indexes "by soname".
(needed_sonames,
@@ -116,6 +122,7 @@
# TODO: Rewrite this using cheetah templates
if needed_sonames:
print "Analysis of sonames needed by the package set:"
+ binaries_with_missing_sonames = set([])
for soname in needed_sonames:
logging.debug("Analyzing: %s", soname)
if soname in filenames_by_soname:
@@ -126,17 +133,24 @@
repr(pkgs_by_filename[soname])))
filename_lines = " ".join(sorted(binaries_by_soname[soname]))
for line in textwrap.wrap(filename_lines, 70):
- print " ", line
+ print " ", line
else:
print ("%s is required by %s, but we don't know what provides it."
% (soname, binaries_by_soname[soname]))
+ for binary in binaries_by_soname[soname]:
+ binaries_with_missing_sonames.add(binary)
if soname in checkpkg.ALLOWED_ORPHAN_SONAMES:
- print "However, it's a whitelisted soname."
+ print "However, it's a whitelisted soname."
else:
errors.append(
checkpkg.Error("%s is required by %s, but "
"we don't know what provides it."
% (soname, binaries_by_soname[soname])))
+ if binaries_with_missing_sonames:
+ print "The following are binaries with missing sonames:"
+ binary_lines = " ".join(sorted(binaries_with_missing_sonames))
+ for line in textwrap.wrap(binary_lines, 70):
+ print " ", line
print
dependent_pkgs = {}
@@ -194,7 +208,7 @@
print "! ", soname
msg_printed = True
if not msg_printed:
- print "+ Dependencies of %s look good." % pkgname
+ print "+ Dependencies of %s look good." % pkgname
print
if errors:
Modified: csw/mgar/gar/v2-checkpkg/bin/checkpkg.d/checkpkg.py
===================================================================
--- csw/mgar/gar/v2-checkpkg/bin/checkpkg.d/checkpkg.py 2009-12-30 16:58:09 UTC (rev 7795)
+++ csw/mgar/gar/v2-checkpkg/bin/checkpkg.d/checkpkg.py 2009-12-30 19:20:41 UTC (rev 7796)
@@ -399,11 +399,11 @@
binary_data[NEEDED_SONAMES].append(fields[2])
elif fields[1] == "RUNPATH":
binary_data[RUNPATH].extend(fields[2].split(":"))
- # Adding the default runtime path search option.
- binary_data[RUNPATH].append("/usr/lib/$ISALIST")
- binary_data[RUNPATH].append("/usr/lib")
- binary_data[RUNPATH].append("/lib/$ISALIST")
- binary_data[RUNPATH].append("/lib")
elif fields[1] == "SONAME":
binary_data[SONAME] = fields[2]
+ # Adding the default runtime path search option.
+ binary_data[RUNPATH].append("/usr/lib/$ISALIST")
+ binary_data[RUNPATH].append("/usr/lib")
+ binary_data[RUNPATH].append("/lib/$ISALIST")
+ binary_data[RUNPATH].append("/lib")
return binary_data
Modified: csw/mgar/gar/v2-checkpkg/bin/checkpkg.d/checkpkg_test.py
===================================================================
--- csw/mgar/gar/v2-checkpkg/bin/checkpkg.d/checkpkg_test.py 2009-12-30 16:58:09 UTC (rev 7795)
+++ csw/mgar/gar/v2-checkpkg/bin/checkpkg.d/checkpkg_test.py 2009-12-30 19:20:41 UTC (rev 7796)
@@ -11,6 +11,7 @@
import testdata.checkpkg_test_data_CSWlibpq_84 as d5
import testdata.checkpkg_test_data_CSWmysql5client_8x as d6
import testdata.dump_output_1 as dump_1
+import testdata.dump_output_2 as dump_2
"""A set of unit tests for the library checking code.
@@ -410,9 +411,11 @@
'/opt/csw/mysql5/lib/$ISALIST',
'/opt/csw/mysql5/lib',
'/opt/csw/mysql5/lib/$ISALIST/mysql',
- # These two are artificially appended
+ # These four are artificially appended
'/usr/lib/$ISALIST',
- '/usr/lib'],
+ '/usr/lib',
+ '/lib/$ISALIST',
+ '/lib'],
'needed sonames': ['librt.so.1',
'libresolv.so.2',
'libc.so.1',
@@ -424,6 +427,12 @@
self.assertEqual(expected,
checkpkg.ParseDumpOutput(dump_1.DATA_DUMP_OUTPUT))
+ def test_2(self):
+ expected_runpath = ['/usr/lib/$ISALIST', '/usr/lib', '/lib/$ISALIST', '/lib']
+ self.assertEqual(
+ expected_runpath,
+ checkpkg.ParseDumpOutput(dump_2.DATA_DUMP_OUTPUT)["runpath"])
+
if __name__ == '__main__':
unittest.main()
Added: csw/mgar/gar/v2-checkpkg/bin/checkpkg.d/testdata/dump_output_2.py
===================================================================
--- csw/mgar/gar/v2-checkpkg/bin/checkpkg.d/testdata/dump_output_2.py (rev 0)
+++ csw/mgar/gar/v2-checkpkg/bin/checkpkg.d/testdata/dump_output_2.py 2009-12-30 19:20:41 UTC (rev 7796)
@@ -0,0 +1,34 @@
+DATA_DUMP_OUTPUT = """work/pkgroot/opt/oracle/product/10.2.0/Db_1/opmn/bin/ons:
+
+ **** DYNAMIC SECTION INFORMATION ****
+.dynamic:
+[INDEX] Tag Value
+[1] NEEDED libpthread.so.1
+[2] NEEDED librt.so.1
+[3] NEEDED libnsl.so.1
+[4] NEEDED libxnet.so.1
+[5] NEEDED libdl.so.1
+[6] NEEDED libm.so.1
+[7] NEEDED libc.so.1
+[8] INIT 0xd6088
+[9] FINI 0xd6094
+[10] HASH 0x100e8
+[11] STRTAB 0x19274
+[12] STRSZ 0x4a24
+[13] SYMTAB 0x13174
+[14] SYMENT 0x10
+[15] CHECKSUM 0x20d5
+[16] VERNEED 0x1dc98
+[17] VERNEEDNUM 0x6
+[18] PLTSZ 0x7f8
+[19] PLTREL 0x7
+[20] JMPREL 0x1dd9c
+[21] RELA 0x1dd78
+[22] RELASZ 0x81c
+[23] RELAENT 0xc
+[24] DEBUG 0
+[25] FEATURE_1 PARINIT
+[26] FLAGS 0
+[27] FLAGS_1 0
+[28] PLTGOT 0xf6f64
+"""
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