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

wahwah at users.sourceforge.net wahwah at users.sourceforge.net
Sat Mar 20 13:35:10 CET 2010


Revision: 9284
          http://gar.svn.sourceforge.net/gar/?rev=9284&view=rev
Author:   wahwah
Date:     2010-03-20 12:35:10 +0000 (Sat, 20 Mar 2010)

Log Message:
-----------
mGAR v2: checkpkg, moving ErrorTagsFromFile to the checkpkg library. Ability to use md5sums from a catalog file.

Modified Paths:
--------------
    csw/mgar/gar/v2/bin/analyze_module_results.py
    csw/mgar/gar/v2/bin/checkpkg
    csw/mgar/gar/v2/lib/python/checkpkg.py
    csw/mgar/gar/v2/lib/python/package_checks.py

Modified: csw/mgar/gar/v2/bin/analyze_module_results.py
===================================================================
--- csw/mgar/gar/v2/bin/analyze_module_results.py	2010-03-20 12:25:35 UTC (rev 9283)
+++ csw/mgar/gar/v2/bin/analyze_module_results.py	2010-03-20 12:35:10 UTC (rev 9284)
@@ -26,13 +26,8 @@
   files = os.listdir(options.extractdir)
   error_tags = []
   for file_name in files:
-    if file_name.startswith("tags."):
-      fd = open(os.path.join(options.extractdir, file_name))
-      for line in fd:
-        if line.startswith("#"):
-          continue
-        pkgname, tag_name, tag_info = checkpkg.ParseTagLine(line)
-        error_tags.append(checkpkg.CheckpkgTag(pkgname, tag_name, tag_info))
+    full_path = os.path.join(options.extractdir, file_name)
+    error_tags.extend(checkpkg.ErrorTagsFromFile(full_path))
   overrides = reduce(lambda x, y: x + y, overrides_list)
   (tags_after_overrides,
    unapplied_overrides) = checkpkg.ApplyOverrides(error_tags, overrides)

Modified: csw/mgar/gar/v2/bin/checkpkg
===================================================================
--- csw/mgar/gar/v2/bin/checkpkg	2010-03-20 12:25:35 UTC (rev 9283)
+++ csw/mgar/gar/v2/bin/checkpkg	2010-03-20 12:35:10 UTC (rev 9284)
@@ -10,7 +10,7 @@
 #  - getopts support for command line options
 #  - colors
 #  - modular architecture + unit tests
-#  - 
+#  - reliable shared library checking
 #
 # This script examines a package that has been put together
 # for submittal to the CSW archive at opencsw.org
@@ -24,9 +24,8 @@
 # Be sure to occasionally do a "pkg-get update cswutils" so that
 # you know you are tracking the most current version.
 # 
-# TODOs before commit:
-#  - bad strings check
-#  - pkgchk run
+# TODO:
+# - add message handlig to the CheckInterface class.
 #
 
 PATH=$PATH:/usr/sbin
@@ -97,6 +96,7 @@
 	cleanup
 	cleanupset
 	print "To run checkpkg in the debug mode, add the '-d' flag, for example:"
+  # selfargs can be very, very long. Find a way to truncate it.
 	# print "${selfpath} -d ${selfargs}"
 	print "After you modify any overrides, you need to do gmake remerge repackage"
 	print "or gmake platforms-remerge platforms-repackage."
@@ -252,8 +252,15 @@
 module_name_format="%-40s"
 # TODO: A performance problem. The following line means that the md5sums are
 # calculated once more.
-debugmsg "Calculating md5 sums of all the package files."
-md5sums=`gmd5sum "$@" | awk '{print $1}'`
+if [ "${MD5_SUMS_CATALOG_FILE}" ]; then
+	debugmsg "Reading md5sums from ${MD5_SUMS_CATALOG_FILE}"
+	md5sums=`cat "${MD5_SUMS_CATALOG_FILE}" \
+	    | awk '{print $5}' \
+	    | ggrep -E '[0-9abcdef]{32}'`
+else
+  debugmsg "Calculating md5 sums of all the package files."
+  md5sums=`gmd5sum "$@" | awk '{print $1}'`
+fi
 debugmsg "All md5 sums: ${md5sums}"
 if [[ -d "${checkpkg_module_dir}" ]]; then
 	for plugin in "${checkpkg_module_dir}/${checkpkg_module_tag}"*; do

Modified: csw/mgar/gar/v2/lib/python/checkpkg.py
===================================================================
--- csw/mgar/gar/v2/lib/python/checkpkg.py	2010-03-20 12:25:35 UTC (rev 9283)
+++ csw/mgar/gar/v2/lib/python/checkpkg.py	2010-03-20 12:35:10 UTC (rev 9284)
@@ -477,7 +477,11 @@
 
 
 def GuessDepsByFilename(pkgname, pkg_by_any_filename):
-  """Guesses dependencies based on filename regexes."""
+  """Guesses dependencies based on filename regexes.
+
+  This function is still inefficient.  It should be getting better data
+  structures to work with.
+  """
   guessed_deps = set()
   patterns = [(re.compile(x), y) for x, y in DEPENDENCY_FILENAME_REGEXES]
   filenames = []
@@ -1386,3 +1390,14 @@
     else:
       raise StdoutSyntaxError("Could not parse %s" % repr(line))
     return response
+
+
+def ErrorTagsFromFile(file_name):
+  fd = open(file_name)
+  error_tags = []
+  for line in fd:
+    if line.startswith("#"):
+      continue
+    pkgname, tag_name, tag_info = ParseTagLine(line)
+    error_tags.append(CheckpkgTag(pkgname, tag_name, tag_info))
+  return error_tags

Modified: csw/mgar/gar/v2/lib/python/package_checks.py
===================================================================
--- csw/mgar/gar/v2/lib/python/package_checks.py	2010-03-20 12:25:35 UTC (rev 9283)
+++ csw/mgar/gar/v2/lib/python/package_checks.py	2010-03-20 12:35:10 UTC (rev 9284)
@@ -224,9 +224,9 @@
     print
 
   dependent_pkgs = {}
-  for checker in pkgs_data:
-    pkgname = checker["basic_stats"]["pkgname"]
-    declared_dependencies = dict(checker["depends"])
+  for pkg_data in pkgs_data:
+    pkgname = pkg_data["basic_stats"]["pkgname"]
+    declared_dependencies = dict(pkg_data["depends"])
     missing_deps, surplus_deps, orphan_sonames = checkpkg.AnalyzeDependencies(
         pkgname,
         declared_dependencies,


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