Gentoo Archives: gentoo-commits

From: Magnus Granberg <zorry@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/tinderbox-cluster-www:master commit in: python/tbc_www/, python/templates/includes/frontpage/
Date: Fri, 24 Jul 2015 00:18:13
Message-Id: 1437697046.f1d51cfa2fe8f8a781dc31e3f6ca7ad6436b8563.zorry@gentoo
1 commit: f1d51cfa2fe8f8a781dc31e3f6ca7ad6436b8563
2 Author: Magnus Granberg <zorry <AT> gentoo <DOT> org>
3 AuthorDate: Fri Jul 24 00:17:26 2015 +0000
4 Commit: Magnus Granberg <zorry <AT> gentoo <DOT> org>
5 CommitDate: Fri Jul 24 00:17:26 2015 +0000
6 URL: https://gitweb.gentoo.org/proj/tinderbox-cluster-www.git/commit/?id=f1d51cfa
7
8 fix error, repoman, qa view in new logs
9
10 python/tbc_www/models.py | 22 +++++++++++++++---
11 python/tbc_www/views.py | 34 ++++++++++++++++++++++++----
12 python/templates/includes/frontpage/new_logs | 26 +++++++++++++++++----
13 3 files changed, 70 insertions(+), 12 deletions(-)
14
15 diff --git a/python/tbc_www/models.py b/python/tbc_www/models.py
16 index 9827583..621a7dc 100644
17 --- a/python/tbc_www/models.py
18 +++ b/python/tbc_www/models.py
19 @@ -80,8 +80,6 @@ class BuildLogs(models.Model):
20 BuildLogId = models.IntegerField(primary_key=True, db_column='build_log_id')
21 EbuildId = models.ForeignKey(Ebuilds, db_column='ebuild_id')
22 Fail = models.BooleanField(db_column='fail')
23 - RmQa = models.BooleanField(db_column='rmqa')
24 - Others = models.BooleanField(db_column='others')
25 SummeryText = models.TextField(db_column='summery_text')
26 LogHash = models.CharField(max_length=100, db_column='log_hash')
27 BugId = models.IntegerField( db_column='bug_id')
28 @@ -89,7 +87,7 @@ class BuildLogs(models.Model):
29 class Meta:
30 db_table = 'build_logs'
31 def __str__(self):
32 - return '%s %s %s %s %s %s %s %s %s' % (self.BuildLogId, self.EbuildId, self.Fail, self.RmQa, self.Others, self.SummeryText, self.LogHash, self.BugId, self.TimeStamp)
33 + return '%s %s %s %s %s %s %s' % (self.BuildLogId, self.EbuildId, self.Fail, self.SummeryText, self.LogHash, self.BugId, self.TimeStamp)
34
35 class BuildLogsRepomanQa(models.Model):
36 Id = models.IntegerField(primary_key=True, db_column='id')
37 @@ -100,6 +98,24 @@ class BuildLogsRepomanQa(models.Model):
38 def __str__(self):
39 return '%s %s %s' % (self.Id, self.BuildLogId, self.SummeryText)
40
41 +class ErrorsInfo(models.Model):
42 + ErrorId = models.IntegerField(primary_key=True, db_column='error_id')
43 + ErrorName = models.CharField(max_length=20, db_column='error_name')
44 + ErrorSearch = models.CharField(max_length=30, db_column='error_search')
45 + class Meta:
46 + db_table = 'errors_info'
47 + def __str__(self):
48 + return '%s %s %s' % (self.ErrorId, self.ErrorName, self.ErrorSearch)
49 +
50 +class BuildLogsErrors(models.Model):
51 + Id = models.IntegerField(primary_key=True, db_column='id')
52 + BuildLogId = models.ForeignKey(BuildLogs, db_column='build_log_id')
53 + ErrorId = models.ForeignKey(ErrorsInfo, db_column='error_id')
54 + class Meta:
55 + db_table = 'build_logs_errors'
56 + def __str__(self):
57 + return '%s %s %s' % (self.Id, self.BuildLogId, self.ErrorId)
58 +
59 class Setups(models.Model):
60 SetupId = models.AutoField(primary_key=True, db_column='setup_id')
61 Setup = models.CharField(max_length=100, db_column='setup')
62
63 diff --git a/python/tbc_www/views.py b/python/tbc_www/views.py
64 index 2559f8d..f68a706 100644
65 --- a/python/tbc_www/views.py
66 +++ b/python/tbc_www/views.py
67 @@ -7,7 +7,7 @@ from django.conf import settings
68 from gentoo_www.models import SiteSettings, Layout, Pages, SubPages, Sponsors, Posts
69 from tbc_www.models import EbuildsMetadata, BuildLogs, BuildJobs, BuildLogsRepomanQa, \
70 BuildJobsUse, Categories, CategoriesMetadata, Packages, PackagesMetadata, Ebuilds, \
71 - Repos, EbuildsKeywords
72 + Repos, EbuildsKeywords, BuildLogsErrors
73 import re
74
75 def default_TmpDict(pagerequest):
76 @@ -30,10 +30,22 @@ def default_TmpDict(pagerequest):
77 def home(request):
78 pagerequest = 'home'
79 Lines = 5
80 - adict = {}
81 TmpDict = default_TmpDict(pagerequest)
82 TmpDict['EM'] = EbuildsMetadata.objects.filter(Revision = '1.1').order_by('-Id')[:Lines]
83 - TmpDict['BL'] = BuildLogs.objects.order_by('-TimeStamp')[:Lines]
84 + adict = {}
85 + for BL in BuildLogs.objects.order_by('-TimeStamp')[:Lines]:
86 + adict2 = {}
87 + adict2['C'] = BL.EbuildId.PackageId.CategoryId.Category
88 + adict2['P'] = BL.EbuildId.PackageId.Package
89 + adict2['V'] = BL.EbuildId.Version
90 + adict2['R'] = BL.EbuildId.PackageId.RepoId.Repo
91 + adict2['Fail'] = BL.Fail
92 + adict2['SummeryText'] = BL.SummeryText
93 + if BL.Fail:
94 + adict2['BE_tmp'] = BuildLogsErrors.objects.filter(BuildLogId = BL.BuildLogId)
95 + adict[BL.BuildLogId] = adict2
96 + TmpDict['BL'] = adict
97 + adict = {}
98 BJ_Tmp = BuildJobs.objects.order_by('-TimeStamp')[:Lines]
99 for BJ in BJ_Tmp:
100 adict2 = {}
101 @@ -115,10 +127,22 @@ def ebuilds(request, package_id):
102 def new_main(request):
103 pagerequest = 'new'
104 Lines = 30
105 - adict = {}
106 TmpDict = default_TmpDict(pagerequest)
107 TmpDict['EM'] = EbuildsMetadata.objects.filter(Revision = '1.1').order_by('-Id')[:Lines]
108 - TmpDict['BL'] = BuildLogs.objects.order_by('-TimeStamp')[:Lines]
109 + adict = {}
110 + for BL in BuildLogs.objects.order_by('-TimeStamp')[:Lines]:
111 + adict2 = {}
112 + adict2['C'] = BL.EbuildId.PackageId.CategoryId.Category
113 + adict2['P'] = BL.EbuildId.PackageId.Package
114 + adict2['V'] = BL.EbuildId.Version
115 + adict2['R'] = BL.EbuildId.PackageId.RepoId.Repo
116 + adict2['Fail'] = BL.Fail
117 + adict2['SummeryText'] = BL.SummeryText
118 + if BL.Fail:
119 + adict2['BE_tmp'] = BuildLogsErrors.objects.filter(BuildLogId = BL.BuildLogId)
120 + adict[BL.BuildLogId] = adict2
121 + TmpDict['BL'] = adict
122 + adict = {}
123 BJ_Tmp = BuildJobs.objects.order_by('-TimeStamp')[:Lines]
124 for BJ in BJ_Tmp:
125 adict2 = {}
126
127 diff --git a/python/templates/includes/frontpage/new_logs b/python/templates/includes/frontpage/new_logs
128 index 6534201..afe190c 100644
129 --- a/python/templates/includes/frontpage/new_logs
130 +++ b/python/templates/includes/frontpage/new_logs
131 @@ -1,9 +1,27 @@
132 <table class="table table-striped frontpage-table">
133 - {% for B in BL %}
134 + {% for BuildLogId, B in BL.items %}
135 <tr>
136 - <td class="frontpage-table-package-atom"><a href="/new_logs/{{ B.BuildLogId }}/" title="{{ B.EbuildId.PackageId.CategoryId.Category }}/{{ B.EbuildId.PackageId.Package }}-{{ B.EbuildId.Version }}::{{ B.EbuildId.PackageId.RepoId.Repo }}">
137 - {{ B.EbuildId.PackageId.CategoryId.Category }}/{{ B.EbuildId.PackageId.Package }}-{{ B.EbuildId.Version }}::{{ B.EbuildId.PackageId.RepoId.Repo }}</a></td>
138 - <td><p title="{{ B.SummeryText }}">{{ B.SummeryText|truncatewords:3 }}</p><td class="text-right">{% if B.Fail %}<span class="label label-danger">Fail</span>{% endif %}</td></td>
139 + <td class="frontpage-table-package-atom"><a href="/new_logs/{{ BuildLogId }}/" title="{{ B.C }}/{{ B.P }}-{{ B.V }}::{{ B.R }}">
140 + {{ B.C }}/{{ B.P }}-{{ B.V }}::{{ B.R }}</a></td>
141 + <td><p title="{{ B.SummeryText }}">{{ B.SummeryText|truncatewords:3 }}</p>
142 + <td class="text-right">
143 + {% if B.Fail %}
144 + {% for BE in B.BE_tmp %}
145 + {% if BE.BuildLogId.BuildLogId == BuildLogId %}
146 + {% if BE.ErrorId.ErrorId == 1 or BE.ErrorId.ErrorId == 2 %}
147 + <span class="label label-warning">{{ BE.ErrorId.ErrorName|upper }}</span>
148 + {% elif BE.ErrorId.ErrorId == 3 %}
149 + <span class="label label-info">OTHERS</span>
150 + {% else %}
151 + <span class="label label-danger">{{ BE.ErrorId.ErrorName|upper}}</span>
152 + {% endif %}
153 + {% endif %}
154 + {% endfor %}
155 + {% else %}
156 + <span class="label label-success">OK</span>
157 + {% endif %}
158 + </td>
159 + </td>
160 </tr>
161 {% endfor %}
162 </table>
163 \ No newline at end of file