[jhbuild] tinderbox: make help URL configurable (GNOME bug 686019)



commit cbeb00b23d3f451a5a79c59b3bcc23fdb362b8f0
Author: Craig Keogh <cskeogh adam com au>
Date:   Tue Oct 30 13:32:34 2012 +1030

    tinderbox: make help URL configurable (GNOME bug 686019)

 doc/C/index.docbook            |   14 +++++++++++
 jhbuild/config.py              |    1 +
 jhbuild/defaults.jhbuildrc     |    5 ++++
 jhbuild/frontends/tinderbox.py |   48 ++++++++++++++++++++++++++++++----------
 4 files changed, 56 insertions(+), 12 deletions(-)
---
diff --git a/doc/C/index.docbook b/doc/C/index.docbook
index 7eec8db..bace1dd 100644
--- a/doc/C/index.docbook
+++ b/doc/C/index.docbook
@@ -1721,6 +1721,20 @@ Optional packages: (JHBuild will build the missing packages)
               supported by Git and Bazaar repositories.</simpara>
           </listitem>
         </varlistentry>
+        <varlistentry id="cfg-help-website">
+          <term>
+            <varname>help_website</varname>
+          </term>
+          <listitem>
+            <simpara>A tuple specifying a help website name and URL. The
+              website is displayed in the tinderbox html for failed modules.
+              <varname>%(module)s</varname> in the URL will be replaced with the
+              module name. To disable, set <varname>help_website</varname> to
+              <literal>None</literal>. Defaults to <literal>('Gnome Live!',
+              'http://live.gnome.org/JhbuildIssues/%(module)s')</literal>.
+            </simpara>
+          </listitem>
+        </varlistentry>
         <varlistentry id="cfg-installprog">
           <term>
             <varname>installprog</varname>
diff --git a/jhbuild/config.py b/jhbuild/config.py
index c430414..521cb32 100644
--- a/jhbuild/config.py
+++ b/jhbuild/config.py
@@ -63,6 +63,7 @@ _known_keys = [ 'moduleset', 'modules', 'skip', 'tags', 'prefix',
                 'print_command_pattern', 'static_analyzer',
                 'module_static_analyzer', 'static_analyzer_template',
                 'static_analyzer_outputdir', 'check_sysdeps', 'system_prefix',
+                'help_website',
               ]
 
 env_prepends = {}
diff --git a/jhbuild/defaults.jhbuildrc b/jhbuild/defaults.jhbuildrc
index c257c9a..c1fde15 100644
--- a/jhbuild/defaults.jhbuildrc
+++ b/jhbuild/defaults.jhbuildrc
@@ -209,3 +209,8 @@ check_sysdeps = True
 # system_prefix used when searching for files within available packages
 # during 'sysdeps --install'
 system_prefix = '/usr'
+
+# A tuple of website name and URL. This is displayed in tinderbox output. URL
+# String may contain the variable %(module)s
+help_website = ('Gnome Live!',
+                'http://live.gnome.org/JhbuildIssues/%(module)s')
diff --git a/jhbuild/frontends/tinderbox.py b/jhbuild/frontends/tinderbox.py
index 5ee5d52..eb85d27 100644
--- a/jhbuild/frontends/tinderbox.py
+++ b/jhbuild/frontends/tinderbox.py
@@ -177,7 +177,6 @@ class LoggingFormatter(logging.Formatter):
                                    '%(message)s</div>')
 
 class TinderboxBuildScript(buildscript.BuildScript):
-    help_url = 'http://live.gnome.org/JhbuildIssues/'
     triedcheckout = None
 
     def __init__(self, config, module_list, module_set=None):
@@ -371,9 +370,22 @@ class TinderboxBuildScript(buildscript.BuildScript):
         self.modulefp = None
         self.indexfp.write('</td>\n')
         if failed:
-            self.indexfp.write('<td class="failure">failed '
-                               '<a href="%s%s">'
-                               '(help)</a></td>\n' % (self.help_url, module))
+            help_html = ''
+            if self.config.help_website and self.config.help_website[1]:
+                try:
+                    help_url = self.config.help_website[1] % {'module' : module}
+                    help_html = ' <a href="%s">(help)</a>' % help_url
+                except TypeError, e:
+                    raise FatalError('"help_website" %s' % e)
+                except KeyError, e:
+                    raise FatalError(_('%(configuration_variable)s invalid key'
+                                       ' %(key)s' % \
+                                       {'configuration_variable' :
+                                            '\'help_website\'',
+                                        'key' : e}))
+
+            self.indexfp.write('<td class="failure">failed%s</td>\n' %
+                               help_html)
         else:
             self.indexfp.write('<td class="success">ok</td>\n')
         self.indexfp.write('</tr>\n\n')
@@ -406,14 +418,26 @@ class TinderboxBuildScript(buildscript.BuildScript):
                 return 'force_checkout'
         self.triedcheckout = None
 
-        if self.modulefp:
-            self.modulefp.write('<div class="note">The Gnome Live! website may'
-                                ' have suggestions on how to resolve some'
-                                ' build errors. Visit'
-                                ' <a href="%s%s">%s%s</a>'
-                                ' for more information.</div>'
-                                % (self.help_url, module.name,
-                                   self.help_url, module.name))
+        if (self.modulefp and self.config.help_website and
+            self.config.help_website[0] and self.config.help_website[1]):
+            try:
+                help_url = self.config.help_website[1] % \
+                               {'module' : module.name}
+                self.modulefp.write('<div class="note">The %(name)s website may'
+                                    ' have suggestions on how to resolve some'
+                                    ' build errors. Visit'
+                                    ' <a href="%(url)s">%(url)s</a>'
+                                    ' for more information.</div>'
+                                    % {'name' : self.config.help_website[0],
+                                       'url'  : help_url})
+            except TypeError, e:
+                raise FatalError('"help_website" %s' % e)
+            except KeyError, e:
+                raise FatalError(_('%(configuration_variable)s invalid key'
+                                   ' %(key)s' % \
+                                   {'configuration_variable' :
+                                        '\'help_website\'',
+                                    'key' : e}))
         return 'fail'
 
 BUILD_SCRIPT = TinderboxBuildScript



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]