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/templates/pages/packages/ebuilds/ebuild/, ...
Date: Sun, 26 Jul 2015 14:38:26
Message-Id: 1437921459.65c8b3dcce64f5c865baa472c0307a07c1f9872b.zorry@gentoo
1 commit: 65c8b3dcce64f5c865baa472c0307a07c1f9872b
2 Author: Magnus Granberg <zorry <AT> gentoo <DOT> org>
3 AuthorDate: Sun Jul 26 14:37:39 2015 +0000
4 Commit: Magnus Granberg <zorry <AT> gentoo <DOT> org>
5 CommitDate: Sun Jul 26 14:37:39 2015 +0000
6 URL: https://gitweb.gentoo.org/proj/tinderbox-cluster-www.git/commit/?id=65c8b3dc
7
8 add ebuild info and fix listing of packages
9
10 python/tbc_www/models.py | 27 +++++++++++++
11 python/tbc_www/urls.py | 1 +
12 python/tbc_www/views.py | 40 ++++++++++++------
13 python/templates/includes/frontpage/new_logs | 8 ++--
14 .../templates/pages/packages/category/index.html | 6 +--
15 .../pages/packages/ebuilds/ebuild/index.html | 47 ++++++++++++++++++++++
16 python/templates/pages/packages/index.html | 6 +--
17 7 files changed, 112 insertions(+), 23 deletions(-)
18
19 diff --git a/python/tbc_www/models.py b/python/tbc_www/models.py
20 index 621a7dc..2cb327a 100644
21 --- a/python/tbc_www/models.py
22 +++ b/python/tbc_www/models.py
23 @@ -175,6 +175,14 @@ class Keywords(models.Model):
24 def __str__(self):
25 return '%s %s' % (self.KeywordId, self.Keyword)
26
27 +class Restrictions(models.Model):
28 + RestrictionId = models.IntegerField(primary_key=True, db_column='restriction_id')
29 + Restriction = models.CharField(max_length=150, db_column='restriction')
30 + class Meta:
31 + db_table = 'restrictions'
32 + def __str__(self):
33 + return '%s %s' % (self.RestrictionId, self.Restriction)
34 +
35 class EbuildsKeywords(models.Model):
36 Id = models.IntegerField(primary_key=True, db_column='id')
37 EbuildId = models.ForeignKey(Ebuilds, db_column='ebuild_id')
38 @@ -184,3 +192,22 @@ class EbuildsKeywords(models.Model):
39 db_table = 'ebuilds_keywords'
40 def __str__(self):
41 return '%s %s %s' % (self.EbuildId, self.KeywordId, self.Status)
42 +
43 +class EbuildsIuse(models.Model):
44 + Id = models.IntegerField(primary_key=True, db_column='id')
45 + EbuildId = models.ForeignKey(Ebuilds, db_column='ebuild_id')
46 + UseId = models.ForeignKey(Uses, db_column='use_id')
47 + Status =models.BooleanField(db_column='status')
48 + class Meta:
49 + db_table = 'ebuilds_iuse'
50 + def __str__(self):
51 + return '%s %s %s %s' % (self.Id, self.EbuildId, self.UseId, self.Status)
52 +
53 +class EbuildsRestrictions(models.Model):
54 + Id = models.IntegerField(primary_key=True, db_column='id')
55 + EbuildId = models.ForeignKey(Ebuilds, db_column='ebuild_id')
56 + RestrictionId = models.ForeignKey(Restrictions, db_column='restriction_id')
57 + class Meta:
58 + db_table = 'ebuilds_restrictions'
59 + def __str__(self):
60 + return '%s %s' % (self.EbuildId, self.RestrictionId)
61
62 diff --git a/python/tbc_www/urls.py b/python/tbc_www/urls.py
63 index 193443f..4d50f40 100644
64 --- a/python/tbc_www/urls.py
65 +++ b/python/tbc_www/urls.py
66 @@ -5,5 +5,6 @@ urlpatterns = patterns('tbc_www.views',
67 url(r'^packages/$', 'categories'),
68 url(r'^categories/(?P<category_id>\d+)/$', 'packages'),
69 url(r'^package/(?P<package_id>\d+)/$', 'ebuilds'),
70 + url(r'^ebuild/(?P<ebuild_id>\d+)/$', 'ebuild'),
71 url(r'^new/$', 'new_main'),
72 )
73
74 diff --git a/python/tbc_www/views.py b/python/tbc_www/views.py
75 index f68a706..5b719aa 100644
76 --- a/python/tbc_www/views.py
77 +++ b/python/tbc_www/views.py
78 @@ -7,7 +7,7 @@ from django.conf import settings
79 from gentoo_www.models import SiteSettings, Layout, Pages, SubPages, Sponsors, Posts
80 from tbc_www.models import EbuildsMetadata, BuildLogs, BuildJobs, BuildLogsRepomanQa, \
81 BuildJobsUse, Categories, CategoriesMetadata, Packages, PackagesMetadata, Ebuilds, \
82 - Repos, EbuildsKeywords, BuildLogsErrors
83 + Repos, EbuildsKeywords, BuildLogsErrors, EbuildsRestrictions, EbuildsIuse
84 import re
85
86 def default_TmpDict(pagerequest):
87 @@ -32,9 +32,10 @@ def home(request):
88 Lines = 5
89 TmpDict = default_TmpDict(pagerequest)
90 TmpDict['EM'] = EbuildsMetadata.objects.filter(Revision = '1.1').order_by('-Id')[:Lines]
91 - adict = {}
92 + alist = []
93 for BL in BuildLogs.objects.order_by('-TimeStamp')[:Lines]:
94 adict2 = {}
95 + adict2['BuildLogId'] = BL.BuildLogId
96 adict2['C'] = BL.EbuildId.PackageId.CategoryId.Category
97 adict2['P'] = BL.EbuildId.PackageId.Package
98 adict2['V'] = BL.EbuildId.Version
99 @@ -43,8 +44,8 @@ def home(request):
100 adict2['SummeryText'] = BL.SummeryText
101 if BL.Fail:
102 adict2['BE_tmp'] = BuildLogsErrors.objects.filter(BuildLogId = BL.BuildLogId)
103 - adict[BL.BuildLogId] = adict2
104 - TmpDict['BL'] = adict
105 + alist.append(adict2)
106 + TmpDict['BL'] = alist
107 adict = {}
108 BJ_Tmp = BuildJobs.objects.order_by('-TimeStamp')[:Lines]
109 for BJ in BJ_Tmp:
110 @@ -82,7 +83,7 @@ def home(request):
111 def categories(request):
112 pagerequest = 'packages'
113 TmpDict = default_TmpDict(pagerequest)
114 - adict2 = {}
115 + alist = []
116 for CM in CategoriesMetadata.objects.filter(CategoryId__Active = True).order_by('CategoryId__Category'):
117 adict = {}
118 adict['CategoryId'] = CM.CategoryId.CategoryId
119 @@ -92,14 +93,14 @@ def categories(request):
120 for P in Packages.objects.filter(Active = True).filter(CategoryId_id = CM.CategoryId.CategoryId).order_by('Package'):
121 packages.append(P.Package + '\n')
122 adict['Packages'] = packages
123 - adict2[CM.CategoryId.Category] = adict
124 - TmpDict['CM_tmp'] = adict2
125 + alist.append(adict)
126 + TmpDict['CM_tmp'] = alist
127 return render(request, 'pages/' + pagerequest + '/index.html', TmpDict)
128
129 def packages(request, category_id):
130 pagerequest = 'packages'
131 TmpDict = default_TmpDict(pagerequest)
132 - adict2 = {}
133 + alist = []
134 for PM in PackagesMetadata.objects.filter(PackageId__CategoryId_id = category_id).filter(PackageId__Active = True):
135 adict = {}
136 adict['PackageId'] = PM.PackageId.PackageId
137 @@ -110,8 +111,8 @@ def packages(request, category_id):
138 for E in Ebuilds.objects.filter(Active = True).filter(PackageId__Package = PM.PackageId.Package):
139 ebuilds.append(E.Version + '::' + E.PackageId.RepoId.Repo + '\n')
140 adict['Ebuilds'] = ebuilds
141 - adict2[PM.PackageId.Package] = adict
142 - TmpDict['PM_tmp'] = adict2
143 + alist.append(adict)
144 + TmpDict['PM_tmp'] = alist
145 TmpDict['C'] = get_object_or_404(Categories, CategoryId = category_id)
146 return render(request, 'pages/' + pagerequest + '/category/index.html', TmpDict)
147
148 @@ -122,16 +123,29 @@ def ebuilds(request, package_id):
149 TmpDict['P'] = P
150 TmpDict['EM_tmp'] = EbuildsMetadata.objects.filter(EbuildId__Active = True).filter(EbuildId__PackageId__Package = P.PackageId.Package)
151 TmpDict['EK_tmp'] = EbuildsKeywords.objects.filter(EbuildId__Active = True).filter(EbuildId__PackageId__Package = P.PackageId.Package)
152 +
153 return render(request, 'pages/' + pagerequest + '/ebuilds/index.html', TmpDict)
154
155 +def ebuild(request, ebuild_id):
156 + pagerequest = 'packages'
157 + TmpDict = default_TmpDict(pagerequest)
158 + TmpDict['E'] = get_object_or_404(Ebuilds, EbuildId = ebuild_id)
159 + TmpDict['EM_tmp'] = EbuildsMetadata.objects.filter(EbuildId__EbuildId = ebuild_id)
160 + TmpDict['EK_tmp'] = EbuildsKeywords.objects.filter(EbuildId__EbuildId = ebuild_id)
161 + TmpDict['BL_tmp'] = BuildLogs.objects.filter(EbuildId__EbuildId = ebuild_id)
162 + TmpDict['EU_tmp'] = EbuildsIuse.objects.filter(EbuildId__EbuildId = ebuild_id)
163 + TmpDict['ER_tmp'] = EbuildsRestrictions.objects.filter(EbuildId__EbuildId = ebuild_id)
164 + return render(request, 'pages/' + pagerequest + '/ebuilds/ebuild/index.html', TmpDict)
165 +
166 def new_main(request):
167 pagerequest = 'new'
168 Lines = 30
169 TmpDict = default_TmpDict(pagerequest)
170 TmpDict['EM'] = EbuildsMetadata.objects.filter(Revision = '1.1').order_by('-Id')[:Lines]
171 - adict = {}
172 + alist = []
173 for BL in BuildLogs.objects.order_by('-TimeStamp')[:Lines]:
174 adict2 = {}
175 + adict2['BuildLogId'] = BL.BuildLogId
176 adict2['C'] = BL.EbuildId.PackageId.CategoryId.Category
177 adict2['P'] = BL.EbuildId.PackageId.Package
178 adict2['V'] = BL.EbuildId.Version
179 @@ -140,8 +154,8 @@ def new_main(request):
180 adict2['SummeryText'] = BL.SummeryText
181 if BL.Fail:
182 adict2['BE_tmp'] = BuildLogsErrors.objects.filter(BuildLogId = BL.BuildLogId)
183 - adict[BL.BuildLogId] = adict2
184 - TmpDict['BL'] = adict
185 + alist.append(adict2)
186 + TmpDict['BL'] = alist
187 adict = {}
188 BJ_Tmp = BuildJobs.objects.order_by('-TimeStamp')[:Lines]
189 for BJ in BJ_Tmp:
190
191 diff --git a/python/templates/includes/frontpage/new_logs b/python/templates/includes/frontpage/new_logs
192 index afe190c..3074c4d 100644
193 --- a/python/templates/includes/frontpage/new_logs
194 +++ b/python/templates/includes/frontpage/new_logs
195 @@ -1,19 +1,19 @@
196 <table class="table table-striped frontpage-table">
197 - {% for BuildLogId, B in BL.items %}
198 + {% for B in BL%}
199 <tr>
200 - <td class="frontpage-table-package-atom"><a href="/new_logs/{{ BuildLogId }}/" title="{{ B.C }}/{{ B.P }}-{{ B.V }}::{{ B.R }}">
201 + <td class="frontpage-table-package-atom"><a href="/new_logs/{{ B.BuildLogId }}/" title="{{ B.C }}/{{ B.P }}-{{ B.V }}::{{ B.R }}">
202 {{ B.C }}/{{ B.P }}-{{ B.V }}::{{ B.R }}</a></td>
203 <td><p title="{{ B.SummeryText }}">{{ B.SummeryText|truncatewords:3 }}</p>
204 <td class="text-right">
205 {% if B.Fail %}
206 {% for BE in B.BE_tmp %}
207 - {% if BE.BuildLogId.BuildLogId == BuildLogId %}
208 + {% if BE.BuildLogId.BuildLogId == B.BuildLogId %}
209 {% if BE.ErrorId.ErrorId == 1 or BE.ErrorId.ErrorId == 2 %}
210 <span class="label label-warning">{{ BE.ErrorId.ErrorName|upper }}</span>
211 {% elif BE.ErrorId.ErrorId == 3 %}
212 <span class="label label-info">OTHERS</span>
213 {% else %}
214 - <span class="label label-danger">{{ BE.ErrorId.ErrorName|upper}}</span>
215 + <span class="label label-danger">{{ BE.ErrorId.ErrorName|upper }}</span>
216 {% endif %}
217 {% endif %}
218 {% endfor %}
219
220 diff --git a/python/templates/pages/packages/category/index.html b/python/templates/pages/packages/category/index.html
221 index edc7cc9..2f2b6f2 100644
222 --- a/python/templates/pages/packages/category/index.html
223 +++ b/python/templates/pages/packages/category/index.html
224 @@ -3,16 +3,16 @@
225 <div class="row">
226 <h2>Packages in {{ C.Category }}</h2>
227 <div class="col-xs-12 col-md-5">
228 - {% for key, PM in PM_tmp.items %}
229 + {% for PM in PM_tmp %}
230 <table class="table table-striped frontpage-table">
231 <tr>
232 <td class="frontpage-table-package-atom">
233 - <a href="/package/{{ PM.PackageId }}/" title="{{ C.Category }}/{{ key }}">{{ C.Category }}/{{ key }}</a>
234 + <a href="/package/{{ PM.PackageId }}/" title="{{ C.Category }}/{{ PM.Package }}">{{ C.Category }}/{{ PM.Package }}</a>
235 <p title="{{ PM.Changlog }}">Changlog</p>
236 </td>
237 <td>
238 <p title="{{ PM.Descriptions }}">{{ PM.Descriptions }}</p>
239 - <p title="{% for P in PM.Ebuilds %}{{ key }}/{{ P }}{% endfor %}">Versions</p>
240 + <p title="{% for P in PM.Ebuilds %}{{ PM.Package }}/{{ P }}{% endfor %}">Versions</p>
241 </td>
242 </tr>
243 </table>
244
245 diff --git a/python/templates/pages/packages/ebuilds/ebuild/index.html b/python/templates/pages/packages/ebuilds/ebuild/index.html
246 new file mode 100644
247 index 0000000..e000a53
248 --- /dev/null
249 +++ b/python/templates/pages/packages/ebuilds/ebuild/index.html
250 @@ -0,0 +1,47 @@
251 +{% extends "layout/base.html" %}
252 +{% block content %}
253 +<div class="row">
254 + <div class="col-xs-12 col-md-9">
255 + <h2>{{ E.PackageId.CategoryId.Category }}/{{ E.PackageId.Package }}</h2>
256 + <table class="table table-striped frontpage-table">
257 + {% for EM in EM_tmp %}
258 + <tr>
259 + <td class="frontpage-table-package-atom">
260 + <p" title="{{ E.PackageId.CategoryId.Category }}/{{ E.PackageId.Package }}-{{ E.EbuildId.Version }}::{{ E.PackageId.RepoId.Repo }}">{{ E.PackageId.Package }}-{{ E.Version }}::{{ E.PackageId.RepoId.Repo }}</p>
261 + <a class="btn btn-default btn-xs" href="/buildpackage/{{ E.EbuildId.EbuildId }}/">Build</a>
262 + {% for BL in BL_tmp %}
263 + {% if BL.Fail %}
264 + <a class="btn btn-danger btn-xs" href="/buildlog/{{ BL.BuildLogId }}/">Fail</a>
265 + {% else %}
266 + <a class="btn btn-success btn-xs" href="/buildlog/{{ BL.BuildLogId }}/">Success</a>
267 + {% endif %}
268 + {% endfor %}
269 + </td>
270 + <td>
271 + {% for K in EK_tmp %}
272 + {% if K.EbuildId.EbuildId == E.EbuildId and K.KeywordId.Keyword != '*' %}
273 + {% if K.Status == 'Stable' %}<span class="label label-success">{{ K.KeywordId.Keyword }}</span>{% endif %}
274 + {% if K.Status == 'Unstable' %}<span class="label label-warning">{{ K.KeywordId.Keyword }}</span>{% endif %}
275 + {% if K.Status == 'Negative' %}{{ K.KeywordId.Keyword }}{% endif %}
276 + {% endif %}
277 + {% endfor %}
278 + <p>
279 + {% for U in EU_tmp %}
280 + {% if U.Status %}
281 + <span class="label label-info">{{ U.UseId.Flag }}</span>
282 + {% else %}
283 + <span class="label label-default">{{ U.UseId.Flag }}</span>
284 + {% endif %}
285 + {% endfor %}
286 + </p><p>
287 + {% for R in ER_tmp %}
288 + <span class="label label-warning">{{ R.RestrictionId.Restriction }}</span>
289 + {% endfor %}
290 + </p>
291 + </td>
292 + </tr>
293 + {% endfor %}
294 + </table>
295 + </div>
296 +</div>
297 +{% endblock %}
298 \ No newline at end of file
299
300 diff --git a/python/templates/pages/packages/index.html b/python/templates/pages/packages/index.html
301 index 5e02552..7139c87 100644
302 --- a/python/templates/pages/packages/index.html
303 +++ b/python/templates/pages/packages/index.html
304 @@ -3,15 +3,15 @@
305 <div class="row">
306 <h2>Categories</h2>
307 <div class="col-xs-8 col-md-4">
308 - {% for key, CM in CM_tmp.items %}
309 + {% for CM in CM_tmp %}
310 <table class="table table-striped frontpage-table">
311 <tr>
312 <td class="frontpage-table-package-atom">
313 - <a href="/categories/{{ CM.CategoryId }}/" title="{{ key }}">{{ key }}</a>
314 + <a href="/categories/{{ CM.CategoryId }}/" title="{{ CM.Category }}">{{CM.Category }}</a>
315 </td>
316 <td>
317 <p title="{{ CM.Descriptions }}">{{ CM.Descriptions }}</p>
318 - <p title="{% for P in CM.Packages %}{{ key }}/{{ P }}{% endfor %}">Packages</p>
319 + <p title="{% for P in CM.Packages %}{{ CM.Category}}/{{ P }}{% endfor %}">Packages</p>
320 </td>
321 </tr>
322 </table>