diff options
author | 2015-08-02 01:02:22 +0200 | |
---|---|---|
committer | 2015-08-02 01:02:22 +0200 | |
commit | 96969fe37a3f589bbd0a9688979c7cd332cf5c1d (patch) | |
tree | dce65939341becf47e07399a9ef4b7dcbf8a4656 | |
parent | add repoman and qa page on new (diff) | |
download | tinderbox-cluster-www-96969fe37a3f589bbd0a9688979c7cd332cf5c1d.tar.gz tinderbox-cluster-www-96969fe37a3f589bbd0a9688979c7cd332cf5c1d.tar.bz2 tinderbox-cluster-www-96969fe37a3f589bbd0a9688979c7cd332cf5c1d.zip |
add repoman full support
-rw-r--r-- | python/tbc_www/models.py | 13 | ||||
-rw-r--r-- | python/tbc_www/views.py | 30 | ||||
-rw-r--r-- | python/templates/includes/frontpage/new_repoman_qa | 16 | ||||
-rw-r--r-- | python/templates/pages/packages/category/index.html | 6 | ||||
-rw-r--r-- | python/templates/pages/packages/ebuilds/index.html | 3 |
5 files changed, 54 insertions, 14 deletions
diff --git a/python/tbc_www/models.py b/python/tbc_www/models.py index 2cb327a..efdc13a 100644 --- a/python/tbc_www/models.py +++ b/python/tbc_www/models.py @@ -89,7 +89,7 @@ class BuildLogs(models.Model): 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) -class BuildLogsRepomanQa(models.Model): +class BuildLogsQa(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') @@ -98,6 +98,17 @@ class BuildLogsRepomanQa(models.Model): def __str__(self): return '%s %s %s' % (self.Id, self.BuildLogId, self.SummeryText) +class PackagesRepoman(models.Model): + Id = models.IntegerField(primary_key=True, db_column='id') + PackageId = models.ForeignKey(Packages, db_column='package_id') + RepomanText = models.TextField(db_column='repoman_text') + RepomanHash = models.CharField(max_length=100, db_column='repoman_hash') + TimeStamp = models.DateTimeField(db_column='time_stamp') + class Meta: + db_table = 'packages_repoman' + def __str__(self): + return '%s %s %s %s %s' % (self.Id, self.PackageId, self.RepomanText, self.RepomanHash, self.TimeStamp) + class ErrorsInfo(models.Model): ErrorId = models.IntegerField(primary_key=True, db_column='error_id') ErrorName = models.CharField(max_length=20, db_column='error_name') diff --git a/python/tbc_www/views.py b/python/tbc_www/views.py index 7e99671..ff9a201 100644 --- a/python/tbc_www/views.py +++ b/python/tbc_www/views.py @@ -5,9 +5,9 @@ from django.shortcuts import render, get_object_or_404, HttpResponseRedirect 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, \ +from tbc_www.models import EbuildsMetadata, BuildLogs, BuildJobs, BuildLogsQa, \ BuildJobsUse, Categories, CategoriesMetadata, Packages, PackagesMetadata, Ebuilds, \ - Repos, EbuildsKeywords, BuildLogsErrors, EbuildsRestrictions, EbuildsIuse + Repos, EbuildsKeywords, BuildLogsErrors, EbuildsRestrictions, EbuildsIuse, PackagesRepoman import re def default_TmpDict(pagerequest): @@ -29,7 +29,7 @@ def default_TmpDict(pagerequest): def home(request): pagerequest = 'home' - Lines = 5 + Lines = 10 TmpDict = default_TmpDict(pagerequest) TmpDict['EM'] = EbuildsMetadata.objects.filter(Revision = '1.1').order_by('-Id')[:Lines] alist = [] @@ -77,7 +77,8 @@ def home(request): adict2['title'] = adict2['title'] + "\n" adict[BJ.BuildJobId] = adict2 TmpDict['BJ'] = adict - TmpDict['RM'] = BuildLogsRepomanQa.objects.order_by('-Id')[:Lines] + TmpDict['QA_tmp'] = BuildLogsQa.objects.order_by('-Id')[:Lines/2] + TmpDict['PR_tmp'] = PackagesRepoman.objects.order_by('-Id')[:Lines/2] return render(request, 'pages/' + pagerequest + '/index.html', TmpDict) def categories(request): @@ -107,6 +108,12 @@ def packages(request, category_id): adict['Package'] = PM.PackageId.Package adict['Descriptions'] = PM.Descriptions adict['Changlog'] =PM.Changlog + try: + PackagesRepoman.objects.get(PackageId__PackageId = PM.PackageId.PackageId) + except PackagesRepoman.DoesNotExist as e: + adict['Repoman'] = False + else: + adict['Repoman'] = True ebuilds = [] for E in Ebuilds.objects.filter(Active = True).filter(PackageId__Package = PM.PackageId.Package): ebuilds.append(E.Version + '::' + E.PackageId.RepoId.Repo + '\n') @@ -119,11 +126,16 @@ def packages(request, category_id): def ebuilds(request, package_id): pagerequest = 'packages' TmpDict = default_TmpDict(pagerequest) - P = get_object_or_404(PackagesMetadata, PackageId__PackageId = package_id) + P = get_object_or_404(PackagesMetadata, PackageId__PackageId = package_id) TmpDict['P'] = P TmpDict['EM_tmp'] = EbuildsMetadata.objects.filter(EbuildId__Active = True).filter(EbuildId__PackageId__Package = P.PackageId.Package) TmpDict['EK_tmp'] = EbuildsKeywords.objects.filter(EbuildId__Active = True).filter(EbuildId__PackageId__Package = P.PackageId.Package) - + try: + PackagesRepoman.objects.get(PackageId__PackageId = package_id) + except PackagesRepoman.DoesNotExist as e: + TmpDict['PR'] = False + else: + TmpDict['PR'] = True return render(request, 'pages/' + pagerequest + '/ebuilds/index.html', TmpDict) def ebuild(request, ebuild_id): @@ -188,12 +200,14 @@ def new_main(request): adict2['title'] = adict2['title'] + "\n" adict[BJ.BuildJobId] = adict2 TmpDict['BJ'] = adict - TmpDict['RM'] = BuildLogsRepomanQa.objects.order_by('-Id')[:Lines] + TmpDict['QA_tmp'] = BuildLogsQa.objects.order_by('-Id')[:Lines/2] + TmpDict['PR_tmp'] = PackagesRepoman.objects.order_by('-Id')[:Lines/2] return render(request, 'pages/' + pagerequest + '/index.html', TmpDict) def new_repomanqa(request): pagerequest = 'new' Lines = 30 TmpDict = default_TmpDict(pagerequest) - TmpDict['RM_tmp'] = BuildLogsRepomanQa.objects.order_by('-Id')[:Lines] + TmpDict['QA_tmp'] = BuildLogsQa.objects.order_by('-Id')[:Lines/2] + TmpDict['PR_tmp'] = PackagesRepoman.objects.order_by('-Id')[:Lines/2] return render(request, 'pages/' + pagerequest + '/repomanqa/index.html', TmpDict) diff --git a/python/templates/includes/frontpage/new_repoman_qa b/python/templates/includes/frontpage/new_repoman_qa index 1999362..61ac691 100644 --- a/python/templates/includes/frontpage/new_repoman_qa +++ b/python/templates/includes/frontpage/new_repoman_qa @@ -1,10 +1,18 @@ <table class="table table-striped frontpage-table"> - {% for R in RM %} + {% for QA in QA_tmp %} <tr> - <td class="frontpage-table-package-atom"><a href="/repoman_qa/{{ R.BuildLogId.BuildLogId }}/" title="{{ R.BuildLogId.EbuildId.PackageId.CategoryId.Category }}/{{ R.BuildLogId.EbuildId.PackageId.Package }}-{{ R.BuildLogId.EbuildId.Version }}::{{ R.BuildLogId.EbuildId.PackageId.RepoId.Repo }}"> - {{ R.BuildLogId.EbuildId.PackageId.CategoryId.Category }}/{{ R.BuildLogId.EbuildId.PackageId.Package }}-{{ R.BuildLogId.EbuildId.Version }}::{{ R.BuildLogId.EbuildId.PackageId.RepoId.Repo }}</a> + <td class="frontpage-table-package-atom"><a href="/repoman_qa/{{ QA.BuildLogId.BuildLogId }}/" title="{{ QA.BuildLogId.EbuildId.PackageId.CategoryId.Category }}/{{ QA.BuildLogId.EbuildId.PackageId.Package }}-{{ QA.BuildLogId.EbuildId.Version }}::{{ QA.BuildLogId.EbuildId.PackageId.RepoId.Repo }}"> + {{ QA.BuildLogId.EbuildId.PackageId.CategoryId.Category }}/{{ QA.BuildLogId.EbuildId.PackageId.Package }}-{{ QA.BuildLogId.EbuildId.Version }}::{{ QA.BuildLogId.EbuildId.PackageId.RepoId.Repo }}</a> </td> - <td><p title="{{ R.SummeryText }}">{{ R.SummeryText|truncatewords:3 }}</p></td> + <td><p title="{{ QA.SummeryText }}">{{ QA.SummeryText|truncatewords:3 }}</p></td> + </tr> + {% endfor %} + {% for PR in PR_tmp %} + <tr> + <td class="frontpage-table-package-atom"><a href="/repoman/{{ PR.PackageId.PackageId }}/" title="{{ PR.PackageId.CategoryId.Category }}/{{ PR.PackageId.Package }}::{{ PR.PackageId.RepoId.Repo }}"> + {{ PR.PackageId.CategoryId.Category }}/{{ PR.PackageId.Package }}::{{ PR.PackageId.RepoId.Repo }}</a> + </td> + <td><p title="{{ PR.RepomanText }}">{{ PR.RepomanText|truncatewords:3 }}</p></td> </tr> {% endfor %} </table>
\ No newline at end of file diff --git a/python/templates/pages/packages/category/index.html b/python/templates/pages/packages/category/index.html index 2f2b6f2..8cc402d 100644 --- a/python/templates/pages/packages/category/index.html +++ b/python/templates/pages/packages/category/index.html @@ -12,7 +12,11 @@ </td> <td> <p title="{{ PM.Descriptions }}">{{ PM.Descriptions }}</p> - <p title="{% for P in PM.Ebuilds %}{{ PM.Package }}/{{ P }}{% endfor %}">Versions</p> + <p title="{% for P in PM.Ebuilds %}{{ PM.Package }}/{{ P }}{% endfor %}">Versions + {% if PM.Repoman %} + <a class="btn btn-warning btn-xs" href="/repoman/{{PM.PackageId }}/">Repoman</a> + {% endif %} + </p> </td> </tr> </table> diff --git a/python/templates/pages/packages/ebuilds/index.html b/python/templates/pages/packages/ebuilds/index.html index f8e1b4e..10cca76 100644 --- a/python/templates/pages/packages/ebuilds/index.html +++ b/python/templates/pages/packages/ebuilds/index.html @@ -23,5 +23,8 @@ {% endfor %} </table> </div> + {% if PR %} + <a class="btn btn-warning btn-xs" href="/repoman/{{P.PackageId.PackageId }}/">Repoman</a> + {% endif %} </div> {% endblock %}
\ No newline at end of file |