switched status page to a dark theme, added archweb links

This commit is contained in:
2021-11-21 15:24:27 +01:00
parent 7347c7705b
commit 8c1e8c1835
4 changed files with 53 additions and 54 deletions

View File

@@ -39,15 +39,5 @@ build:
worker: 4
makej: 8
status:
class:
skipped: "secondary"
queued: "warning"
latest: "primary"
failed: "danger"
signing: "success"
building: "info"
unknown: "dark"
logging:
level: INFO

View File

@@ -20,7 +20,6 @@ import (
"os/exec"
"os/signal"
"path/filepath"
"regexp"
"runtime"
"strconv"
"strings"
@@ -33,9 +32,6 @@ var (
conf *Conf
repos []string
alpmHandle *alpm.Handle
reMarch = regexp.MustCompile(`(-march=)(.+?) `)
rePkgRel = regexp.MustCompile(`(?m)^pkgrel\s*=\s*(.+)$`)
rePkgFile = regexp.MustCompile(`^(.*)-.*-.*-(?:x86_64|any)\.pkg\.tar\.zst(?:\.sig)*$`)
buildManager *BuildManager
db *ent.Client
journalLog = flag.Bool("journal", false, "Log to systemd journal instead of stdout")
@@ -348,12 +344,11 @@ func (b *BuildManager) htmlWorker() {
pkgs := db.DbPackage.Query().Order(ent.Asc(dbpackage.FieldPkgbase)).Where(dbpackage.MarchEQ(march), dbpackage.RepositoryEQ(dbpackage.Repository(repo))).AllX(context.Background())
for _, pkg := range pkgs {
status, class := statusId2string(pkg.Status)
addPkg := Pkg{
Pkgbase: pkg.Pkgbase,
Status: status,
Class: class,
Status: strings.ToUpper(pkg.Status.String()),
Class: pkg.Status.String(),
Skip: pkg.SkipReason,
Version: pkg.RepoVersion,
Svn2GitVersion: pkg.Version,

View File

@@ -16,8 +16,34 @@
</style>
<title>ALHP Status</title>
<style>
.table-latest {
--bs-table-bg: #172322;
}
.table-skipped {
--bs-table-bg: #2d2d2d;
}
.table-failed {
--bs-table-bg: #412323;
}
.table-queued {
--bs-table-bg: #8f833a;
}
.table-building {
--bs-table-bg: #375e9d;
}
.table-unknown {
--bs-table-bg: #969696;
}
</style>
</head>
<body>
<body class="bg-dark">
<nav class="navbar navbar-expand-lg sticky-top navbar-light bg-info mb-5">
<div class="container">
<div class="d-flex justify-content-start">
@@ -35,25 +61,26 @@
</div>
</nav>
<div class="container">
<div class="container text-light">
{{range $march := .March}}
<h3>{{$march.Name}}</h3>
<div class="accordion" id="accordion-{{$march.Name}}">
{{range $repo := $march.Repos}}
<div class="accordion-item">
<div class="accordion-item bg-dark bg-opacity-25 border-light">
<h2 class="accordion-header" id="heading-{{$march.Name}}-{{$repo.Name}}">
<button aria-controls="collapse-{{$march.Name}}-{{$repo.Name}}" aria-expanded="false"
class="accordion-button"
class="accordion-button bg-opacity-50 bg-dark text-light border-light"
data-bs-target="#collapse-{{$march.Name}}-{{$repo.Name}}"
data-bs-toggle="collapse"
type="button">{{$repo.Name}}-{{$march.Name}}
</button>
</h2>
<div aria-labelledby="heading-{{$march.Name}}-{{$repo.Name}}" class="accordion-collapse collapse show"
<div aria-labelledby="heading-{{$march.Name}}-{{$repo.Name}}"
class="accordion-collapse collapse show border-light"
data-bs-parent="#accordion-{{$march.Name}}" id="collapse-{{$march.Name}}-{{$repo.Name}}">
<div class="accordion-body overflow-auto">
<table class="table table-sorted">
<thead>
<thead class="text-light">
<tr>
<th scope="col">Pkgbase</th>
<th scope="col">Status</th>
@@ -61,30 +88,29 @@
<th class="text-center" scope="col" title="link time optimization">LTO</th>
<th scope="col">SVN2GIT Version</th>
<th scope="col">{{$repo.Name}}-{{$march.Name}} Version</th>
<th scope="col">Info</th>
<th class="text-end" scope="col">Info</th>
</tr>
</thead>
<tbody>
{{range $pkg := $repo.Packages}}
<tr class="{{$pkg.Class}}" id="{{$repo.Name}}-{{$march.Name}}-{{$pkg.Pkgbase}}">
<td>{{$pkg.Pkgbase}} <a class="text-muted small text-decoration-none"
href="https://archlinux.org/packages/?q={{$pkg.Pkgbase}}"><sup>AW</sup></a>
</td>
<tr class="table-dark table-{{$pkg.Class}}"
id="{{$repo.Name}}-{{$march.Name}}-{{$pkg.Pkgbase}}">
<td>{{$pkg.Pkgbase}}</td>
<td>{{$pkg.Status}}</td>
<td>{{$pkg.Skip}}</td>
<td class="text-center">
{{if $pkg.LTO}}<i class="bi bi-check-lg" style="color: var(--bs-success);"
title="build with LTO"></i>{{end}}
{{if $pkg.LTODisabled}}<i class="bi bi-x-lg" style="color: var(--bs-danger);"
title="LTO explicit disabled"></i>{{end}}
<td class="text-center text-light">
{{if $pkg.LTO}}<i class="bi bi-check-lg" title="build with LTO"></i>{{end}}
{{if $pkg.LTODisabled}}<i class="bi bi-x-lg" title="LTO explicit disabled"></i>{{end}}
{{if $pkg.LTOUnknown}}<i class="bi bi-hourglass" title="not build with LTO yet"></i>{{end}}
</td>
<td>{{$pkg.Svn2GitVersion}}</td>
<td>{{$pkg.Version}}</td>
<td class="text-center">
<td class="text-end text-light">
{{with $pkg.Log}}<a href="{{.}}"
><i class="bi bi-file-text-fill"></i></a
>{{end}}
<a class="text-decoration-none fw-bold"
href="https://archlinux.org/packages/?q={{$pkg.Pkgbase}}">AW</a>
<a data-bs-html="true" data-bs-placement="bottom" data-bs-toggle="tooltip"
href="#{{$repo.Name}}-{{$march.Name}}-{{$pkg.Pkgbase}}"
title="{{if $pkg.BuildDate}}Build on {{$pkg.BuildDate}}&#10;{{end}}{{if $pkg.BuildDuration}}Build duration: {{$pkg.BuildDuration}}&#10;{{end}}Last checked on {{$pkg.Checked}}">

View File

@@ -16,6 +16,7 @@ import (
"os"
"os/exec"
"path/filepath"
"regexp"
"strconv"
"strings"
"sync"
@@ -30,6 +31,12 @@ const (
lastUpdate = "lastupdate"
)
var (
reMarch = regexp.MustCompile(`(-march=)(.+?) `)
rePkgRel = regexp.MustCompile(`(?m)^pkgrel\s*=\s*(.+)$`)
rePkgFile = regexp.MustCompile(`^(.+)(?:-.+){2}-(?:x86_64|any)\.pkg\.tar\.zst(?:\.sig)*$`)
)
type BuildPackage struct {
Pkgbase string
Pkgbuild string
@@ -135,25 +142,6 @@ func containsSubStr(str string, subList []string) bool {
return false
}
func statusId2string(s dbpackage.Status) (string, string) {
switch s {
case dbpackage.StatusSkipped:
return "SKIPPED", "table-" + conf.Status.Class.Skipped
case dbpackage.StatusQueued:
return "QUEUED", "table-" + conf.Status.Class.Queued
case dbpackage.StatusLatest:
return "LATEST", "table-" + conf.Status.Class.Latest
case dbpackage.StatusFailed:
return "FAILED", "table-" + conf.Status.Class.Failed
case dbpackage.StatusSigning:
return "SIGNING", "table-" + conf.Status.Class.Signing
case dbpackage.StatusBuilding:
return "BUILDING", "table-" + conf.Status.Class.Building
default:
return "UNKNOWN", "table-" + conf.Status.Class.Unknown
}
}
func (p *BuildPackage) repoVersion() (string, error) {
err := p.findPkgFiles()
if err != nil {
@@ -578,7 +566,7 @@ func housekeeping(repo string, wg *sync.WaitGroup) error {
buildManager.alpmMutex.Unlock()
if err != nil || pkgResolved.DB().Name() != pkg.DbPackage.Repository.String() {
// package not found on mirror/db -> not part of any repo anymore
log.Infof("[HK/%s/%s] not part of repo", pkg.FullRepo, pkg.Pkgbase)
log.Infof("[HK/%s/%s] not included in repo", pkg.FullRepo, pkg.Pkgbase)
buildManager.repoPurge[pkg.FullRepo] <- pkg
err = db.DbPackage.DeleteOne(pkg.DbPackage).Exec(context.Background())
if err != nil {