[csw-devel] SF.net SVN: gar:[7723] csw/mgar/gar/v2-checkpkg/bin

wahwah at users.sourceforge.net wahwah at users.sourceforge.net
Wed Dec 23 15:59:17 CET 2009


Revision: 7723
          http://gar.svn.sourceforge.net/gar/?rev=7723&view=rev
Author:   wahwah
Date:     2009-12-23 14:59:16 +0000 (Wed, 23 Dec 2009)

Log Message:
-----------
mGAR v2-checkpkg: First sketch -- runs executables from the checkpkg.d directory.

Modified Paths:
--------------
    csw/mgar/gar/v2-checkpkg/bin/checkpkg

Added Paths:
-----------
    csw/mgar/gar/v2-checkpkg/bin/checkpkg.d/
    csw/mgar/gar/v2-checkpkg/bin/checkpkg.d/checkpkg-dummy.py
    csw/mgar/gar/v2-checkpkg/bin/checkpkg.d/checkpkg-libs.py
    csw/mgar/gar/v2-checkpkg/bin/checkpkg.d/checkpkg.py

Property Changed:
----------------
    csw/mgar/gar/v2-checkpkg/bin/checkpkg

Modified: csw/mgar/gar/v2-checkpkg/bin/checkpkg
===================================================================
--- csw/mgar/gar/v2-checkpkg/bin/checkpkg	2009-12-23 14:38:35 UTC (rev 7722)
+++ csw/mgar/gar/v2-checkpkg/bin/checkpkg	2009-12-23 14:59:16 UTC (rev 7723)
@@ -1,6 +1,13 @@
 #!/bin/ksh -p
-
-# checkpkg 1.50 (diff to 1.46a: check multiple package files)
+# 
+# $Id$
+#
+# checkpkg 1.51
+#
+# diff to 1.46a
+#  - check multiple package files
+#  - checkpkg.d plugin support
+#
 # This script examines a package that has been put together
 # for submittal to the CSW archive at opencsw.org
 #
@@ -443,13 +450,12 @@
 	exit 1
 fi
 
-# Verify that there are no double depends
+# Verify that there are no multiple depends
 repeated_depends="$(awk '{print $2}' $EXTRACTDIR/$pkgname/install/depend \
   | sort | uniq -c | awk '{print $1}' | sort | uniq | wc -l)"
 if [[ "$repeated_depends" -gt 1 ]]; then
         cat $EXTRACTDIR/$pkgname/install/depend
-        print ERROR: $pkgname has double depends
-        exit 1
+        errmsg "$pkgname has multiple depends"
 fi
 
 #to retain a record of all packages currently being examined from $@
@@ -530,7 +536,35 @@
 	fi
 fi
 
+# Plugin section.
+#
+# Plugins should live in checkpkg.d subdirectory in the same directory in which
+# checkpkg is.  Each plugin file name should be an executable and begin with
+# "checkpkg-".
 
+echo "Running the experimental plugin infrastructure."
+checkpkg_scriptname=`basename $0`
+checkpkg_basedir=${0%/${checkpkg_scriptname}}
+plugindir=${checkpkg_basedir}/checkpkg.d
+echo "plugindir: '$plugindir'"
+if [[ -d "$plugindir" ]]; then
+	# echo plugin dir exists
+	for plugin in "${plugindir}"/checkpkg-*; do
+		if [[ -x "${plugin}" ]]; then
+			echo "Executing: '${plugin} -e \"${EXTRACTDIR}\" -p \"${pkgname}\"'"
+			${plugin} -e "${EXTRACTDIR}" -p "${pkgname}"
+			if [[ "$?" -ne 0 ]]; then
+				errmsg "Plugin ${plugin} has returned an error."
+			fi
+		else
+			echo "'${plugin}' is not executable"
+		fi
+	done
+else
+	echo plugin dir does not exist
+fi
+# End of plugin section
+
 cleanup
 
 print ""


Property changes on: csw/mgar/gar/v2-checkpkg/bin/checkpkg
___________________________________________________________________
Added: svn:keywords
   + Id

Added: csw/mgar/gar/v2-checkpkg/bin/checkpkg.d/checkpkg-dummy.py
===================================================================
--- csw/mgar/gar/v2-checkpkg/bin/checkpkg.d/checkpkg-dummy.py	                        (rev 0)
+++ csw/mgar/gar/v2-checkpkg/bin/checkpkg.d/checkpkg-dummy.py	2009-12-23 14:59:16 UTC (rev 7723)
@@ -0,0 +1,17 @@
+#!/opt/csw/bin/python2.6
+# $Id$
+
+import checkpkg
+import os.path
+
+def main():
+  options, args = checkpkg.GetOptions()
+  pkgpath = os.path.join(options.extractdir, options.pkgname)
+  if not os.path.isdir(pkgpath):
+  	raise checkpkg.PackageError("The package directory doesn't exist: %s" % pkgpath)
+  print ("Dummy plugin says the package %s is extracted to %s"
+         % (options.pkgname, options.extractdir))
+
+
+if __name__ == '__main__':
+	main()


Property changes on: csw/mgar/gar/v2-checkpkg/bin/checkpkg.d/checkpkg-dummy.py
___________________________________________________________________
Added: svn:executable
   + *
Added: svn:keywords
   + Id

Added: csw/mgar/gar/v2-checkpkg/bin/checkpkg.d/checkpkg-libs.py
===================================================================
--- csw/mgar/gar/v2-checkpkg/bin/checkpkg.d/checkpkg-libs.py	                        (rev 0)
+++ csw/mgar/gar/v2-checkpkg/bin/checkpkg.d/checkpkg-libs.py	2009-12-23 14:59:16 UTC (rev 7723)
@@ -0,0 +1,16 @@
+#!/opt/csw/bin/python2.6
+#
+# $Id$
+#
+# A check for dependencies between shared libraries.
+
+import checkpkg
+import os.path
+
+def main():
+  options, args = checkpkg.GetOptions()
+  pkgpath = os.path.join(options.extractdir, options.pkgname)
+
+
+if __name__ == '__main__':
+	main()


Property changes on: csw/mgar/gar/v2-checkpkg/bin/checkpkg.d/checkpkg-libs.py
___________________________________________________________________
Added: svn:keywords
   + Id

Added: csw/mgar/gar/v2-checkpkg/bin/checkpkg.d/checkpkg.py
===================================================================
--- csw/mgar/gar/v2-checkpkg/bin/checkpkg.d/checkpkg.py	                        (rev 0)
+++ csw/mgar/gar/v2-checkpkg/bin/checkpkg.d/checkpkg.py	2009-12-23 14:59:16 UTC (rev 7723)
@@ -0,0 +1,22 @@
+# This is a checkpkg library, common for all checkpkg tests written in Python.
+
+import optparse
+
+class Error(Exception):
+  pass
+
+class ConfigurationError(Error):
+  pass
+
+def GetOptions():
+  parser = optparse.OptionParser()
+  parser.add_option("-e", dest="extractdir",
+                    help="The directory into which the package has been extracted")
+  parser.add_option("-p", dest="pkgname",
+                    help="The pkgname, e.g. CSWfoo")
+  (options, args) = parser.parse_args()
+  if not options.extractdir:
+    raise ConfigurationError("ERROR: -e option is missing.")
+  if not options.pkgname:
+    raise ConfigurationError("ERROR: -p option is missing.")
+  return options, args


Property changes on: csw/mgar/gar/v2-checkpkg/bin/checkpkg.d/checkpkg.py
___________________________________________________________________
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