[csw-devel] SF.net SVN: gar:[9158] csw/mgar/gar/v2

wahwah at users.sourceforge.net wahwah at users.sourceforge.net
Sun Mar 14 12:12:57 CET 2010


Revision: 9158
          http://gar.svn.sourceforge.net/gar/?rev=9158&view=rev
Author:   wahwah
Date:     2010-03-14 11:12:57 +0000 (Sun, 14 Mar 2010)

Log Message:
-----------
mGAR v2: checkpkg, cut the running time in half, from 60 to 30 seconds in my test case.  This is thanks to the reduction of the re-loading of package statistics, and moving checks from separate executables to one Python module.

Modified Paths:
--------------
    csw/mgar/gar/v2/bin/checkpkg_collect_stats.py
    csw/mgar/gar/v2/bin/update_contents_cache.py
    csw/mgar/gar/v2/lib/checkpkg.d/checkpkg-basic.py
    csw/mgar/gar/v2/lib/python/package_checks.py
    csw/mgar/gar/v2/lib/python/package_checks_old.py
    csw/mgar/gar/v2/lib/python/package_checks_old_test.py
    csw/mgar/gar/v2/lib/python/package_checks_test.py

Removed Paths:
-------------
    csw/mgar/gar/v2/lib/checkpkg.d/checkpkg-actionclasses.py
    csw/mgar/gar/v2/lib/checkpkg.d/checkpkg-archall.py
    csw/mgar/gar/v2/lib/checkpkg.d/checkpkg-license.py
    csw/mgar/gar/v2/lib/checkpkg.d/checkpkg-obsolete-deps.py

Modified: csw/mgar/gar/v2/bin/checkpkg_collect_stats.py
===================================================================
--- csw/mgar/gar/v2/bin/checkpkg_collect_stats.py	2010-03-14 11:11:22 UTC (rev 9157)
+++ csw/mgar/gar/v2/bin/checkpkg_collect_stats.py	2010-03-14 11:12:57 UTC (rev 9158)
@@ -31,7 +31,7 @@
     logging.basicConfig(level=logging.DEBUG)
   else:
     logging.basicConfig(level=logging.INFO)
-  logging.info("Collecting statistics about given package files.")
+  logging.debug("Collecting statistics about given package files.")
   logging.debug("calling: %s, please be patient", args)
   packages = [opencsw.CswSrv4File(x, options.debug) for x in args]
   stats_list = [checkpkg.PackageStats(pkg) for pkg in packages]

Modified: csw/mgar/gar/v2/bin/update_contents_cache.py
===================================================================
--- csw/mgar/gar/v2/bin/update_contents_cache.py	2010-03-14 11:11:22 UTC (rev 9157)
+++ csw/mgar/gar/v2/bin/update_contents_cache.py	2010-03-14 11:12:57 UTC (rev 9158)
@@ -18,7 +18,6 @@
 import checkpkg
 
 def main():
-  print "Checking if the package cache is up to date."
   logging.basicConfig(level=logging.INFO)
   test_pkgmap = checkpkg.SystemPkgmap()
   test_pkgmap.InitializeDatabase()

Deleted: csw/mgar/gar/v2/lib/checkpkg.d/checkpkg-actionclasses.py
===================================================================
--- csw/mgar/gar/v2/lib/checkpkg.d/checkpkg-actionclasses.py	2010-03-14 11:11:22 UTC (rev 9157)
+++ csw/mgar/gar/v2/lib/checkpkg.d/checkpkg-actionclasses.py	2010-03-14 11:12:57 UTC (rev 9158)
@@ -1,75 +0,0 @@
-#!/opt/csw/bin/python2.6
-# $Id$
-
-"""This is a dummy check. You can use it as a boilerplate for your own checks.
-
-Copy it and modify.
-"""
-
-import logging
-import os.path
-import sys
-import re
-
-CHECKPKG_MODULE_NAME = "class action scripts / prototype integrity"
-
-# The following bit of code sets the correct path to Python libraries
-# distributed with GAR.
-path_list = [os.path.dirname(__file__),
-             "..", "..", "lib", "python"]
-sys.path.append(os.path.join(*path_list))
-import checkpkg
-import opencsw
-
-
-def CheckActionClasses(pkg_data, debug):
-  """Checks the consistency between classes in the prototype and pkginfo."""
-  errors = []
-  pkginfo = pkg_data["pkginfo"]
-  pkgmap = pkg_data["pkgmap"]
-  pkginfo_classes = set(re.split(opencsw.WS_RE, pkginfo["CLASSES"]))
-  pkgmap_classes = set()
-  for entry in pkgmap:
-    if entry["class"]:  # might be None
-      pkgmap_classes.add(entry["class"])
-  only_in_pkginfo = pkginfo_classes.difference(pkgmap_classes)
-  only_in_pkgmap = pkgmap_classes.difference(pkginfo_classes)
-  for action_class in only_in_pkginfo:
-    error = checkpkg.CheckpkgTag(
-        pkg_data["basic_stats"]["pkgname"],
-        "action-class-only-in-pkginfo",
-        action_class,
-        msg="This shouldn't cause any problems, but it might be not necessary.")
-    errors.append(error)
-  for action_class in only_in_pkgmap:
-    errors.append(
-        checkpkg.CheckpkgTag(pkg.pkgname, "action-class-only-in-pkgmap", action_class))
-  return errors
-
-
-def main():
-  options, args = checkpkg.GetOptions()
-  if options.debug:
-  	logging.basicConfig(level=logging.DEBUG)
-  else:
-  	logging.basicConfig(level=logging.INFO)
-  md5sums = args
-  # CheckpkgManager class abstracts away things such as the collection of
-  # results.
-  check_manager = checkpkg.CheckpkgManager(CHECKPKG_MODULE_NAME,
-                                           options.stats_basedir,
-                                           md5sums,
-                                           options.debug)
-  # Registering functions defined above.
-  check_manager.RegisterIndividualCheck(CheckActionClasses)
-  # Running the checks, reporting and exiting.
-  exit_code, screen_report, tags_report = check_manager.Run()
-  f = open(options.output, "w")
-  f.write(tags_report)
-  f.close()
-  print screen_report.strip()
-  sys.exit(exit_code)
-
-
-if __name__ == '__main__':
-  main()

Deleted: csw/mgar/gar/v2/lib/checkpkg.d/checkpkg-archall.py
===================================================================
--- csw/mgar/gar/v2/lib/checkpkg.d/checkpkg-archall.py	2010-03-14 11:11:22 UTC (rev 9157)
+++ csw/mgar/gar/v2/lib/checkpkg.d/checkpkg-archall.py	2010-03-14 11:12:57 UTC (rev 9158)
@@ -1,44 +0,0 @@
-#!/opt/csw/bin/python2.6
-#
-# $Id$
-
-"""Verifies the architecture of the package."""
-
-import os.path
-import re
-import sys
-
-CHECKPKG_MODULE_NAME = "architecture check"
-
-# The following bit of code sets the correct path to Python libraries
-# distributed with GAR.
-path_list = [os.path.dirname(__file__),
-             "..", "..", "lib", "python"]
-sys.path.append(os.path.join(*path_list))
-import checkpkg
-import package_checks_old
-
-def main():
-  options, args = checkpkg.GetOptions()
-  md5sums = args
-  # CheckpkgManager class abstracts away things such as the collection of
-  # results.
-  check_manager = checkpkg.CheckpkgManager(CHECKPKG_MODULE_NAME,
-                                           options.stats_basedir,
-                                           md5sums,
-                                           options.debug)
-
-  check_manager.RegisterIndividualCheck(
-      package_checks_old.CheckArchitectureVsContents)
-  exit_code, screen_report, tags_report = check_manager.Run()
-  f = open(options.output, "w")
-  f.write(tags_report)
-  f.close()
-  print screen_report.strip()
-  sys.exit(exit_code)
-
-
-if __name__ == '__main__':
-  main()
-
-# vim:set sw=2 ts=2 sts=2 expandtab:

Modified: csw/mgar/gar/v2/lib/checkpkg.d/checkpkg-basic.py
===================================================================
--- csw/mgar/gar/v2/lib/checkpkg.d/checkpkg-basic.py	2010-03-14 11:11:22 UTC (rev 9157)
+++ csw/mgar/gar/v2/lib/checkpkg.d/checkpkg-basic.py	2010-03-14 11:12:57 UTC (rev 9158)
@@ -31,7 +31,6 @@
   # Registering functions defined above.
   check_manager.RegisterIndividualCheck(package_checks_old.FileNameSanity)
   check_manager.RegisterIndividualCheck(package_checks_old.PkginfoSanity)
-  check_manager.RegisterIndividualCheck(package_checks_old.ArchitectureSanity)
   check_manager.RegisterIndividualCheck(package_checks_old.CheckBuildingUser)
   check_manager.RegisterIndividualCheck(package_checks_old.CheckPkgmapPaths)
   # Running the checks, reporting and exiting.

Deleted: csw/mgar/gar/v2/lib/checkpkg.d/checkpkg-license.py
===================================================================
--- csw/mgar/gar/v2/lib/checkpkg.d/checkpkg-license.py	2010-03-14 11:11:22 UTC (rev 9157)
+++ csw/mgar/gar/v2/lib/checkpkg.d/checkpkg-license.py	2010-03-14 11:12:57 UTC (rev 9158)
@@ -1,59 +0,0 @@
-#!/opt/csw/bin/python2.6
-# $Id$
-
-"""Checks for the existence of the license file."""
-
-import logging
-import os.path
-import sys
-
-CHECKPKG_MODULE_NAME = "license presence"
-
-# The following bit of code sets the correct path to Python libraries
-# distributed with GAR.
-path_list = [os.path.dirname(__file__),
-             "..", "..", "lib", "python"]
-sys.path.append(os.path.join(*path_list))
-import checkpkg
-import opencsw
-
-LICENSE_TMPL = "/opt/csw/share/doc/%s/license"
-
-def CheckLicenseFile(pkg_data, debug):
-  """Checks for the presence of the license file."""
-  errors = []
-  pkgmap = pkg_data["pkgmap"]
-  catalogname = pkg_data["basic_stats"]["catalogname"]
-  license_path = LICENSE_TMPL % catalogname
-  pkgmap_paths = [x["path"] for x in pkgmap]
-  if license_path not in pkgmap_paths:
-    errors.append(
-        checkpkg.CheckpkgTag(
-          pkg_data["basic_stats"]["pkgname"],
-          "license-missing",
-          msg="See http://sourceforge.net/apps/trac/gar/wiki/CopyRight"))
-  return errors
-
-
-def main():
-  options, args = checkpkg.GetOptions()
-  md5sums = args
-  # CheckpkgManager class abstracts away things such as the collection of
-  # results.
-  check_manager = checkpkg.CheckpkgManager(CHECKPKG_MODULE_NAME,
-                                           options.stats_basedir,
-                                           md5sums,
-                                           options.debug)
-  # Registering functions defined above.
-  check_manager.RegisterIndividualCheck(CheckLicenseFile)
-  # Running the checks, reporting and exiting.
-  exit_code, screen_report, tags_report = check_manager.Run()
-  f = open(options.output, "w")
-  f.write(tags_report)
-  f.close()
-  print screen_report.strip()
-  sys.exit(exit_code)
-
-
-if __name__ == '__main__':
-  main()

Deleted: csw/mgar/gar/v2/lib/checkpkg.d/checkpkg-obsolete-deps.py
===================================================================
--- csw/mgar/gar/v2/lib/checkpkg.d/checkpkg-obsolete-deps.py	2010-03-14 11:11:22 UTC (rev 9157)
+++ csw/mgar/gar/v2/lib/checkpkg.d/checkpkg-obsolete-deps.py	2010-03-14 11:12:57 UTC (rev 9158)
@@ -1,74 +0,0 @@
-#!/opt/csw/bin/python2.6
-# $Id$
-
-"""Makes sure that obsolete packages are not added as dependencies.
-"""
-
-import logging
-import os.path
-import sys
-
-CHECKPKG_MODULE_NAME = "obsolete dependencies"
-
-# The following bit of code sets the correct path to Python libraries
-# distributed with GAR.
-path_list = [os.path.dirname(__file__),
-             "..", "..", "lib", "python"]
-sys.path.append(os.path.join(*path_list))
-import checkpkg
-
-OBSOLETE_DEPS = {
-    # "CSWfoo": {
-    #   "hint": "Do this...",
-    #   "url": "http://www.opencsw.org/bugtrack/view.php?id=..."
-    # },
-    "CSWpython-rt": {
-      "hint": "CSWpython-rt is deprecated, use CSWpython instead.",
-      "url": "http://www.opencsw.org/bugtrack/view.php?id=4031"
-    },
-}
-
-def CheckObsoleteDeps(pkg_data, debug):
-  """Checks for obsolete dependencies."""
-  errors = []
-  deps = set(pkg_data["depends"])
-  obsolete_pkg_deps = deps.intersection(set(OBSOLETE_DEPS))
-  if obsolete_pkg_deps:
-    for obsolete_pkg in obsolete_pkg_deps:
-      msg = ""
-      if "hint" in OBSOLETE_DEPS[obsolete_pkg]:
-        msg += "Hint: %s" % OBSOLETE_DEPS[obsolete_pkg]["hint"]
-      if "url" in OBSOLETE_DEPS[obsolete_pkg]:
-        if msg:
-          msg += ", "
-        msg += "URL: %s" % OBSOLETE_DEPS[obsolete_pkg]["url"]
-      if not msg:
-        msg = None
-      errors.append(
-          checkpkg.CheckpkgTag(
-    	      pkg_data["basic_stats"]["pkgname"],
-            "obsolete-dependency", obsolete_pkg, msg=msg))
-  return errors
-
-
-def main():
-  options, args = checkpkg.GetOptions()
-  md5sums = args
-  # CheckpkgManager class abstracts away things such as the collection of
-  # results.
-  check_manager = checkpkg.CheckpkgManager(CHECKPKG_MODULE_NAME,
-                                           options.stats_basedir,
-                                           md5sums,
-                                           options.debug)
-  check_manager.RegisterIndividualCheck(CheckObsoleteDeps)
-  # Running the checks, reporting and exiting.
-  exit_code, screen_report, tags_report = check_manager.Run()
-  f = open(options.output, "w")
-  f.write(tags_report)
-  f.close()
-  print screen_report.strip()
-  sys.exit(exit_code)
-
-
-if __name__ == '__main__':
-  main()

Modified: csw/mgar/gar/v2/lib/python/package_checks.py
===================================================================
--- csw/mgar/gar/v2/lib/python/package_checks.py	2010-03-14 11:11:22 UTC (rev 9157)
+++ csw/mgar/gar/v2/lib/python/package_checks.py	2010-03-14 11:12:57 UTC (rev 9158)
@@ -14,6 +14,7 @@
 import re
 import os
 import checkpkg
+import opencsw
 from Cheetah import Template
 
 PATHS_ALLOWED_ONLY_IN = {
@@ -26,6 +27,18 @@
     "CSWtexinfp": ["/opt/csw/share/info/dir"],
 }
 MAX_DESCRIPTION_LENGTH = 100
+LICENSE_TMPL = "/opt/csw/share/doc/%s/license"
+OBSOLETE_DEPS = {
+    # "CSWfoo": {
+    #   "hint": "Do this...",
+    #   "url": "http://www.opencsw.org/bugtrack/view.php?id=..."
+    # },
+    "CSWpython-rt": {
+      "hint": "CSWpython-rt is deprecated, use CSWpython instead.",
+      "url": "http://www.opencsw.org/bugtrack/view.php?id=4031"
+    },
+}
+ARCH_RE = re.compile(r"(sparcv(8|9)|i386|amd64)")
 
 
 def CatalognameLowercase(pkg_data, error_mgr, logger):
@@ -246,3 +259,91 @@
   for depname, dep_desc in pkg_data["depends"]:
     if depname == pkgname:
       error_mgr.ReportError("depends-on-self")
+
+def CheckArchitectureSanity(pkg_data, error_mgr, logger):
+  basic_stats = pkg_data["basic_stats"]
+  pkgname = basic_stats["pkgname"]
+  pkginfo = pkg_data["pkginfo"]
+  filename = basic_stats["pkg_basename"]
+  arch = pkginfo["ARCH"]
+  filename_re = r"-%s-" % arch
+  if not re.search(filename_re, filename):
+    error_mgr.ReportError("srv4-filename-architecture-mismatch", arch)
+
+
+def CheckActionClasses(pkg_data, error_mgr, logger):
+  """Checks the consistency between classes in the prototype and pkginfo."""
+  pkginfo = pkg_data["pkginfo"]
+  pkgmap = pkg_data["pkgmap"]
+  pkginfo_classes = set(re.split(opencsw.WS_RE, pkginfo["CLASSES"]))
+  pkgmap_classes = set()
+  for entry in pkgmap:
+    if entry["class"]:  # might be None
+      pkgmap_classes.add(entry["class"])
+  only_in_pkginfo = pkginfo_classes.difference(pkgmap_classes)
+  only_in_pkgmap = pkgmap_classes.difference(pkginfo_classes)
+  for action_class in only_in_pkginfo:
+    error_mgr.ReportError("action-class-only-in-pkginfo", action_class)
+  for action_class in only_in_pkgmap:
+    error_mgr.ReportError("action-class-only-in-pkgmap", action_class)
+
+
+def CheckLicenseFile(pkg_data, error_mgr, logger):
+  """Checks for the presence of the license file."""
+  # TODO: Write a unit test
+  pkgmap = pkg_data["pkgmap"]
+  catalogname = pkg_data["basic_stats"]["catalogname"]
+  license_path = LICENSE_TMPL % catalogname
+  pkgmap_paths = [x["path"] for x in pkgmap]
+  if license_path not in pkgmap_paths:
+    error_mgr.ReportError("license-missing")
+    logger.info("See http://sourceforge.net/apps/trac/gar/wiki/CopyRight")
+
+def CheckObsoleteDeps(pkg_data, error_mgr, logger):
+  """Checks for obsolete dependencies."""
+  deps = set(pkg_data["depends"])
+  obsolete_pkg_deps = deps.intersection(set(OBSOLETE_DEPS))
+  if obsolete_pkg_deps:
+    for obsolete_pkg in obsolete_pkg_deps:
+      error_mgr.ReportError("obsolete-dependency", obsolete_pkg)
+      msg = ""
+      if "hint" in OBSOLETE_DEPS[obsolete_pkg]:
+        msg += "Hint: %s" % OBSOLETE_DEPS[obsolete_pkg]["hint"]
+      if "url" in OBSOLETE_DEPS[obsolete_pkg]:
+        if msg:
+          msg += ", "
+        msg += "URL: %s" % OBSOLETE_DEPS[obsolete_pkg]["url"]
+      if not msg:
+        msg = None
+      logger.info(msg)
+
+
+def CheckArchitectureVsContents(pkg_data, error_mgr, logger):
+  """Verifies the relationship between package contents and architecture."""
+  binaries = pkg_data["binaries"]
+  pkginfo = pkg_data["pkginfo"]
+  pkgmap = pkg_data["pkgmap"]
+  arch = pkginfo["ARCH"]
+  pkgname = pkg_data["basic_stats"]["pkgname"]
+  reasons_to_be_arch_specific = []
+  pkgmap_paths = [x["path"] for x in pkgmap]
+  for pkgmap_path in pkgmap_paths:
+    if re.search(ARCH_RE, str(pkgmap_path)):
+      reasons_to_be_arch_specific.append((
+          "archall-with-arch-paths",
+          pkgmap_path,
+          "path %s looks arch-specific" % pkgmap_path))
+  for binary in binaries:
+    reasons_to_be_arch_specific.append((
+        "archall-with-binaries",
+        binary,
+        "package contains binary %s" % binary))
+  if arch == "all":
+    for tag, param, desc in reasons_to_be_arch_specific:
+      error_mgr.ReportError(tag, param, desc)
+  elif not reasons_to_be_arch_specific:
+    logger.info("Package %s does not contain any binaries.", pkgname)
+    logger.info("Consider making it ARCHALL = 1 instead of %s:", arch)
+    logger.info("ARCHALL_%s = 1", pkgname)
+    logger.info("However, be aware that there might be other reasons "
+                "to keep it architecture-specific.")

Modified: csw/mgar/gar/v2/lib/python/package_checks_old.py
===================================================================
--- csw/mgar/gar/v2/lib/python/package_checks_old.py	2010-03-14 11:11:22 UTC (rev 9157)
+++ csw/mgar/gar/v2/lib/python/package_checks_old.py	2010-03-14 11:12:57 UTC (rev 9158)
@@ -7,8 +7,6 @@
 import checkpkg
 import re
 
-ARCH_RE = re.compile(r"(sparcv(8|9)|i386|amd64)")
-
 MAX_CATALOGNAME_LENGTH = 20
 MAX_PKGNAME_LENGTH = 20
 ARCH_LIST = ["sparc", "i386", "all"]
@@ -126,55 +124,6 @@
   return errors
 
 
-def ArchitectureSanity(pkg_data, debug):
-  errors = []
-  basic_stats = pkg_data["basic_stats"]
-  pkgname = basic_stats["pkgname"]
-  pkginfo = pkg_data["pkginfo"]
-  filename = basic_stats["pkg_basename"]
-  arch = pkginfo["ARCH"]
-  filename_re = r"-%s-" % arch
-  if not re.search(filename_re, filename):
-    errors.append(checkpkg.CheckpkgTag(
-      pkgname, "srv4-filename-architecture-mismatch", arch))
-  return errors
-
-
-def CheckArchitectureVsContents(pkg_data, debug):
-  """Verifies the relationship between package contents and architecture."""
-  errors = []
-  binaries = pkg_data["binaries"]
-  pkginfo = pkg_data["pkginfo"]
-  pkgmap = pkg_data["pkgmap"]
-  arch = pkginfo["ARCH"]
-  pkgname = pkg_data["basic_stats"]["pkgname"]
-  reasons_to_be_arch_specific = []
-  pkgmap_paths = [x["path"] for x in pkgmap]
-  for pkgmap_path in pkgmap_paths:
-    if re.search(ARCH_RE, str(pkgmap_path)):
-      reasons_to_be_arch_specific.append((
-          "archall-with-arch-paths",
-          pkgmap_path,
-          "path %s looks arch-specific" % pkgmap_path))
-  for binary in binaries:
-    reasons_to_be_arch_specific.append((
-        "archall-with-binaries",
-        binary,
-        "package contains binary %s" % binary))
-  if arch == "all":
-    for tag, param, desc in reasons_to_be_arch_specific:
-      errors.append(checkpkg.CheckpkgTag(pkgname, tag, param))
-  elif not reasons_to_be_arch_specific:
-    # This is not a clean way of handling messages for the user, but there's
-    # not better way at the moment.
-    print "Package %s does not contain any binaries." % pkgname
-    print "Consider making it ARCHALL = 1 instead of %s:" % arch
-    print "ARCHALL_%s = 1" % pkgname
-    print ("However, be aware that there might be other reasons "
-           "to keep it architecture-specific.")
-  return errors
-
-
 def CheckForMissingSymbols(pkgs_data, debug):
   """Analyzes missing symbols reported by ldd -r.
 

Modified: csw/mgar/gar/v2/lib/python/package_checks_old_test.py
===================================================================
--- csw/mgar/gar/v2/lib/python/package_checks_old_test.py	2010-03-14 11:11:22 UTC (rev 9157)
+++ csw/mgar/gar/v2/lib/python/package_checks_old_test.py	2010-03-14 11:12:57 UTC (rev 9158)
@@ -51,13 +51,6 @@
     errors = pc.FileNameSanity(self.pkg_data_2, False)
     self.failUnless(errors)
 
-  def testCheckArchitectureVsContents(self):
-    self.pkg_data_2["pkgmap"] = self.LoadData("example-1-pkgmap")
-    self.pkg_data_2["binaries"] = []
-    self.pkg_data_2["pkginfo"] = self.LoadData("example-1-pkginfo")
-    errors = pc.CheckArchitectureVsContents(self.pkg_data_2, False)
-    self.failIf(errors)
-
   def testCheckForMissingSymbols(self):
     ldd_dash_r_yml = """opt/csw/lib/postgresql/8.4/_int.so:
 - {path: /usr/lib/libc.so.1, soname: libc.so.1, state: OK, symbol: null}
@@ -103,12 +96,5 @@
     self.failUnless(errors)
 
 
-  def testArchitectureSanity(self):
-    self.pkg_data_2["pkginfo"] = {}
-    self.pkg_data_2["pkginfo"]["ARCH"] = "i386"
-    errors = pc.ArchitectureSanity(self.pkg_data_2, False)
-    self.failUnless(errors)
-
-
 if __name__ == '__main__':
   unittest.main()

Modified: csw/mgar/gar/v2/lib/python/package_checks_test.py
===================================================================
--- csw/mgar/gar/v2/lib/python/package_checks_test.py	2010-03-14 11:11:22 UTC (rev 9157)
+++ csw/mgar/gar/v2/lib/python/package_checks_test.py	2010-03-14 11:12:57 UTC (rev 9158)
@@ -174,5 +174,24 @@
     self.error_mgr_mock.ReportError('depends-on-self')
 
 
+class TestCheckArchitectureSanity(CheckpkgUnitTestHelper, unittest.TestCase):
+  FUNCTION_NAME = 'CheckArchitectureSanity'
+  def CheckpkgTest(self):
+    self.pkg_data["pkginfo"]["ARCH"] = "i386"
+    self.error_mgr_mock.ReportError('srv4-filename-architecture-mismatch', 'i386')
+
+class TestCheckArchitectureVsContents(CheckpkgUnitTestHelper, unittest.TestCase):
+  FUNCTION_NAME = 'CheckArchitectureVsContents'
+  def CheckpkgTest(self):
+    # TODO: Update this.
+    # self.pkg_data["pkgmap"] = self.LoadData("example-1-pkgmap")
+    # self.pkg_data["binaries"] = []
+    # self.pkg_data["pkginfo"] = self.LoadData("example-1-pkginfo")
+    # errors = pc.CheckArchitectureVsContents(self.pkg_data_2, False)
+    # self.failIf(errors)
+    pass
+
+
+
 if __name__ == '__main__':
   unittest.main()


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