[csw-devel] SF.net SVN: gar:[10751] csw/mgar/gar/v2/lib/python/pkgdb.py

wahwah at users.sourceforge.net wahwah at users.sourceforge.net
Mon Aug 16 13:32:27 CEST 2010


Revision: 10751
          http://gar.svn.sourceforge.net/gar/?rev=10751&view=rev
Author:   wahwah
Date:     2010-08-16 11:32:27 +0000 (Mon, 16 Aug 2010)

Log Message:
-----------
mGAR v2: pkgdb, improvements to the HTML template.

Modified Paths:
--------------
    csw/mgar/gar/v2/lib/python/pkgdb.py

Modified: csw/mgar/gar/v2/lib/python/pkgdb.py
===================================================================
--- csw/mgar/gar/v2/lib/python/pkgdb.py	2010-08-16 07:44:57 UTC (rev 10750)
+++ csw/mgar/gar/v2/lib/python/pkgdb.py	2010-08-16 11:32:27 UTC (rev 10751)
@@ -11,8 +11,10 @@
 import code
 import os
 import os.path
+import re
 import socket
 import sys
+import package_checks
 from Cheetah.Template import Template
 
 USAGE = """usage: %prog show errors <md5sum> [ ... ]
@@ -44,7 +46,7 @@
 <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
 <style type="text/css">
 body { font-family: sans-serif; }
-p, td, li { font-size: 11px; }
+p, td, th, li { font-size: 11px; }
 h1 { font-size: 16px; }
 h2 { font-size: 15px; }
 h3 { font-size: 14px; }
@@ -59,11 +61,33 @@
   font-family: monospace;
   background-color: #EEE;
 }
+span.warning {
+  background-color: #DDF;
+}
 </style>
 </head>
 <body>
 #for pkg in $pkgstats
   <h1>$pkg.basic_stats.pkg_basename</h1>
+  <h2>Build source code</h2>
+#if $pkg.build_src
+  <p>
+    <a href="$pkg.build_src">
+      $pkg.build_src
+    </a>
+  </p>
+#else
+  <p>
+    <span style="warning">
+      Build source (OPENCSW_REPOSITORY) not specified in pkginfo.
+    </span>
+  </p>
+#end if
+	<p>
+	  <a href="http://www.opencsw.org/packages/$pkg.basic_stats.pkgname/">
+	    $pkg.basic_stats.pkgname</a>
+	  on the website.
+	</p>
   <h2>Basic stats</h2>
   <table>
 #for key in ('md5_sum', 'pkgname', 'stats_version', 'pkg_basename', 'catalogname')
@@ -77,7 +101,7 @@
   </tr>
 #end for
   </table>
-  <p>parsed basename</p>
+  <h3>parsed basename</h3>
   <pre>
 $pprint.pformat($pkg.basic_stats.parsed_basename)
   </pre>
@@ -86,9 +110,9 @@
 #for key, val in $pkg.pkginfo.iteritems
   <tr>
   <td
-  style="border: 1px solid gray;"
+  style="border: 1px solid #DDD;"
   >$key</td>
-  <td style="font-family: monospace; border: 1px solid gray;"
+  <td style="font-family: monospace; border: 1px solid #DDD;"
   >$val</td>
   </tr>
 #end for
@@ -97,23 +121,48 @@
   <h2>binaries_dump_info</h2>
   <ul>
 #for bin in $pkg["binaries_dump_info"]
-	<li>
-	<strong>$bin.path</strong>
+  <li>
+  <strong>$bin.path</strong>
 ## ['base_name', 'RUNPATH RPATH the same', 'runpath', 'RPATH set', 'needed sonames', 'path', 'RUNPATH set']
-	<ul>
-  <li> runpath: <code>$bin.runpath</code> </li>
-	<li> needed sonames: <code>$bin["needed sonames"]</code> </li>
+  <ul>
+  <li>
+    base name: <code>$bin.base_name</code>
+  </li>
+  <li> runpath:
+    <ul>
+#for runpath_el in $bin.runpath
+      <li>
+        <code>
+            $runpath_el
+        </code>
+      </li>
+#end for
+    </ul>
+  <li> needed sonames:
+    <ul>
+#for soname in $bin["needed sonames"]
+      <li>
+        <code>
+          <a href="http://www.opencsw.org/packagesContainingFile/?fileName=$soname&searchsubmit=1">
+            $soname
+          </a>
+        </code>
+      </li>
+#end for
+    </ul>
   </ul>
-	</li>
+  </li>
 #end for
-	</ul>
+  </ul>
 #end if
 #if $pkg.depends
   <h2>depends</h2>
   <ul>
 #for depend_pkg, depend_desc in $pkg.depends
   <li>
-  $depend_desc
+    <a href="http://www.opencsw.org/packages/$depend_pkg/">
+      $depend_desc
+    </a>
   </li>
 #end for
   </ul>
@@ -121,10 +170,38 @@
 #if $pkg.files_metadata
   <h2>files metadata</h2>
   <table>
+  <tr>
+    <th>path</th>
+    <th>mimetype</th>
+    <th>machine_id</th>
+    <th>machine name</th>
+    <th>endian</th>
+  </tr>
 #for md in $pkg.files_metadata
   <tr>
   <td> $md.path </td>
   <td> $md.mime_type </td>
+  <td>
+#if "machine_id" in $md
+  $md.machine_id
+#else
+  &nbsp;
+#end if
+  </td>
+  <td>
+#if "machine_id" in $md
+  $hachoir_machines[$md.machine_id].name
+#else
+  &nbsp;
+#end if
+  </td>
+  <td>
+#if "endian" in $md
+  $md.endian
+#else
+  &nbsp;
+#end if
+  </td>
   </tr>
 #end for
   </table>
@@ -143,11 +220,11 @@
   <h2>overrides</h2>
   <ul>
 #for override in $pkg.overrides
-	<li>
-	$override.pkgname
-	$override.tag_name
+  <li>
+  $override.pkgname
+  $override.tag_name
   $override.tag_info
-	</li>
+  </li>
 #end for
   </ul>
 #end if
@@ -167,9 +244,9 @@
   <h2>pkgmap</h2>
   <ul class="code">
 #for entry in $pkg.pkgmap
-	<li>
-	$entry.line
-	</li>
+  <li>
+  $entry.line
+  </li>
 #end for
   </ul>
 #end for
@@ -239,10 +316,21 @@
       sys.stdout.write(unicode(t))
   if command == 'gen-html':
     pkgstats = []
+    # Add error tags
     for md5_sum in md5_sums:
       srv4 = GetPkg(md5_sum)
-      pkgstats.append(cPickle.loads(str(srv4.data)))
-    t = Template(REVIEW_REQ_TMPL, searchList=[srv4, {"pkgstats": pkgstats}])
+      data = cPickle.loads(str(srv4.data))
+      if "OPENCSW_REPOSITORY" in data["pkginfo"]:
+        build_src = data["pkginfo"]["OPENCSW_REPOSITORY"]
+        build_src = re.sub(r"@(\d+)$", r"?rev=\1", build_src)
+      else:
+        build_src = None
+      data["build_src"] = build_src
+      pkgstats.append(data)
+    t = Template(REVIEW_REQ_TMPL, searchList=[{
+      "pkgstats": pkgstats,
+      "hachoir_machines": package_checks.HACHOIR_MACHINES,
+      }])
     sys.stdout.write(unicode(t))
 
 


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