[csw-devel] SF.net SVN: gar:[8457] csw/mgar/gar/v2/bin/checkpkg.d/checkpkg-archall.py

wahwah at users.sourceforge.net wahwah at users.sourceforge.net
Wed Feb 10 14:22:17 CET 2010


Revision: 8457
          http://gar.svn.sourceforge.net/gar/?rev=8457&view=rev
Author:   wahwah
Date:     2010-02-10 13:22:17 +0000 (Wed, 10 Feb 2010)

Log Message:
-----------
mGAR v2: checkpkg-archall.py, recognize arch-specific paths as reasons to make packages arch-specific

Modified Paths:
--------------
    csw/mgar/gar/v2/bin/checkpkg.d/checkpkg-archall.py

Modified: csw/mgar/gar/v2/bin/checkpkg.d/checkpkg-archall.py
===================================================================
--- csw/mgar/gar/v2/bin/checkpkg.d/checkpkg-archall.py	2010-02-10 13:14:47 UTC (rev 8456)
+++ csw/mgar/gar/v2/bin/checkpkg.d/checkpkg-archall.py	2010-02-10 13:22:17 UTC (rev 8457)
@@ -5,6 +5,7 @@
 """Verifies the architecture of the package."""
 
 import os.path
+import re
 import sys
 
 CHECKPKG_MODULE_NAME = "architecture check"
@@ -16,16 +17,32 @@
 sys.path.append(os.path.join(*path_list))
 import checkpkg
 
+ARCH_RE = re.compile(r"(sparcv(8|9)|i386|amd64)")
+
 def CheckArchitectureVsContents(pkg, debug):
   """Verifies the relationship between package contents and architecture."""
   errors = []
   binaries = pkg.ListBinaries()
   pkginfo = pkg.GetParsedPkginfo()
+  pkgmap = pkg.GetPkgmap()
   arch = pkginfo["ARCH"]
-  if binaries and arch == "all":
-    for binary in binaries:
-    	errors.append(checkpkg.CheckpkgTag(pkg.pkgname, "archall-with-binaries"), binary)
-  elif not binaries and arch != "all":
+  reasons_to_be_arch_specific = []
+  for pkgmap_path in pkgmap.entries_by_path:
+    # print "pkgmap_path", repr(pkgmap_path), type(pkgmap_path)
+    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(pkg.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." % pkg.pkgname


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