[csw-devel] SF.net SVN: gar:[8340] csw/mgar/gar/v2/bin/checkpkg.d/checkpkg-archall.py
wahwah at users.sourceforge.net
wahwah at users.sourceforge.net
Thu Feb 4 02:53:29 CET 2010
Revision: 8340
http://gar.svn.sourceforge.net/gar/?rev=8340&view=rev
Author: wahwah
Date: 2010-02-04 01:53:28 +0000 (Thu, 04 Feb 2010)
Log Message:
-----------
mGAR v2: checkpkg, adding archall check.
Added Paths:
-----------
csw/mgar/gar/v2/bin/checkpkg.d/checkpkg-archall.py
Added: csw/mgar/gar/v2/bin/checkpkg.d/checkpkg-archall.py
===================================================================
--- csw/mgar/gar/v2/bin/checkpkg.d/checkpkg-archall.py (rev 0)
+++ csw/mgar/gar/v2/bin/checkpkg.d/checkpkg-archall.py 2010-02-04 01:53:28 UTC (rev 8340)
@@ -0,0 +1,52 @@
+#!/opt/csw/bin/python2.6
+# $Id$
+
+"""Verifies the architecture of the package."""
+
+import os.path
+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
+
+def CheckArchitectureVsContents(pkg):
+ """Verifies the relationship between package contents and architecture."""
+ errors = []
+ binaries = pkg.ListBinaries()
+ pkginfo = pkg.GetParsedPkginfo()
+ arch = pkginfo["ARCH"]
+ if binaries and arch == "all":
+ errors.append(checkpkg.PackageError(
+ "The package can't be ARCHALL = 1 and contain binaries."))
+ 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.
+ print "Package %s does not contain any binaries." % pkg.pkgname
+ print "Consider making it ARCHALL = 1 instead of %s:" % arch
+ print "ARCHALL_%s = 1" % pkg.pkgname
+ print ("However, be aware that there might be other reasons "
+ "to keep it architecture-specific.")
+ return errors
+
+
+def main():
+ options, args = checkpkg.GetOptions()
+ pkgnames = args
+ check_manager = checkpkg.CheckpkgManager(CHECKPKG_MODULE_NAME,
+ options.extractdir,
+ pkgnames,
+ options.debug)
+ check_manager.RegisterIndividualCheck(CheckArchitectureVsContents)
+ exit_code, report = check_manager.Run()
+ print report.strip()
+ sys.exit(exit_code)
+
+
+if __name__ == '__main__':
+ main()
Property changes on: csw/mgar/gar/v2/bin/checkpkg.d/checkpkg-archall.py
___________________________________________________________________
Added: svn:executable
+ *
Added: svn:keywords
+ Id
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