[csw-devel] SF.net SVN: gar:[8574] csw/mgar/gar/v2-checkpkg-stats

wahwah at users.sourceforge.net wahwah at users.sourceforge.net
Tue Feb 16 11:46:33 CET 2010


Revision: 8574
          http://gar.svn.sourceforge.net/gar/?rev=8574&view=rev
Author:   wahwah
Date:     2010-02-16 10:46:33 +0000 (Tue, 16 Feb 2010)

Log Message:
-----------
mGAR v2-checkpkg-stats: checkpkg-libs.py seems to be working again! \o/

Modified Paths:
--------------
    csw/mgar/gar/v2-checkpkg-stats/bin/checkpkg.d/checkpkg-actionclasses.py
    csw/mgar/gar/v2-checkpkg-stats/bin/checkpkg.d/checkpkg-archall.py
    csw/mgar/gar/v2-checkpkg-stats/bin/checkpkg.d/checkpkg-libs.py
    csw/mgar/gar/v2-checkpkg-stats/bin/checkpkg.d/checkpkg-missing-symbols.py
    csw/mgar/gar/v2-checkpkg-stats/bin/checkpkg.d/checkpkg-obsolete-deps.py
    csw/mgar/gar/v2-checkpkg-stats/lib/python/checkpkg.py

Modified: csw/mgar/gar/v2-checkpkg-stats/bin/checkpkg.d/checkpkg-actionclasses.py
===================================================================
--- csw/mgar/gar/v2-checkpkg-stats/bin/checkpkg.d/checkpkg-actionclasses.py	2010-02-16 09:56:04 UTC (rev 8573)
+++ csw/mgar/gar/v2-checkpkg-stats/bin/checkpkg.d/checkpkg-actionclasses.py	2010-02-16 10:46:33 UTC (rev 8574)
@@ -36,7 +36,7 @@
   only_in_pkgmap = pkgmap_classes.difference(pkginfo_classes)
   for action_class in only_in_pkginfo:
     error = checkpkg.CheckpkgTag(
-        pkg.pkgname,
+        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.")

Modified: csw/mgar/gar/v2-checkpkg-stats/bin/checkpkg.d/checkpkg-archall.py
===================================================================
--- csw/mgar/gar/v2-checkpkg-stats/bin/checkpkg.d/checkpkg-archall.py	2010-02-16 09:56:04 UTC (rev 8573)
+++ csw/mgar/gar/v2-checkpkg-stats/bin/checkpkg.d/checkpkg-archall.py	2010-02-16 10:46:33 UTC (rev 8574)
@@ -24,7 +24,10 @@
   arch = pkginfo["ARCH"]
   if binaries and arch == "all":
     for binary in binaries:
-    	errors.append(checkpkg.CheckpkgTag(pkg.pkgname, "archall-with-binaries"), binary)
+    	errors.append(checkpkg.CheckpkgTag(
+    	  pkg_data["basic_stats"]["pkgname"],
+    	  "archall-with-binaries"),
+    	  binary)
   elif not binaries and arch != "all":
     # This is not a clean way of handling messages for the user, but there's
     # not better way at the moment.

Modified: csw/mgar/gar/v2-checkpkg-stats/bin/checkpkg.d/checkpkg-libs.py
===================================================================
--- csw/mgar/gar/v2-checkpkg-stats/bin/checkpkg.d/checkpkg-libs.py	2010-02-16 09:56:04 UTC (rev 8573)
+++ csw/mgar/gar/v2-checkpkg-stats/bin/checkpkg.d/checkpkg-libs.py	2010-02-16 10:46:33 UTC (rev 8574)
@@ -28,60 +28,32 @@
 import checkpkg
 import opencsw
 
-def CheckSharedLibraryConsistency(pkgs, debug):
+def CheckSharedLibraryConsistency(pkgs_data, debug):
+  ws_re = re.compile(r"\s+")
   result_ok = True
   errors = []
   binaries = []
   binaries_by_pkgname = {}
   sonames_by_pkgname = {}
   pkg_by_any_filename = {}
-  def MakeBinPathAbsolute(x):
-    return os.path.join(checker.directory, "root", x)
-  for checker in pkgs:
-    pkg_binary_paths = [MakeBinPathAbsolute(x) for x in checker.ListBinaries()]
-    binaries_base = [os.path.basename(x) for x in checker.ListBinaries()]
-    binaries_by_pkgname[checker.pkgname] = binaries_base
-    binaries.extend(pkg_binary_paths)
-    for filename in checker.GetAllFilenames():
-      pkg_by_any_filename[filename] = checker.pkgname
+  needed_sonames_by_binary = {}
+  filenames_by_soname = {}
+  for pkg_data in pkgs_data:
+    binaries_base = [os.path.basename(x) for x in pkg_data["binaries"]]
+    pkgname = pkg_data["basic_stats"]["pkgname"]
+    binaries_by_pkgname[pkgname] = binaries_base
+    binaries.extend(pkg_data["binaries"])
+    for filename in pkg_data["all_filenames"]:
+      pkg_by_any_filename[filename] = pkgname
+    for binary_data in pkg_data["binaries_dump_info"]:
+      binary_base_name = os.path.basename(binary_data["base_name"])
+      needed_sonames_by_binary[binary_base_name] = binary_data
+      filenames_by_soname[binary_data[checkpkg.SONAME]] = binary_base_name
+    
   # Making the binaries unique
   binaries = set(binaries)
-  ws_re = re.compile(r"\s+")
+  isalist = pkg_data["isalist"]
 
-  # man ld.so.1 for more info on this hack
-  env = copy.copy(os.environ)
-  env["LD_NOAUXFLTR"] = "1"
-  needed_sonames_by_binary = {}
-  filenames_by_soname = {}
-  # Assembling a data structure with the data about binaries.
-  # {
-  #   <binary1 name>: { checkpkg.NEEDED_SONAMES: [...],
-  #                     checkpkg.RUNPATH:        [...]},
-  #   <binary2 name>: ...,
-  #   ...
-  # }
-  #
-  # This bit to be replaced.
-  for binary in binaries:
-    # binary_base_name = binary.split("/")[-1]
-    binary_base_name = os.path.basename(binary)
-    args = [checkpkg.DUMP_BIN, "-Lv", binary]
-    dump_proc = subprocess.Popen(args, stdout=subprocess.PIPE, env=env)
-    stdout, stderr = dump_proc.communicate()
-    ret = dump_proc.wait()
-    binary_data = checkpkg.ParseDumpOutput(stdout)
-    needed_sonames_by_binary[binary_base_name] = binary_data
-    if checkpkg.SONAME not in binary_data:
-      logging.debug("The %s binary doesn't provide a SONAME. "
-                    "(It might be an executable)",
-                   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 = checkpkg.GetIsalist()
-
   # Building indexes by soname to simplify further processing
   # These are indexes "by soname".
   (needed_sonames,
@@ -149,10 +121,9 @@
     print
 
   dependent_pkgs = {}
-  for checker in pkgs:
-    pkgname = checker.pkgname
-    dir_format_pkg = opencsw.DirectoryFormatPackage(checker.pkgpath)
-    declared_dependencies = dir_format_pkg.GetDependencies()
+  for checker in pkgs_data:
+    pkgname = checker["basic_stats"]["pkgname"]
+    declared_dependencies = checker["depends"]
     if debug:
       sanitized_pkgname = pkgname.replace("-", "_")
       data_file_name = "/var/tmp/checkpkg_test_data_%s.py" % sanitized_pkgname
@@ -182,7 +153,7 @@
         filenames_by_soname,
         pkg_by_any_filename)
     namespace = {
-        "pkgname": checker.pkgname,
+        "pkgname": pkgname,
         "missing_deps": missing_deps,
         "surplus_deps": surplus_deps,
         "orphan_sonames": orphan_sonames,
@@ -197,20 +168,22 @@
             "orphan-soname",
             soname))
     for missing_dep in missing_deps:
-    	errors.append(
-    	    checkpkg.CheckpkgTag(
-    	      pkgname,
-    	      "missing-dependency",
-    	      missing_dep))
+      errors.append(
+          checkpkg.CheckpkgTag(
+            pkgname,
+            "missing-dependency",
+            missing_dep))
   return errors
 
 
 def main():
   options, args = checkpkg.GetOptions()
-  pkgnames = args
+  md5sums = args
+  # CheckpkgManager class abstracts away things such as the collection of
+  # results.
   check_manager = checkpkg.CheckpkgManager(CHECKPKG_MODULE_NAME,
-                                           options.extractdir,
-                                           pkgnames,
+                                           options.stats_basedir,
+                                           md5sums,
                                            options.debug)
 
   check_manager.RegisterSetCheck(CheckSharedLibraryConsistency)

Modified: csw/mgar/gar/v2-checkpkg-stats/bin/checkpkg.d/checkpkg-missing-symbols.py
===================================================================
--- csw/mgar/gar/v2-checkpkg-stats/bin/checkpkg.d/checkpkg-missing-symbols.py	2010-02-16 09:56:04 UTC (rev 8573)
+++ csw/mgar/gar/v2-checkpkg-stats/bin/checkpkg.d/checkpkg-missing-symbols.py	2010-02-16 10:46:33 UTC (rev 8574)
@@ -35,7 +35,9 @@
       	missing_symbols = True
     binary_base = os.path.basename(binary)
     if missing_symbols:
-    	errors.append(checkpkg.CheckpkgTag(pkg.pkgname, "symbol-not-found", binary_base))
+    	errors.append(checkpkg.CheckpkgTag(
+    	  pkg_data["basic_stats"]["pkgname"],
+    	  "symbol-not-found", binary_base))
   return errors
 
 

Modified: csw/mgar/gar/v2-checkpkg-stats/bin/checkpkg.d/checkpkg-obsolete-deps.py
===================================================================
--- csw/mgar/gar/v2-checkpkg-stats/bin/checkpkg.d/checkpkg-obsolete-deps.py	2010-02-16 09:56:04 UTC (rev 8573)
+++ csw/mgar/gar/v2-checkpkg-stats/bin/checkpkg.d/checkpkg-obsolete-deps.py	2010-02-16 10:46:33 UTC (rev 8574)
@@ -45,8 +45,9 @@
       if not msg:
         msg = None
       errors.append(
-          checkpkg.CheckpkgTag(pkg.pkgname, "obsolete-dependency",
-                               obsolete_pkg, msg=msg))
+          checkpkg.CheckpkgTag(
+    	      pkg_data["basic_stats"]["pkgname"],
+            "obsolete-dependency", obsolete_pkg, msg=msg))
   return errors
 
 

Modified: csw/mgar/gar/v2-checkpkg-stats/lib/python/checkpkg.py
===================================================================
--- csw/mgar/gar/v2-checkpkg-stats/lib/python/checkpkg.py	2010-02-16 09:56:04 UTC (rev 8573)
+++ csw/mgar/gar/v2-checkpkg-stats/lib/python/checkpkg.py	2010-02-16 10:46:33 UTC (rev 8574)
@@ -112,7 +112,7 @@
   parser = optparse.OptionParser()
   parser.add_option("-b", dest="stats_basedir",
                     help=("The base directory with package statistics "
-                          "in yaml format"))
+                          "in yaml format, e.g. ~/.checkpkg/stats"))
   parser.add_option("-d", "--debug", dest="debug",
                     default=False, action="store_true",
                     help="Turn on debugging messages")


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