SF.net SVN: gar:[23099] csw/mgar/gar/v2/lib/python

wahwah at users.sourceforge.net wahwah at users.sourceforge.net
Sat Mar 1 20:40:15 CET 2014


Revision: 23099
          http://sourceforge.net/p/gar/code/23099
Author:   wahwah
Date:     2014-03-01 19:40:15 +0000 (Sat, 01 Mar 2014)
Log Message:
-----------
pkgdb: Fixes for the HTML generator

Modified Paths:
--------------
    csw/mgar/gar/v2/lib/python/pkg-review-template.html
    csw/mgar/gar/v2/lib/python/pkgdb.py

Modified: csw/mgar/gar/v2/lib/python/pkg-review-template.html
===================================================================
--- csw/mgar/gar/v2/lib/python/pkg-review-template.html	2014-03-01 18:50:02 UTC (rev 23098)
+++ csw/mgar/gar/v2/lib/python/pkg-review-template.html	2014-03-01 19:40:15 UTC (rev 23099)
@@ -256,22 +256,22 @@
     </a>
   </h2>
   <ul>
-#for bin in $pkg["binaries_dump_info"]
+#for path, base_name, soname, needed_sonames, runpath, runpath_rpath_the_same, rpath_set, runpath_set in $pkg["binaries_dump_info"]
   <li>
-  <strong>$bin.path</strong>
+  <strong>$path</strong>
 ## ['base_name', 'RUNPATH RPATH the same', 'runpath', 'RPATH set', 'needed sonames', 'path', 'RUNPATH set']
   <ul>
   <li>
-    base name: <code>$bin.base_name</code>
+    base name: <code>$base_name</code>
   </li>
-#if 'soname' in $bin
+#if $soname
   <li>
     soname:
     <ul>
       <li>
         <code>
-          <a href="http://www.opencsw.org/packagesContainingFile/?fileName=$bin.soname&searchsubmit=1">
-            $bin.soname
+          <a href="http://www.opencsw.org/packagesContainingFile/?fileName=$soname&searchsubmit=1">
+            $soname
           </a>
         </code>
       </li>
@@ -280,7 +280,7 @@
 #end if
   <li> runpath:
     <ul>
-#for runpath_el in $bin.runpath
+#for runpath_el in $runpath
       <li>
         <code>
             $runpath_el
@@ -290,11 +290,11 @@
     </ul>
   <li> needed sonames:
     <ul>
-#for soname in $bin["needed sonames"]
+#for needed_soname in $needed_sonames
       <li>
         <code>
-          <a href="http://www.opencsw.org/packagesContainingFile/?fileName=$soname&searchsubmit=1">
-            $soname
+          <a href="http://www.opencsw.org/packagesContainingFile/?fileName=$needed_soname&searchsubmit=1">
+            $needed_soname
           </a>
         </code>
       </li>
@@ -338,11 +338,11 @@
   </tr>
 #for md in $pkg.files_metadata
   <tr>
-  <td> $md.path </td>
-  <td> $md.mime_type </td>
+  <td> $md[0] </td>
+  <td> $md[1] </td>
   <td style="text-align: center;">
-#if "machine_id" in $md
-  $hachoir_machines[$md.machine_id].name
+#if $md[2] is not None
+  $hachoir_machines[$md[2]].name
 #else
    
 #end if
@@ -413,7 +413,7 @@
   <ul class="code">
 #for entry in $pkg.pkgmap
   <li>
-  $entry.line
+  $entry[0]
   </li>
 #end for
   </ul>

Modified: csw/mgar/gar/v2/lib/python/pkgdb.py
===================================================================
--- csw/mgar/gar/v2/lib/python/pkgdb.py	2014-03-01 18:50:02 UTC (rev 23098)
+++ csw/mgar/gar/v2/lib/python/pkgdb.py	2014-03-01 19:40:15 UTC (rev 23099)
@@ -116,7 +116,7 @@
 
 class HtmlGenerator(object):
 
-  def __init__(self, identifiers, template=None):
+  def __init__(self, identifiers, template=None, rest_client=None, debug=False):
     """Initialize the object
 
     args: identifiers: md5 sums or file names of packages
@@ -124,6 +124,9 @@
     """
     self.template = template
     self.identifiers = identifiers
+    self.debug = debug
+    assert rest_client is not None, 'You need to pass rest_client here'
+    self.rest_client = rest_client
 
   def GetErrorTagsResult(self, srv4):
     res = m.CheckpkgErrorTag.select(
@@ -140,7 +143,7 @@
     # Add error tags
     for identifier in self.identifiers:
       srv4 = GetPkg(identifier)
-      data = srv4.GetStatsStruct()
+      data = self.rest_client.GetPkgstatsByMd5(srv4.md5_sum)
       build_src_url_svn = srv4.GetSvnUrl()
       build_src_url_trac = srv4.GetTracUrl()
       if "OPENCSW_REPOSITORY" in data["pkginfo"]:
@@ -451,7 +454,16 @@
       t = Template(SHOW_PKG_TMPL, searchList=[srv4])
       sys.stdout.write(unicode(t))
   elif command == 'gen-html':
-    g = HtmlGenerator(md5_sums, options.pkg_review_template)
+    config = configuration.GetConfig()
+    username, password = rest.GetUsernameAndPassword()
+    rest_client = rest.RestClient(
+        pkgdb_url=config.get('rest', 'pkgdb'),
+        releases_url=config.get('rest', 'releases'),
+        username=username,
+        password=password,
+        debug=options.debug)
+
+    g = HtmlGenerator(md5_sums, options.pkg_review_template, rest_client, options.debug)
     sys.stdout.write(g.GenerateHtml())
   elif command == 'initdb':
     config = configuration.GetConfig()

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