[csw-devel] SF.net SVN: gar:[20107] csw/mgar/gar/v2/lib/python
wahwah at users.sourceforge.net
wahwah at users.sourceforge.net
Sun Jan 13 12:37:44 CET 2013
Revision: 20107
http://gar.svn.sourceforge.net/gar/?rev=20107&view=rev
Author: wahwah
Date: 2013-01-13 11:37:44 +0000 (Sun, 13 Jan 2013)
Log Message:
-----------
checkpkg: Use SystemUtilityError when ldd fails
Also, add a unit test to ensure that it's actually raised.
Modified Paths:
--------------
csw/mgar/gar/v2/lib/python/inspective_package.py
csw/mgar/gar/v2/lib/python/inspective_package_test.py
csw/mgar/gar/v2/lib/python/package.py
Modified: csw/mgar/gar/v2/lib/python/inspective_package.py
===================================================================
--- csw/mgar/gar/v2/lib/python/inspective_package.py 2013-01-13 11:37:25 UTC (rev 20106)
+++ csw/mgar/gar/v2/lib/python/inspective_package.py 2013-01-13 11:37:44 UTC (rev 20107)
@@ -412,7 +412,7 @@
ldd_output[binary] = []
continue
- raise package.Error("%s returned an error: %s" % (args, stderr))
+ raise package.SystemUtilityError("%s returned an error: %s" % (args, stderr))
ldd_info = []
for line in stdout.splitlines():
Modified: csw/mgar/gar/v2/lib/python/inspective_package_test.py
===================================================================
--- csw/mgar/gar/v2/lib/python/inspective_package_test.py 2013-01-13 11:37:25 UTC (rev 20106)
+++ csw/mgar/gar/v2/lib/python/inspective_package_test.py 2013-01-13 11:37:44 UTC (rev 20107)
@@ -2,6 +2,7 @@
import unittest2 as unittest
import inspective_package
+import package
import mox
import hachoir_parser
import magic
@@ -162,7 +163,24 @@
self.mox.ReplayAll()
self.assertEqual({'bin/foo': []}, ip.GetLddMinusRlines())
+ def testGetLddMinusRlinesThrows(self):
+ ip = inspective_package.InspectivePackage("/tmp/CSWfake")
+ self.mox.StubOutWithMock(ip, 'ListBinaries')
+ self.mox.StubOutWithMock(os, 'chmod')
+ self.mox.StubOutWithMock(os, 'uname')
+ os.chmod('/tmp/CSWfake/root/bin/foo', 0755)
+ os.uname().AndReturn('i86pc')
+ ip.ListBinaries().AndReturn(['bin/foo'])
+ self.mox.StubOutWithMock(inspective_package, 'ShellCommand')
+ inspective_package.ShellCommand(
+ ['ldd', '-Ur', '/tmp/CSWfake/root/bin/foo'],
+ timeout=10).AndReturn((1, "", "boo"))
+ self.mox.StubOutWithMock(ip, '_ParseLddDashRline')
+ self.mox.ReplayAll()
+ self.assertRaises(package.SystemUtilityError,
+ ip.GetLddMinusRlines)
+
class PackageStatsUnitTest(unittest.TestCase):
def setUp(self):
Modified: csw/mgar/gar/v2/lib/python/package.py
===================================================================
--- csw/mgar/gar/v2/lib/python/package.py 2013-01-13 11:37:25 UTC (rev 20106)
+++ csw/mgar/gar/v2/lib/python/package.py 2013-01-13 11:37:44 UTC (rev 20107)
@@ -39,6 +39,9 @@
pass
+class SystemUtilityError(Error):
+ """A problem occurred while running system utility, e.g. ldd."""
+
class PackageError(Error):
pass
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