summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMagnus Granberg <zorry@gentoo.org>2015-07-22 00:57:00 +0200
committerMagnus Granberg <zorry@gentoo.org>2015-07-22 00:57:00 +0200
commit2251b1ad2020d70c58d01fdcefb087dd8838db1c (patch)
tree653027c19cb72a0213df32945aa1195ea2882140
parentfix a error to display setup/profiles in new build requests in home (diff)
downloadtinderbox-cluster-www-2251b1ad2020d70c58d01fdcefb087dd8838db1c.tar.gz
tinderbox-cluster-www-2251b1ad2020d70c58d01fdcefb087dd8838db1c.tar.bz2
tinderbox-cluster-www-2251b1ad2020d70c58d01fdcefb087dd8838db1c.zip
add package and new to menu
-rw-r--r--python/gentoo_main/urls.py7
-rw-r--r--python/tbc_www/models.py26
-rw-r--r--python/tbc_www/urls.py8
-rw-r--r--python/tbc_www/views.py89
-rw-r--r--python/templates/pages/new/index.html25
-rw-r--r--python/templates/pages/packages/category/index.html23
-rw-r--r--python/templates/pages/packages/ebuilds/index.html17
-rw-r--r--python/templates/pages/packages/index.html21
8 files changed, 208 insertions, 8 deletions
diff --git a/python/gentoo_main/urls.py b/python/gentoo_main/urls.py
index 6cead02..1eb5179 100644
--- a/python/gentoo_main/urls.py
+++ b/python/gentoo_main/urls.py
@@ -3,6 +3,7 @@
from django.conf.urls import patterns, include, url
-urlpatterns = patterns('tbc_www.views',
- (r'^home/$', 'home'),
-)
+urlpatterns = [
+ url(r'^home/$', views.home),
+ url(r'^packages/$', views.packages),
+]
diff --git a/python/tbc_www/models.py b/python/tbc_www/models.py
index 04a3bb8..3d284c2 100644
--- a/python/tbc_www/models.py
+++ b/python/tbc_www/models.py
@@ -13,6 +13,16 @@ class Categories(models.Model):
def __str__(self):
return '%s %s %s %s' % (self.CategoryId, self.Category, self.Active, self.TimeStamp)
+class CategoriesMetadata(models.Model):
+ Id = models.IntegerField(primary_key=True, db_column='id')
+ CategoryId = models.ForeignKey(Categories, db_column='category_id')
+ Checksum = models.CharField(max_length=100, db_column='checksum')
+ Descriptions = models.TextField(db_column='descriptions')
+ class Meta:
+ db_table = 'categories_metadata'
+ def __str__(self):
+ return '%s %s %s %s' % (self.Id, self.CategoryId, self.Checksum, self.Descriptions)
+
class Repos(models.Model):
RepoId = models.IntegerField(primary_key=True, db_column='repo_id')
Repo = models.CharField(max_length=100, db_column='repo')
@@ -34,6 +44,16 @@ class Packages(models.Model):
def __str__(self):
return '%s %s %s %s %s %s %s' % (self.PackageId, self.CategoryId, self.Package, self.RepoId, self.Checksum, self.Active, self.TimeStamp)
+class PackagesMetadata(models.Model):
+ Id = models.IntegerField(primary_key=True, db_column='id')
+ PackageId = models.ForeignKey(Packages, db_column='package_id')
+ Changlog = models.TextField(db_column='changlog')
+ Descriptions = models.TextField(db_column='descriptions')
+ class Meta:
+ db_table = 'packages_metadata'
+ def __str__(self):
+ return '%s %s %s %s' % (self.Id, self.PackageId, self.Changlog, self.Descriptions)
+
class Ebuilds(models.Model):
EbuildId = models.IntegerField(primary_key=True, db_column='ebuild_id')
PackageId = models.ForeignKey(Packages, db_column='package_id')
@@ -60,6 +80,8 @@ class BuildLogs(models.Model):
BuildLogId = models.IntegerField(primary_key=True, db_column='build_log_id')
EbuildId = models.ForeignKey(Ebuilds, db_column='ebuild_id')
Fail = models.BooleanField(db_column='fail')
+ RmQa = models.BooleanField(db_column='rmqa')
+ Others = models.BooleanField(db_column='others')
SummeryText = models.TextField(db_column='summery_text')
LogHash = models.CharField(max_length=100, db_column='log_hash')
BugId = models.IntegerField( db_column='bug_id')
@@ -67,14 +89,14 @@ class BuildLogs(models.Model):
class Meta:
db_table = 'build_logs'
def __str__(self):
- return '%s %s %s %s %s %s %s' % (self.BuildLogId, self.EbuildId, self.Fail, self.SummeryText, self.LogHash, self.BugId, self.TimeStamp)
+ 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)
class BuildLogsRepomanQa(models.Model):
Id = models.IntegerField(primary_key=True, db_column='id')
BuildLogId = models.ForeignKey(BuildLogs, db_column='build_log_id')
SummeryText = models.TextField(db_column='summery_text')
class Meta:
- db_table = 'build_logs_repoman'
+ db_table = 'build_logs_repoman_qa'
def __str__(self):
return '%s %s %s' % (self.Id, self.BuildLogId, self.SummeryText)
diff --git a/python/tbc_www/urls.py b/python/tbc_www/urls.py
new file mode 100644
index 0000000..82e9336
--- /dev/null
+++ b/python/tbc_www/urls.py
@@ -0,0 +1,8 @@
+from django.conf.urls import patterns, include, url
+
+urlpatterns = patterns('tbc_www.views',
+ url(r'^home/$', 'home'),
+ url(r'^packages/$', 'categories'),
+ url(r'^categories/(?P<category_id>\d+)/$', 'packages'),
+ url(r'^package/(?P<package_id>\d+)/$', 'ebuilds'),
+)
diff --git a/python/tbc_www/views.py b/python/tbc_www/views.py
index dcc89d4..252998e 100644
--- a/python/tbc_www/views.py
+++ b/python/tbc_www/views.py
@@ -6,8 +6,8 @@ from django.conf import settings
from gentoo_www.models import SiteSettings, Layout, Pages, SubPages, Sponsors, Posts
from tbc_www.models import EbuildsMetadata, BuildLogs, BuildJobs, BuildLogsRepomanQa, \
- BuildJobsUse
-
+ BuildJobsUse, Categories, CategoriesMetadata, Packages, PackagesMetadata, Ebuilds, \
+ Repos
import re
def default_TmpDict(pagerequest):
@@ -29,7 +29,90 @@ def default_TmpDict(pagerequest):
def home(request):
pagerequest = 'home'
- Lines = 10
+ Lines = 5
+ adict = {}
+ TmpDict = default_TmpDict(pagerequest)
+ TmpDict['EM'] = EbuildsMetadata.objects.filter(Revision = '1.1').order_by('-Id')[:Lines]
+ TmpDict['BL'] = BuildLogs.objects.order_by('-TimeStamp')[:Lines]
+ BJ_Tmp = BuildJobs.objects.order_by('-TimeStamp')[:Lines]
+ for BJ in BJ_Tmp:
+ adict2 = {}
+ adict2['EbuildId'] = BJ.EbuildId.EbuildId
+ adict2['C'] = BJ.EbuildId.PackageId.CategoryId.Category
+ adict2['P'] = BJ.EbuildId.PackageId.Package
+ adict2['V'] = BJ.EbuildId.Version
+ adict2['R'] = BJ.EbuildId.PackageId.RepoId.Repo
+ adict2['title'] = "Setup: " + BJ.SetupId.Setup + "\n" + "Profile: " + BJ.SetupId.Profile + "\n"
+ BJU = BuildJobsUse.objects.filter(BuildJobId = BJ.BuildJobId)
+ if not BJU == []:
+ use_enable = []
+ use_disable = []
+ for BU in BJU:
+ if BU.Status:
+ use_enable.append(BU.UseId.Flag)
+ else:
+ use_disable.append(BU.UseId.Flag)
+ if not use_enable == []:
+ adict2['title'] = adict2['title'] + "Enable: "
+ for use in use_enable:
+ adict2['title'] = adict2['title'] + use + " "
+ adict2['title'] = adict2['title'] + "\n"
+ if not use_disable == []:
+ adict2['title'] = adict2['title'] + "Disable: "
+ for use in use_disable:
+ adict2['title'] = adict2['title'] + use + " "
+ adict2['title'] = adict2['title'] + "\n"
+ adict[BJ.BuildJobId] = adict2
+ TmpDict['BJ'] = adict
+ TmpDict['RM'] = BuildLogsRepomanQa.objects.order_by('-Id')[:Lines]
+ return render(request, 'pages/' + pagerequest + '/index.html', TmpDict)
+
+def categories(request):
+ pagerequest = 'packages'
+ TmpDict = default_TmpDict(pagerequest)
+ adict2 = {}
+ for CM in CategoriesMetadata.objects.filter(CategoryId__Active = True).order_by('CategoryId__Category'):
+ adict = {}
+ adict['CategoryId'] = CM.CategoryId.CategoryId
+ adict['Category'] = CM.CategoryId.Category
+ adict['Descriptions'] = CM.Descriptions
+ packages = []
+ for P in Packages.objects.filter(Active = True).filter(CategoryId_id = CM.CategoryId.CategoryId).order_by('Package'):
+ packages.append(P.Package + '\n')
+ adict['Packages'] = packages
+ adict2[CM.CategoryId.Category] = adict
+ TmpDict['CM_tmp'] = adict2
+ return render(request, 'pages/' + pagerequest + '/index.html', TmpDict)
+
+def packages(request, category_id):
+ pagerequest = 'packages'
+ TmpDict = default_TmpDict(pagerequest)
+ adict2 = {}
+ for PM in PackagesMetadata.objects.filter(PackageId__CategoryId_id = category_id).filter(PackageId__Active = True):
+ adict = {}
+ adict['PackageId'] = PM.PackageId.PackageId
+ adict['Package'] = PM.PackageId.Package
+ adict['Descriptions'] = PM.Descriptions
+ adict['Changlog'] =PM.Changlog
+ ebuilds = []
+ for E in Ebuilds.objects.filter(Active = True).filter(PackageId_id = PM.PackageId.PackageId):
+ ebuilds.append(E.Version + '::' + E.PackageId.RepoId.Repo + '\n')
+ adict['Ebuilds'] = ebuilds
+ adict2[PM.PackageId.Package] = adict
+ TmpDict['PM_tmp'] = adict2
+ TmpDict['C'] = get_object_or_404(Categories, CategoryId = category_id)
+ return render(request, 'pages/' + pagerequest + '/category/index.html', TmpDict)
+
+def ebuilds(request, package_id):
+ pagerequest = 'packages'
+ TmpDict = default_TmpDict(pagerequest)
+ TmpDict['EB_tmp'] = Ebuilds.objects.filter(PackageId_id = package_id)
+ TmpDict['P'] = get_object_or_404(Packages, PackageId = package_id)
+ return render(request, 'pages/' + pagerequest + '/ebuilds/index.html', TmpDict)
+
+def new(request):
+ pagerequest = 'new'
+ Lines = 20
adict = {}
TmpDict = default_TmpDict(pagerequest)
TmpDict['EM'] = EbuildsMetadata.objects.filter(Revision = '1.1').order_by('-Id')[:Lines]
diff --git a/python/templates/pages/new/index.html b/python/templates/pages/new/index.html
new file mode 100644
index 0000000..5195584
--- /dev/null
+++ b/python/templates/pages/new/index.html
@@ -0,0 +1,25 @@
+{% extends "layout/base.html" %}
+{% block content %}
+<div class="row">
+ <div class="col-xs-12 col-md-6">
+ <h2>New Packages <small>more at the <a href="/new_packages/">New Packages</a></small></h2>
+ {% include "includes/frontpage/new_packages" %}
+ </div>
+ <div class="col-xs-12 col-md-6">
+ <h2>New Logs <small>more at the <a href="/new_logs/">New Logs</a></small></h2>
+ {% include "includes/frontpage/new_logs" %}
+ </div>
+</div>
+
+<div class="row">
+ <div class="col-xs-12 col-md-6">
+ <h2>New Build Requests <small>more at the <a href="/new_build_req">New Build Requests</a></small></h2>
+ {% include "includes/frontpage/new_build_req" %}
+ </div>
+ <div class="col-xs-12 col-md-6">
+ <h2>New Repoman or QA's <small>on the <a href="/new_repoman_qa/">New Repoman or QA's</a></small></h2>
+ {% include "includes/frontpage/new_repoman_qa" %}
+ </div>
+</div>
+
+{% endblock %} \ No newline at end of file
diff --git a/python/templates/pages/packages/category/index.html b/python/templates/pages/packages/category/index.html
new file mode 100644
index 0000000..34c1426
--- /dev/null
+++ b/python/templates/pages/packages/category/index.html
@@ -0,0 +1,23 @@
+{% extends "layout/base.html" %}
+{% block content %}
+<div class="row">
+ <div class="col-xs-12 col-md-6">
+ <h2>Packages in {{ C.Category }}</h2>
+ <table class="table table-striped frontpage-table">
+ {% for key, PM in PM_tmp.items %}
+ <tr>
+ <td class="frontpage-table-package-atom">
+ <a href="/package/{{ PM.PackageId }}/" title="{{ C.Category }}/{{ key }}">{{ C.Category }}/{{ key }}</a>
+ <p title="{{ PM.Changlog }}">Changlog</p>
+ </td>
+ <td>
+ <p title="{{ PM.Descriptions }}">{{ PM.Descriptions }}</p>
+ <p title="{% for P in PM.Ebuilds %}{{ key }}/{{ P }}{% endfor %}">Versions</p>
+ </td>
+ </tr>
+ {% endfor %}
+</table>
+ </div>
+</div>
+
+{% endblock %} \ No newline at end of file
diff --git a/python/templates/pages/packages/ebuilds/index.html b/python/templates/pages/packages/ebuilds/index.html
new file mode 100644
index 0000000..a5ed0d6
--- /dev/null
+++ b/python/templates/pages/packages/ebuilds/index.html
@@ -0,0 +1,17 @@
+{% extends "layout/base.html" %}
+{% block content %}
+<div class="row">
+ <div class="col-xs-12 col-md-6">
+ <h2>{{ P.CategoryId.Category }}/{{ P.Package }}</h2>
+ <table class="table table-striped frontpage-table">
+ {% for E in EB_tmp %}
+ <tr>
+ <td class="frontpage-table-package-atom">
+ <a href="/ebuild/{{ E.EbuildId }}/" title="{{ P.CategoryId.Category }}/{{ P.Package }}-{{ E.Version }}::{{ E.PackageId.RepoId.Repo }}">{{ P.Package }}-{{ E.Version }}::{{ E.PackageId.RepoId.Repo }}</a></td>
+ <td><p></p></td>
+ </tr>
+ {% endfor %}
+</table>
+ </div>
+</div>
+{% endblock %} \ No newline at end of file
diff --git a/python/templates/pages/packages/index.html b/python/templates/pages/packages/index.html
new file mode 100644
index 0000000..82ccf59
--- /dev/null
+++ b/python/templates/pages/packages/index.html
@@ -0,0 +1,21 @@
+{% extends "layout/base.html" %}
+{% block content %}
+<div class="row">
+ <div class="col-xs-12 col-md-6">
+ <h2>Categories</h2>
+ <table class="table table-striped frontpage-table">
+ {% for key, CM in CM_tmp.items %}
+ <tr>
+ <td class="frontpage-table-package-atom">
+ <a href="/categories/{{ CM.CategoryId }}/" title="{{ key }}">{{ key }}</a></td>
+ <td>
+ <p title="{{ CM.Descriptions }}">{{ CM.Descriptions }}</p>
+ <p title="{% for P in CM.Packages %}{{ key }}/{{ P }}{% endfor %}">Packages</p>
+ </td>
+ </tr>
+ {% endfor %}
+</table>
+ </div>
+</div>
+
+{% endblock %} \ No newline at end of file