[csw-devel] SF.net SVN: gar:[20837] csw/mgar/gar/v2/lib/python
chninkel at users.sourceforge.net
chninkel at users.sourceforge.net
Mon Apr 22 09:51:27 CEST 2013
Revision: 20837
http://gar.svn.sourceforge.net/gar/?rev=20837&view=rev
Author: chninkel
Date: 2013-04-22 07:51:26 +0000 (Mon, 22 Apr 2013)
Log Message:
-----------
checkpkg: ldd: do not even check binaries from a different architecture
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-22 07:38:26 UTC (rev 20836)
+++ csw/mgar/gar/v2/lib/python/inspective_package.py 2013-04-22 07:51:26 UTC (rev 20837)
@@ -333,7 +333,10 @@
def GetLddMinusRlines(self):
"""Returns ldd -r output."""
- binaries = self.ListBinaries()
+ pkginfo_arch = self.GetParsedPkginfo()['ARCH']
+ binaries = [ f['path'] for f in self.GetFilesMetadata()
+ if sharedlib_utils.IsBinary(f) and
+ common_constants.MACHINE_ID_METADATA[f['machine_id']]['type'] == pkginfo_arch ]
base_dir = self.GetBasedir()
ldd_output = {}
for binary in binaries:
@@ -354,17 +357,13 @@
# solaris 9 exists only in 32 bits, so we can't do this
# We ignore the error as it is likely that the ldd infos will be
# the same on the 32 bits binaries
- # - if we are trying to analyze a binary from another architecture
- # we ignore this error as it will be caught by another checkpkg test
# - if we are trying to analyze a statically linked binaries
# we care only about dynamic binary so we ignore the error
#
uname_info = os.uname()
if ((uname_info[2] == '5.9' and uname_info[4] == 'i86pc' and
'/amd64/' in binary_abspath and
- 'has wrong class or data encoding' in stderr) or
- re.search(r'ELF machine type: EM_\w+: '
- r'is incompatible with system', stderr)
+ 'has wrong class or data encoding' in stderr)
or 'file is not a dynamic executable or shared object' in stderr):
ldd_output[binary] = []
continue
Modified: csw/mgar/gar/v2/lib/python/inspective_package_test.py
===================================================================
--- csw/mgar/gar/v2/lib/python/inspective_package_test.py 2013-04-22 07:38:26 UTC (rev 20836)
+++ csw/mgar/gar/v2/lib/python/inspective_package_test.py 2013-04-22 07:51:26 UTC (rev 20837)
@@ -314,14 +314,21 @@
def testGetLddMinusRlinesRoot(self):
ip = inspective_package.InspectivePackage("/tmp/CSWfake")
+ self.mox.StubOutWithMock(ip, 'GetParsedPkginfo')
+ self.mox.StubOutWithMock(ip, 'GetFilesMetadata')
self.mox.StubOutWithMock(ip, 'GetBasedir')
self.mox.StubOutWithMock(ip, 'ListBinaries')
self.mox.StubOutWithMock(ip, 'GetFilesDir')
self.mox.StubOutWithMock(os, 'chmod')
self.mox.StubOutWithMock(os, 'uname')
+ ip.GetParsedPkginfo().AndReturn({'ARCH': 'i386'})
+ ip.GetFilesMetadata().AndReturn([{
+ 'path': 'opt/csw/bin/foo',
+ 'machine_id': 3,
+ 'mime_type': 'application/x-executable; charset=binary'
+ }])
ip.GetBasedir().AndReturn('')
os.chmod('/tmp/CSWfake/root/opt/csw/bin/foo', 0755)
- ip.ListBinaries().AndReturn(['opt/csw/bin/foo'])
ip.GetFilesDir().AndReturn('root')
self.mox.StubOutWithMock(shell, 'ShellCommand')
shell.ShellCommand(
@@ -333,14 +340,20 @@
def testGetLddMinusRlinesReloc(self):
ip = inspective_package.InspectivePackage("/tmp/CSWfake")
+ self.mox.StubOutWithMock(ip, 'GetParsedPkginfo')
+ self.mox.StubOutWithMock(ip, 'GetFilesMetadata')
self.mox.StubOutWithMock(ip, 'GetBasedir')
- self.mox.StubOutWithMock(ip, 'ListBinaries')
self.mox.StubOutWithMock(ip, 'GetFilesDir')
self.mox.StubOutWithMock(os, 'chmod')
self.mox.StubOutWithMock(os, 'uname')
+ ip.GetParsedPkginfo().AndReturn({'ARCH': 'i386'})
+ ip.GetFilesMetadata().AndReturn([{
+ 'path': 'bin/foo',
+ 'machine_id': 3,
+ 'mime_type': 'application/x-executable; charset=binary'
+ }])
ip.GetBasedir().AndReturn('opt/csw')
os.chmod('/tmp/CSWfake/reloc/bin/foo', 0755)
- ip.ListBinaries().AndReturn(['bin/foo'])
ip.GetFilesDir().AndReturn('reloc')
self.mox.StubOutWithMock(shell, 'ShellCommand')
shell.ShellCommand(
@@ -352,16 +365,22 @@
def testGetLddMinusRlinesThrows(self):
ip = inspective_package.InspectivePackage("/tmp/CSWfake")
+ self.mox.StubOutWithMock(ip, 'GetParsedPkginfo')
+ self.mox.StubOutWithMock(ip, 'GetFilesMetadata')
self.mox.StubOutWithMock(ip, 'GetBasedir')
- self.mox.StubOutWithMock(ip, 'ListBinaries')
self.mox.StubOutWithMock(ip, 'GetFilesDir')
self.mox.StubOutWithMock(os, 'chmod')
self.mox.StubOutWithMock(os, 'uname')
+ ip.GetParsedPkginfo().AndReturn({'ARCH': 'i386'})
+ ip.GetFilesMetadata().AndReturn([{
+ 'path': 'opt/csw/bin/foo',
+ 'machine_id': 3,
+ 'mime_type': 'application/x-executable; charset=binary'
+ }])
ip.GetBasedir().AndReturn('/')
os.chmod('/tmp/CSWfake/root/opt/csw/bin/foo', 0755)
os.uname().AndReturn('i86pc')
ip.GetFilesDir().AndReturn('root')
- ip.ListBinaries().AndReturn(['opt/csw/bin/foo'])
self.mox.StubOutWithMock(shell, 'ShellCommand')
shell.ShellCommand(
['ldd', '-Ur', '/tmp/CSWfake/root/opt/csw/bin/foo'],
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