[csw-devel] SF.net SVN: gar:[8546] csw/mgar/gar/v2-checkpkg-stats

wahwah at users.sourceforge.net wahwah at users.sourceforge.net
Mon Feb 15 01:02:41 CET 2010


Revision: 8546
          http://gar.svn.sourceforge.net/gar/?rev=8546&view=rev
Author:   wahwah
Date:     2010-02-15 00:02:41 +0000 (Mon, 15 Feb 2010)

Log Message:
-----------
mGAR v2-checkpkg-stats: Using own pkgtrans code, it works now.  Next thing to do: port existing checks to use the yaml data.

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

Modified: csw/mgar/gar/v2-checkpkg-stats/bin/checkpkg_collect_stats.py
===================================================================
--- csw/mgar/gar/v2-checkpkg-stats/bin/checkpkg_collect_stats.py	2010-02-14 23:24:26 UTC (rev 8545)
+++ csw/mgar/gar/v2-checkpkg-stats/bin/checkpkg_collect_stats.py	2010-02-15 00:02:41 UTC (rev 8546)
@@ -123,13 +123,14 @@
 
 
 def main():
+  debug = True
   logging.basicConfig(level=logging.DEBUG)
   parser = optparse.OptionParser()
   options, args = parser.parse_args()
   logging.basicConfig(level=logging.INFO)
   logging.info("Collecting statistics about given package files.")
   logging.debug("args: %s", args)
-  packages = [opencsw.CswSrv4File(x) for x in args]
+  packages = [opencsw.CswSrv4File(x, debug) for x in args]
   stats_list = [PackageStats(pkg) for pkg in packages]
   for pkg_stats in stats_list:
   	pkg_stats.CollectStats()

Modified: csw/mgar/gar/v2-checkpkg-stats/lib/python/opencsw.py
===================================================================
--- csw/mgar/gar/v2-checkpkg-stats/lib/python/opencsw.py	2010-02-14 23:24:26 UTC (rev 8545)
+++ csw/mgar/gar/v2-checkpkg-stats/lib/python/opencsw.py	2010-02-15 00:02:41 UTC (rev 8546)
@@ -360,12 +360,13 @@
 class CswSrv4File(ShellMixin, object):
   """Represents a package in the srv4 format (pkg)."""
 
-  def __init__(self, pkg_path):
+  def __init__(self, pkg_path, debug=False):
     self.pkg_path = pkg_path
     self.workdir = None
     self.gunzipped_path = None
     self.transformed = False
     self.dir_format_pkg = None
+    self.debug = debug
 
   def __repr__(self):
     return u"CswSrv4File(%s)" % repr(self.pkg_path)
@@ -417,13 +418,16 @@
   def TransformToDir(self):
     """Transforms the file to the directory format.
 
-    This could use the Pkgtrans command at the top, because pkgtrans supposedly
-    leaves temporary files behind.
+    This uses the Pkgtrans function at the top, because pkgtrans behaves
+    differently on Solaris 8 and 10.  Having our own implementation helps
+    achieve consistent behavior.
     """
     if not self.transformed:
-      args = ["pkgtrans", "-a", self.GetAdminFilePath(),
+      args = [os.path.join(os.path.dirname(__file__),
+                           "..", "..", "bin", "custom-pkgtrans"),
               self.GetGunzippedPath(), self.GetWorkDir(), "all"]
-      unused_retcode = self.ShellCommand(args, quiet=True)
+      print "args", args
+      unused_retcode = self.ShellCommand(args, quiet=(not self.debug))
       dirs = self.GetDirs()
       if len(dirs) != 1:
         raise Error("Need exactly one package in the package stream: "


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