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

chninkel at users.sourceforge.net chninkel at users.sourceforge.net
Mon Mar 25 22:59:00 CET 2013


Revision: 20521
          http://gar.svn.sourceforge.net/gar/?rev=20521&view=rev
Author:   chninkel
Date:     2013-03-25 21:58:58 +0000 (Mon, 25 Mar 2013)
Log Message:
-----------
gar/v2: added test for 64 bits binaries presence

Modified Paths:
--------------
    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/package_checks.py
===================================================================
--- csw/mgar/gar/v2/lib/python/package_checks.py	2013-03-25 20:21:03 UTC (rev 20520)
+++ csw/mgar/gar/v2/lib/python/package_checks.py	2013-03-25 21:58:58 UTC (rev 20521)
@@ -1337,3 +1337,32 @@
       error_mgr.ReportError(
           "shared-library-missing-dot-so",
           "file=%s" % shared_lib)
+
+
+def Check64bitsBinariesPresence(pkg_data, error_mgr, logger, messenger):
+  pkginfo = pkg_data['pkginfo']
+  if not ('OPENCSW_MODE64' in pkginfo and '64' in pkginfo['OPENCSW_MODE64']):
+    return
+
+  if 'isaexec' in pkginfo['OPENCSW_MODE64']:
+    binaries = pkg_data['binaries_dump_info']
+    binaries_path = 'bin|sbin|lib|libexec'
+  else:
+    binaries = [ x for x in pkg_data['binaries_dump_info'] if 'soname' in x ]
+    binaries_path = 'lib|libexec'
+
+  if binaries:
+    paths_64 = { 'i386': su.AMD64_PATHS, 'sparc': su.SPARCV9_PATHS }
+    paths_64_re = re.compile(r"opt/csw/(%s)/(%s)" %
+                             (binaries_path,
+                              '|'.join(paths_64[pkginfo['ARCH']])))
+    for binary_info in binaries:
+      if paths_64_re.search(binary_info['path']):
+          return
+
+    error_mgr.ReportError('64bits-binaries-missing')
+    messenger.Message(
+      "The package is supposed to contains 64 bits binaries "
+      "but it doesn't contain any in the usual 64 bits "
+      "binaries locations.")
+

Modified: csw/mgar/gar/v2/lib/python/package_checks_test.py
===================================================================
--- csw/mgar/gar/v2/lib/python/package_checks_test.py	2013-03-25 20:21:03 UTC (rev 20520)
+++ csw/mgar/gar/v2/lib/python/package_checks_test.py	2013-03-25 21:58:58 UTC (rev 20521)
@@ -1965,7 +1965,25 @@
     self.error_mgr_mock.ReportError(
         'shared-library-missing-dot-so', 'file=foo.1')
 
+class TestCheck64bitsBinariesPresence(CheckTestHelper, unittest.TestCase):
+  FUNCTION_NAME = 'Check64bitsBinariesPresence'
+  def testFull32bitsPackage(self):
+    self.pkg_data = copy.deepcopy(vsftpd_stats[0])
 
+  def testMissingIntel64bitsLibraries(self):
+    self.pkg_data = copy.deepcopy(neon_stats[0])
+    self.error_mgr_mock.ReportError('64bits-binaries-missing')
+
+  def testMissingSparc64bitsLibraries(self):
+    self.pkg_data = copy.deepcopy(neon_stats[0])
+    self.pkg_data["pkginfo"]["OPENCSW_MODE64"] = '32/64'
+    self.error_mgr_mock.ReportError('64bits-binaries-missing')
+
+  def testMissing64bitsExecutable(self):
+    self.pkg_data = bdb48_stats[0]
+    self.pkg_data["pkginfo"]["OPENCSW_MODE64"] = '32/64/isaexec'
+    self.error_mgr_mock.ReportError('64bits-binaries-missing')
+
 class TestRemovePackagesUnderInstallation(unittest.TestCase):
 
   def testRemoveNone(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