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

wahwah at users.sourceforge.net wahwah at users.sourceforge.net
Thu Jan 28 22:18:34 CET 2010


Revision: 8215
          http://gar.svn.sourceforge.net/gar/?rev=8215&view=rev
Author:   wahwah
Date:     2010-01-28 21:18:33 +0000 (Thu, 28 Jan 2010)

Log Message:
-----------
mGAR v2: checkpkg, don't error out on surplus classes in pkginfo; allow to override the max length of the pkgname

Modified Paths:
--------------
    csw/mgar/gar/v2/bin/checkpkg
    csw/mgar/gar/v2/bin/checkpkg.d/checkpkg-actionclasses.py
    csw/mgar/gar/v2/lib/python/checkpkg.py
    csw/mgar/gar/v2/lib/python/opencsw.py

Modified: csw/mgar/gar/v2/bin/checkpkg
===================================================================
--- csw/mgar/gar/v2/bin/checkpkg	2010-01-28 19:57:31 UTC (rev 8214)
+++ csw/mgar/gar/v2/bin/checkpkg	2010-01-28 21:18:33 UTC (rev 8215)
@@ -23,6 +23,7 @@
 
 
 PATH=$PATH:/usr/sbin
+readonly NAME_MAX_LENGTH=${NAME_MAX_LENGTH:-20}
 
 LOCAL_ARCH=`uname -p`
 if [[ -z "${CHECKPKG_TMPDIR}" ]]; then
@@ -262,8 +263,8 @@
 	print basedir="'$basedir'"
 fi
 
-if [[ ${#software} -gt 20 ]] ; then errmsg $f: software name greater than 20 chars ; fi
-if [[ ${#pkgname} -gt 20 ]] ; then errmsg $f: pkg name greater than 20 chars; fi
+if [[ ${#software} -gt ${NAME_MAX_LENGTH} ]] ; then errmsg $f: software name greater than 20 chars ; fi
+if [[ ${#pkgname} -gt ${NAME_MAX_LENGTH} ]] ; then errmsg $f: pkg name greater than 20 chars; fi
 
 if [ "$software" = "" ] ; then errmsg $f: software field not set properly in NAME ; fi
 if [ "$pkgname" = "" ] ; then errmsg $f: pkgname field blank ; fi

Modified: csw/mgar/gar/v2/bin/checkpkg.d/checkpkg-actionclasses.py
===================================================================
--- csw/mgar/gar/v2/bin/checkpkg.d/checkpkg-actionclasses.py	2010-01-28 19:57:31 UTC (rev 8214)
+++ csw/mgar/gar/v2/bin/checkpkg.d/checkpkg-actionclasses.py	2010-01-28 21:18:33 UTC (rev 8215)
@@ -30,16 +30,14 @@
   only_in_pkginfo = pkginfo_classes.difference(pkgmap_classes)
   only_in_pkgmap = pkgmap_classes.difference(pkginfo_classes)
   for cls in only_in_pkginfo:
-  	errors.append(
-  	    opencsw.PackageError("Class %s is only in pkginfo" % repr(cls)))
+    print "Class %s of %s is only in pkginfo" % (repr(cls), pkg.pkgname)
+    print "This shouldn't cause any problems, but it might be not necessary."
   for cls in only_in_pkgmap:
-  	errors.append(
-  	    opencsw.PackageError("Class %s is only in pkgmap" % repr(cls)))
+    errors.append(
+        opencsw.PackageError("Class %s is only in pkgmap" % repr(cls)))
   if only_in_pkginfo or only_in_pkgmap:
-  	errors.append(
-        opencsw.PackageError(
-            "pkginfo_classes: %s, pkgmap classes: %s" % (
-                pkginfo_classes, pkgmap_classes)))
+    print ("pkginfo_classes: %s, pkgmap classes: %s"
+           % (pkginfo_classes, pkgmap_classes))
   return errors
 
 

Modified: csw/mgar/gar/v2/lib/python/checkpkg.py
===================================================================
--- csw/mgar/gar/v2/lib/python/checkpkg.py	2010-01-28 19:57:31 UTC (rev 8214)
+++ csw/mgar/gar/v2/lib/python/checkpkg.py	2010-01-28 21:18:33 UTC (rev 8215)
@@ -68,9 +68,12 @@
 
 ERROR_REPORT_TMPL = u"""#if $errors
 ERROR: One or more errors have been found by $name.
-#for $error in $errors
-$repr($error)
+#for $pkgname in $errors
+$pkgname:
+#for $error in $errors[$pkgname]
+  $repr($error)
 #end for
+#end for
 #else
 #if $debug
 OK: $name found no problems.
@@ -595,16 +598,20 @@
     Returns a tuple of an exit code and a report.
     """
     packages = []
-    errors = []
+    errors = {}
     for pkgname in self.pkgname_list:
         pkg_path = os.path.join(self.extractdir, pkgname)
         packages.append(opencsw.DirectoryFormatPackage(pkg_path))
     for pkg in packages:
       for function in self.individual_checks:
-        errors.extend(function(pkg))
+        errors_for_pkg = function(pkg)
+        if errors_for_pkg:
+          errors[pkg.pkgname] = errors_for_pkg
     # Set checks
     for function in self.set_checks:
-        errors.extend(function(packages))
+      set_errors = function(packages)
+      if set_errors:
+        errors["The package set"] = set_errors
     namespace = {
         "name": self.name,
         "errors": errors,

Modified: csw/mgar/gar/v2/lib/python/opencsw.py
===================================================================
--- csw/mgar/gar/v2/lib/python/opencsw.py	2010-01-28 19:57:31 UTC (rev 8214)
+++ csw/mgar/gar/v2/lib/python/opencsw.py	2010-01-28 21:18:33 UTC (rev 8215)
@@ -522,6 +522,7 @@
 
   def __init__(self, directory):
     self.directory = directory
+    self.pkgname = os.path.split(directory)[1]
     self.pkginfo_dict = None
 
   def GetParsedPkginfo(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