view contrib/sawmill/web/templates/details.html @ 474:a8f77807d710

sawmill: create links for tag builds
author Sascha Teichmann <teichmann@intevation.de>
date Fri, 10 Sep 2010 14:18:07 +0000
parents d8012571f9e1
children 7be221f41f58
line wrap: on
line source
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
  "http://www.w3.org/TR/html4/loose.dtd">
<%
from cgi import escape
from xml.sax.saxutils import quoteattr

from datetime import date
%>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link rel="stylesheet" href="styles/style.css" type="text/css" media="screen" />
        <title>S&auml;gewerker - Free Software forestry</title>
 </head>

 <body>
  <table border="0" width="100%" cellspacing="0" cellpadding="0">
   <tr>
    <td>
     <a href="index.py"><img src="img/logo.jpg" border="0" alt="" width="533" height="94" /></a>
    </td>
   </tr>
  </table>
  <table border="0" width="100%" cellspacing="0" cellpadding="0">

   <tr>
        <td align="left" bgcolor="#E0E0E0" width="9">
     <img src="img/topleft.png" height="9" width="9" alt="" />
    </td>
        <td bgcolor="#E0E0E0" width="30">
     <img src="img/clear.png" width="30" height="1" alt="" />
    </td>
        <td bgcolor="#E0E0E0">
     <img src="img/clear.png" width="1" height="1" alt="" />

    </td>
        <td bgcolor="#E0E0E0" width="30">
     <img src="img/clear.png" width="30" height="1" alt="" />
    </td>
        <td align="right" bgcolor="#E0E0E0" width="9">
     <img src="img/topright.png" height="9" width="9" alt="" />
    </td>
     </tr>

     <tr>
    <!-- Outer body row -->
    <td bgcolor="#E0E0E0">
     <img src="img/clear.png" width="10" height="1" alt="" />
    </td>
        <td valign="top" width="99%" bgcolor="#E0E0E0" colspan="3">
       <!-- Inner Tabs / Shell -->
         <table border="0" width="100%" cellspacing="0" cellpadding="0">
          <tr>

             <td align="left" bgcolor="#ffffff" width="9">
        <img src="img/topleft-inner.png" height="9" width="9" alt="" />
       </td>
             <td bgcolor="#ffffff">
        <img src="img/clear.png" width="1" height="1" alt="" />
       </td>
             <td align="right" bgcolor="#ffffff" width="9">
        <img src="img/topright-inner.png" height="9" width="9" alt="" />
       </td>

            </tr>
            <tr>
             <td bgcolor="#ffffff">
        <img src="img/clear.png" width="10" height="1" alt="" />
       </td>
             <td valign="top" width="99%" bgcolor="white" class="css_prison">
        <!-- end main body row -->
<h1><%= escape(description) %></h1>
<%= header %>
<table class="statustable">
<tr>
    <th class="statustablehead">Status</th>
    <th class="statustablehead">Package</th>
    <th class="statustablehead">Revision</th>
    <th class="statustablehead">Start</th>
    <th class="statustablehead">Stop</th>
    <th class="statustablehead">Notes</th>
</tr>
<%

def nn(s, d=""):
    if not s: return d
    return escape(s)

def pretty_time(t, format="%Y-%m-%d %H:%M:%S"):
    if not t: return "&lt;unknown&gt;"
    return t.strftime(format)


def date_from_datetime(x):
    if not x: return None
    return date(x.year, x.month, x.day)

def sort_by_start(a, b):
    a_start = a.build_start
    b_start = b.build_start
    if not a_start and not b_start: return 0
    if not a_start: return 1
    if not b_start: return -1
    return cmp(a_start, b_start)

def create_tags_link(tag_url):
    return quoteattr(tag_url.replace(
        "svn://anonsvn.kde.org/home/kde",
        "http://websvn.kde.org"))

track_items = sorted(track_items, cmp=sort_by_start, reverse=True)

last_date = None

STATUS2CLASS = {
    'creating_binary_package': 'inprogress',
    'creating_source_package': 'inprogress',
    'source_package_created':  'inprogress',
    'binary_package_created':  'finished'
}

STATUS2MSG = {
    'creating_binary_package': 'building binary packages',
    'creating_source_package': 'building source package',
    'source_package_created':  'preparing build envrionment',
    'binary_package_created':  'build successful'
}

for track_item in track_items:
    # for all track items
    curr_date = date_from_datetime(track_item.build_start)
    if curr_date != last_date:
        last_date = curr_date
%>
<tr class="date_row"><td colspan="6"><%= pretty_time(last_date, "%Y-%m-%d") %></td></tr>
<%
    # date changed
%>
<tr class="<%= STATUS2CLASS.get(track_item.build_status, 'error') %>">
    <td><%= STATUS2MSG.get(track_item.build_status, 'error') %></td>
    <td style="font-weight:bold;"><%= nn(track_item.track) %></td>
    <td align="right">
<%
    tags = track_item.build_tags
    if tags:
        # a tag
%>
    <a href=<%= create_tags_link(tags) %>><strong><%= nn(track_item.revision) %></strong></a>
<%
    else:
        # not a tag
%>
    <%= nn(track_item.revision) %>
<%
    # end if tags
%>
    </td>
    <td><%= pretty_time(track_item.build_start) %></td>
    <td><%= pretty_time(track_item.build_stop) %></td>
    <td>
<%
    for log_desc, log_path in track_item.build_logs:
        # for all logs
%>
[<a href=<%= quoteattr("%s/%s" % (base_dir, log_path)) %>><%= nn(log_desc) %></a>]

<%
    # for all logs
%>
    </td>
</tr>

<%
# for all track itemes
%>

</table>


      <!-- end main body row -->
             </td>
             <td width="10" bgcolor="#ffffff">
        <img src="img/clear.png" width="2" height="1" alt="" />
       </td>
            </tr>

            <tr>
             <td align="left" bgcolor="#E0E0E0" width="9">
        <img src="img/bottomleft-inner.png" height="11" width="11" alt="" />
        </td>
                <td bgcolor="#ffffff">
         <img src="img/clear.png" width="1" height="1" alt="" />
        </td>
                <td align="right" bgcolor="#E0E0E0" width="9">
         <img src="img/bottomright-inner.png" height="11" width="11" alt="" />

        </td>
             </tr>
            </table>

          <!-- end inner body row -->

         </td>
         <td width="10" bgcolor="#E0E0E0">
      <img src="img/clear.png" width="2" height="1" alt="" />
     </td>

      </tr>
      <tr>
         <td align="left" bgcolor="#E0E0E0" width="9">
      <img src="img/bottomleft.png" height="9" width="9" alt="" />
     </td>
         <td bgcolor="#E0E0E0" colspan="3">
      <img src="img/clear.png" width="1" height="1" alt="" />
     </td>
         <td align="right" bgcolor="#E0E0E0" width="9">

      <img src="img/bottomright.png" height="9" width="9" alt="" />
     </td>
      </tr>
   </table>
   <br />
   <center>
    <b style="color:white; font-size:13px;">
     This site is hosted by the <a href="http://www.intevation.de">Intevation GmbH</a>
    </b>
   </center>

    </body>
</html>
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)