From fb308a94d6fd8690d3e82f8fe833bbe93791ec39 Mon Sep 17 00:00:00 2001 From: Magnus Granberg Date: Fri, 12 Feb 2016 23:41:24 +0100 Subject: redo the add buildinfo to packages --- python/tbc_www/views.py | 114 +++++++++++++-------- python/templates/includes/frontpage/new_logs | 26 +++-- python/templates/pages/new/logs/build/index.html | 28 ++--- .../templates/pages/packages/category/index.html | 13 ++- .../pages/packages/ebuilds/ebuild/index.html | 39 ++++--- python/templates/pages/packages/ebuilds/index.html | 5 +- 6 files changed, 136 insertions(+), 89 deletions(-) diff --git a/python/tbc_www/views.py b/python/tbc_www/views.py index c1124ff..b47cd88 100644 --- a/python/tbc_www/views.py +++ b/python/tbc_www/views.py @@ -44,20 +44,7 @@ def home(request): adict2['SummeryText'] = BL.SummeryText adict2['Fail'] = BL.Fail if BL.Fail: - BE_tmp = BuildLogsErrors.objects.filter(BuildLogId = BL.BuildLogId) - for BE in BE_tmp: - if BE.ErrorId.ErrorId == 3: - adict2['FailCode'] = 'OTHERS' - if BE.ErrorId.ErrorId >= 4: - adict2['FailCode'] = BE.ErrorId.ErrorName - adict2['Repoman'] = False - BLRe = BuildLogsRepoman.objects.filter(BuildLogId = BL.BuildLogId) - if BLRe.exists(): - adict2['Repoman'] = True - adict2['Qa'] = False - BLQe = BuildLogsQa.objects.filter(BuildLogId = BL.BuildLogId) - if BLQe.exists(): - adict2['Qa'] = True + adict2['BE_tmp'] = BuildLogsErrors.objects.filter(BuildLogId = BL.BuildLogId) alist.append(adict2) TmpDict['BL'] = alist adict = {} @@ -121,24 +108,28 @@ def packages(request, category_id): adict['Package'] = PM.PackageId.Package adict['Descriptions'] = PM.Descriptions adict['Commitlog'] =PM.Gitlog + adict['Repoman'] = False + adict['Qa'] = False + adict['Bl'] = False + adict['Blo'] = False + adict['Blb'] = False PR = PackagesRepoman.objects.filter(PackageId__PackageId = PM.PackageId.PackageId) if PR.exists(): adict['Repoman'] = True - else: - adict['Repoman'] = False BLQ = BuildLogsQa.objects.filter(BuildLogId__EbuildId__PackageId__PackageId = PM.PackageId.PackageId).filter(BuildLogId__EbuildId__Active = True) if BLQ.exists(): adict['Qa'] = True - else: - adict['Qa'] = False - BL = BuildLogs.objects.filter(EbuildId__PackageId__PackageId = PM.PackageId.PackageId).filter(EbuildId__Active = True) - if BL.exists(): + BL_tmp = BuildLogs.objects.filter(EbuildId__PackageId__PackageId = PM.PackageId.PackageId).filter(EbuildId__Active = True) + if BL_tmp.exists(): adict['Bl'] = True - adict['Blf'] = False - if BL.filter(Fail = True).exists(): - adict['Blf'] = True - else: - adict['Bl'] = False + if BL_tmp.filter(Fail = True).exists(): + for BL in BL_tmp: + BE_tmp = BuildLogsErrors.objects.filter(BuildLogId = BL.BuildLogId) + for BE in BE_tmp: + if BE.ErrorId.ErrorId == 3: + adict['Blo'] = True + if BE.ErrorId.ErrorId >= 4: + adict['Blb'] = 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') @@ -181,8 +172,17 @@ def ebuilds(request, package_id): adict = {} adict['EbuildId'] = EM.EbuildId.EbuildId adict['fail'] = False + adict['Blo'] = False + adict['Blb'] = False if BLe.filter(Fail = True).exists(): adict['fail'] = True + for BL in BLe: + BE_tmp = BuildLogsErrors.objects.filter(BuildLogId = BL.BuildLogId) + for BE in BE_tmp: + if BE.ErrorId.ErrorId == 3: + adict['Blo'] = True + if BE.ErrorId.ErrorId >= 4: + adict['Blb'] = True adict['repoman'] = False BLRe = BuildLogsRepoman.objects.filter(BuildLogId__EbuildId__EbuildId = EM.EbuildId.EbuildId).filter(BuildLogId__EbuildId__Active = True) if BLRe.exists(): @@ -192,6 +192,7 @@ def ebuilds(request, package_id): if BLQe.exists(): adict['qa'] = True alist.append(adict) + print(alist) TmpDict['fi_tmp'] = alist return render(request, 'pages/' + pagerequest + '/ebuilds/index.html', TmpDict) @@ -203,12 +204,30 @@ def ebuild(request, ebuild_id): TmpDict['EK_tmp'] = EbuildsKeywords.objects.filter(EbuildId__EbuildId = ebuild_id) BL_tmp = BuildLogs.objects.filter(EbuildId__EbuildId = ebuild_id) TmpDict['BL_tmp'] = BL_tmp + alist = [] + for BL in BL_tmp: + adict = {} + adict['BuildLogId'] = BL.BuildLogId + adict['repoman'] = False + adict['qa'] = False + adict['Blo'] = False + adict['Blb'] = False + if BL.Fail: + adict['fail'] = True + BE_tmp = BuildLogsErrors.objects.filter(BuildLogId__BuildLogId = BL.BuildLogId) + for BE in BE_tmp: + if BE.ErrorId.ErrorId == 1: + adict['repoman'] = True + if BE.ErrorId.ErrorId == 2: + adict['qa'] = True + if BE.ErrorId.ErrorId == 3: + adict['Blo'] = True + if BE.ErrorId.ErrorId >= 4: + adict['Blb'] = True + alist.append(adict) + TmpDict['fi_tmp'] = alist TmpDict['EU_tmp'] = EbuildsIuse.objects.filter(EbuildId__EbuildId = ebuild_id) TmpDict['ER_tmp'] = EbuildsRestrictions.objects.filter(EbuildId__EbuildId = ebuild_id) - BLQ_tmp = BuildLogsQa.objects.filter(BuildLogId__EbuildId__EbuildId = ebuild_id).filter(BuildLogId__EbuildId__Active = True) - TmpDict['BLQ_tmp'] = BLQ_tmp - BLR_tmp = BuildLogsRepoman.objects.filter(BuildLogId__EbuildId__EbuildId = ebuild_id).filter(BuildLogId__EbuildId__Active = True) - TmpDict['BLR_tmp']= BLR_tmp return render(request, 'pages/' + pagerequest + '/ebuilds/ebuild/index.html', TmpDict) @@ -226,22 +245,13 @@ def new_main(request): adict2['V'] = BL.EbuildId.Version adict2['R'] = BL.EbuildId.PackageId.RepoId.Repo adict2['Fail'] = BL.Fail + adict2['FailB'] = False adict2['SummeryText'] = BL.SummeryText if BL.Fail: - BE_tmp = BuildLogsErrors.objects.filter(BuildLogId = BL.BuildLogId) - for BE in BE_tmp: - if BE.ErrorId.ErrorId == 3: - adict2['FailCode'] = 'OTHERS' - if BE.ErrorId.ErrorId >= 4: - adict2['FailCode'] = BE.ErrorId.ErrorName - adict2['Repoman'] = False - BLRe = BuildLogsRepoman.objects.filter(BuildLogId = BL.BuildLogId) - if BLRe.exists(): - adict2['Repoman'] = True - adict2['Qa'] = False - BLQe = BuildLogsQa.objects.filter(BuildLogId = BL.BuildLogId) - if BLQe.exists(): - adict2['Qa'] = True + adict2['BE_tmp'] = BuildLogsErrors.objects.filter(BuildLogId = BL.BuildLogId) + for BE in adict2['BE_tmp']: + if BE.ErrorId.ErrorId >= 3: + adict2['FailB'] = True alist.append(adict2) TmpDict['BL'] = alist adict = {} @@ -329,8 +339,6 @@ def new_logs_build(request, buildlog_id): BLI['PD'] = EM.Descriptions BLI['PC'] = PM.Gitlog BLI['Fail'] = B.Fail - if B.Fail: - BLI['BE_tmp'] = BuildLogsErrors.objects.filter(BuildLogId = buildlog_id) BLI['Summery_text'] = B.SummeryText if B.BugId == "0": BLI['BugId'] = False @@ -362,6 +370,22 @@ def new_logs_build(request, buildlog_id): BLI['use_enable'] = use_enable if not use_disable == []: BLI['use_disable'] = use_disable + adict = {} + adict['repoman'] = False + adict['qa'] = False + adict['Blo'] = False + adict['Blb'] = False + BE_tmp = BuildLogsErrors.objects.filter(BuildLogId__BuildLogId = buildlog_id) + for BE in BE_tmp: + if BE.ErrorId.ErrorId == 1: + adict['repoman'] = True + if BE.ErrorId.ErrorId == 2: + adict['qa'] = True + if BE.ErrorId.ErrorId == 3: + adict['Blo'] = True + if BE.ErrorId.ErrorId >= 4: + adict['Blb'] = True + TmpDict['FI'] = adict try: BRQ = BuildLogsQa.objects.get(BuildLogId = B.BuildLogId) BLI['QA'] = BRQ.SummeryText diff --git a/python/templates/includes/frontpage/new_logs b/python/templates/includes/frontpage/new_logs index 1acbbc2..bb97536 100644 --- a/python/templates/includes/frontpage/new_logs +++ b/python/templates/includes/frontpage/new_logs @@ -6,19 +6,23 @@

{{ B.SummeryText|truncatewords:3 }}

{% if B.Fail %} - {% if B.FailCode == 'OTHERS' %} - {{ B.FailCode }} - {% else %} - {{ B.FailCode }} + {% for BE in B.BE_tmp %} + {% if BE.BuildLogId.BuildLogId == B.BuildLogId %} + {% if BE.ErrorId.ErrorId == 1 or BE.ErrorId.ErrorId == 2 %} + {{ BE.ErrorId.ErrorName|upper }} + {% endif %} + {% if BE.ErrorId.ErrorId == 3 %} + {{ BE.ErrorId.ErrorName|upper }} + {% elif BE.ErrorId.ErrorId > 3 %} + {{ BE.ErrorId.ErrorName|upper }} + {% endif %} + {% endif %} + {% endfor %} + {% if not B.FailB %} + BUILD {% endif %} {% else %} - Build - {% endif %} - {% if B.Repoman %} - Repoman - {% endif %} - {% if B.Qa %} - Qa + Ok {% endif %} diff --git a/python/templates/pages/new/logs/build/index.html b/python/templates/pages/new/logs/build/index.html index 5c2a9b6..a79e54a 100644 --- a/python/templates/pages/new/logs/build/index.html +++ b/python/templates/pages/new/logs/build/index.html @@ -2,20 +2,24 @@ {% block content %}

{{ BLI.C }}/{{ BLI.P }}-{{ BLI.V }}::{{ BLI.R }} - {% if BLI.Fail %} - {% for BE in BLI.BE_tmp %} - {% if BE.ErrorId.ErrorId == 1 %} - {{ BE.ErrorId.ErrorName|upper }} - {% elif BE.ErrorId.ErrorId == 2 %} - {{ BE.ErrorId.ErrorName|upper }} - {% elif BE.ErrorId.ErrorId == 3 %} - OTHERS + {% if FI.Blo %} + Others + {% else %} + {% if FI.qa %} + Qa {% else %} - {{ BE.ErrorId.ErrorName|upper }} + Qa + {% endif %} + {% if FI.repoman %} + Repoman + {% else %} + Repoman + {% endif %} + {% if FI.Blb %} + Build + {% else %} + Build {% endif %} - {% endfor %} - {% else %} - OK {% endif %}

diff --git a/python/templates/pages/packages/category/index.html b/python/templates/pages/packages/category/index.html index d86b3cb..c6903f0 100644 --- a/python/templates/pages/packages/category/index.html +++ b/python/templates/pages/packages/category/index.html @@ -16,16 +16,19 @@ {% if PM.Repoman %} Repoman {% endif %} - {% if PM.Qa %} - Qa - {% endif %} {% if PM.Bl %} - {% if PM.Blf %} + {% if PM.Qa %} + Qa + {% endif %} + {% if PM.Blo %} + Others + {% endif %} + {% if PM.Blb %} {% else %} {% endif %} - Build + Build {% endif %}

diff --git a/python/templates/pages/packages/ebuilds/ebuild/index.html b/python/templates/pages/packages/ebuilds/ebuild/index.html index 6f2166a..49ad3e5 100644 --- a/python/templates/pages/packages/ebuilds/ebuild/index.html +++ b/python/templates/pages/packages/ebuilds/ebuild/index.html @@ -41,21 +41,30 @@ {% for BL in BL_tmp %} - {% if BL.Fail %} - Build - {% else %} - Build - {% endif %} - {% for BLR in BLR_tmp %} - {% if BLR.BuildLogId.BuildLogId == BL.BuildLogId%} - Repoman - {% endif %} - {% endfor %} - {% for BLQ in BLQ_tmp %} - {% if BLQ.BuildLogId.BuildLogId == BL.BuildLogId%} - Qa - {% endif %} - {% endfor %} + {% for FI in fi_tmp %} + {% if FI.BuildLogId == BL.BuildLogId %} + {% if FI.Blo %} + Others + {% else %} + {% if FI.qa %} + Qa + {% else %} + Qa + {% endif %} + {% if FI.repoman %} + Repoman + {% else %} + Repoman + {% endif %} + + {% if FI.Blb %} + Build + {% else %} + Build + {% endif %} + {% endif %} + {% endif %} + {% endfor %} More info diff --git a/python/templates/pages/packages/ebuilds/index.html b/python/templates/pages/packages/ebuilds/index.html index 0107d0b..77bd8eb 100644 --- a/python/templates/pages/packages/ebuilds/index.html +++ b/python/templates/pages/packages/ebuilds/index.html @@ -23,7 +23,10 @@ {% else %} Repoman {% endif %} - {% if FI.fail %} + {% if FI.Blo %} + Others + {% endif %} + {% if FI.Blb %} Build {% else %} Build -- cgit v1.2.3-65-gdbad