forked from ALHP/ALHP.GO
switched status page to a dark theme, added archweb links
This commit is contained in:
@@ -39,15 +39,5 @@ build:
|
|||||||
worker: 4
|
worker: 4
|
||||||
makej: 8
|
makej: 8
|
||||||
|
|
||||||
status:
|
|
||||||
class:
|
|
||||||
skipped: "secondary"
|
|
||||||
queued: "warning"
|
|
||||||
latest: "primary"
|
|
||||||
failed: "danger"
|
|
||||||
signing: "success"
|
|
||||||
building: "info"
|
|
||||||
unknown: "dark"
|
|
||||||
|
|
||||||
logging:
|
logging:
|
||||||
level: INFO
|
level: INFO
|
9
main.go
9
main.go
@@ -20,7 +20,6 @@ import (
|
|||||||
"os/exec"
|
"os/exec"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"regexp"
|
|
||||||
"runtime"
|
"runtime"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
@@ -33,9 +32,6 @@ var (
|
|||||||
conf *Conf
|
conf *Conf
|
||||||
repos []string
|
repos []string
|
||||||
alpmHandle *alpm.Handle
|
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
|
buildManager *BuildManager
|
||||||
db *ent.Client
|
db *ent.Client
|
||||||
journalLog = flag.Bool("journal", false, "Log to systemd journal instead of stdout")
|
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())
|
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 {
|
for _, pkg := range pkgs {
|
||||||
status, class := statusId2string(pkg.Status)
|
|
||||||
|
|
||||||
addPkg := Pkg{
|
addPkg := Pkg{
|
||||||
Pkgbase: pkg.Pkgbase,
|
Pkgbase: pkg.Pkgbase,
|
||||||
Status: status,
|
Status: strings.ToUpper(pkg.Status.String()),
|
||||||
Class: class,
|
Class: pkg.Status.String(),
|
||||||
Skip: pkg.SkipReason,
|
Skip: pkg.SkipReason,
|
||||||
Version: pkg.RepoVersion,
|
Version: pkg.RepoVersion,
|
||||||
Svn2GitVersion: pkg.Version,
|
Svn2GitVersion: pkg.Version,
|
||||||
|
@@ -16,8 +16,34 @@
|
|||||||
</style>
|
</style>
|
||||||
|
|
||||||
<title>ALHP Status</title>
|
<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>
|
</head>
|
||||||
<body>
|
<body class="bg-dark">
|
||||||
<nav class="navbar navbar-expand-lg sticky-top navbar-light bg-info mb-5">
|
<nav class="navbar navbar-expand-lg sticky-top navbar-light bg-info mb-5">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="d-flex justify-content-start">
|
<div class="d-flex justify-content-start">
|
||||||
@@ -35,25 +61,26 @@
|
|||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<div class="container">
|
<div class="container text-light">
|
||||||
{{range $march := .March}}
|
{{range $march := .March}}
|
||||||
<h3>{{$march.Name}}</h3>
|
<h3>{{$march.Name}}</h3>
|
||||||
<div class="accordion" id="accordion-{{$march.Name}}">
|
<div class="accordion" id="accordion-{{$march.Name}}">
|
||||||
{{range $repo := $march.Repos}}
|
{{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}}">
|
<h2 class="accordion-header" id="heading-{{$march.Name}}-{{$repo.Name}}">
|
||||||
<button aria-controls="collapse-{{$march.Name}}-{{$repo.Name}}" aria-expanded="false"
|
<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-target="#collapse-{{$march.Name}}-{{$repo.Name}}"
|
||||||
data-bs-toggle="collapse"
|
data-bs-toggle="collapse"
|
||||||
type="button">{{$repo.Name}}-{{$march.Name}}
|
type="button">{{$repo.Name}}-{{$march.Name}}
|
||||||
</button>
|
</button>
|
||||||
</h2>
|
</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}}">
|
data-bs-parent="#accordion-{{$march.Name}}" id="collapse-{{$march.Name}}-{{$repo.Name}}">
|
||||||
<div class="accordion-body overflow-auto">
|
<div class="accordion-body overflow-auto">
|
||||||
<table class="table table-sorted">
|
<table class="table table-sorted">
|
||||||
<thead>
|
<thead class="text-light">
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="col">Pkgbase</th>
|
<th scope="col">Pkgbase</th>
|
||||||
<th scope="col">Status</th>
|
<th scope="col">Status</th>
|
||||||
@@ -61,30 +88,29 @@
|
|||||||
<th class="text-center" scope="col" title="link time optimization">LTO</th>
|
<th class="text-center" scope="col" title="link time optimization">LTO</th>
|
||||||
<th scope="col">SVN2GIT Version</th>
|
<th scope="col">SVN2GIT Version</th>
|
||||||
<th scope="col">{{$repo.Name}}-{{$march.Name}} 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>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{{range $pkg := $repo.Packages}}
|
{{range $pkg := $repo.Packages}}
|
||||||
<tr class="{{$pkg.Class}}" id="{{$repo.Name}}-{{$march.Name}}-{{$pkg.Pkgbase}}">
|
<tr class="table-dark table-{{$pkg.Class}}"
|
||||||
<td>{{$pkg.Pkgbase}} <a class="text-muted small text-decoration-none"
|
id="{{$repo.Name}}-{{$march.Name}}-{{$pkg.Pkgbase}}">
|
||||||
href="https://archlinux.org/packages/?q={{$pkg.Pkgbase}}"><sup>AW</sup></a>
|
<td>{{$pkg.Pkgbase}}</td>
|
||||||
</td>
|
|
||||||
<td>{{$pkg.Status}}</td>
|
<td>{{$pkg.Status}}</td>
|
||||||
<td>{{$pkg.Skip}}</td>
|
<td>{{$pkg.Skip}}</td>
|
||||||
<td class="text-center">
|
<td class="text-center text-light">
|
||||||
{{if $pkg.LTO}}<i class="bi bi-check-lg" style="color: var(--bs-success);"
|
{{if $pkg.LTO}}<i class="bi bi-check-lg" title="build with LTO"></i>{{end}}
|
||||||
title="build with LTO"></i>{{end}}
|
{{if $pkg.LTODisabled}}<i class="bi bi-x-lg" title="LTO explicit disabled"></i>{{end}}
|
||||||
{{if $pkg.LTODisabled}}<i class="bi bi-x-lg" style="color: var(--bs-danger);"
|
|
||||||
title="LTO explicit disabled"></i>{{end}}
|
|
||||||
{{if $pkg.LTOUnknown}}<i class="bi bi-hourglass" title="not build with LTO yet"></i>{{end}}
|
{{if $pkg.LTOUnknown}}<i class="bi bi-hourglass" title="not build with LTO yet"></i>{{end}}
|
||||||
</td>
|
</td>
|
||||||
<td>{{$pkg.Svn2GitVersion}}</td>
|
<td>{{$pkg.Svn2GitVersion}}</td>
|
||||||
<td>{{$pkg.Version}}</td>
|
<td>{{$pkg.Version}}</td>
|
||||||
<td class="text-center">
|
<td class="text-end text-light">
|
||||||
{{with $pkg.Log}}<a href="{{.}}"
|
{{with $pkg.Log}}<a href="{{.}}"
|
||||||
><i class="bi bi-file-text-fill"></i></a
|
><i class="bi bi-file-text-fill"></i></a
|
||||||
>{{end}}
|
>{{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"
|
<a data-bs-html="true" data-bs-placement="bottom" data-bs-toggle="tooltip"
|
||||||
href="#{{$repo.Name}}-{{$march.Name}}-{{$pkg.Pkgbase}}"
|
href="#{{$repo.Name}}-{{$march.Name}}-{{$pkg.Pkgbase}}"
|
||||||
title="{{if $pkg.BuildDate}}Build on {{$pkg.BuildDate}} {{end}}{{if $pkg.BuildDuration}}Build duration: {{$pkg.BuildDuration}} {{end}}Last checked on {{$pkg.Checked}}">
|
title="{{if $pkg.BuildDate}}Build on {{$pkg.BuildDate}} {{end}}{{if $pkg.BuildDuration}}Build duration: {{$pkg.BuildDuration}} {{end}}Last checked on {{$pkg.Checked}}">
|
||||||
|
28
utils.go
28
utils.go
@@ -16,6 +16,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"regexp"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
@@ -30,6 +31,12 @@ const (
|
|||||||
lastUpdate = "lastupdate"
|
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 {
|
type BuildPackage struct {
|
||||||
Pkgbase string
|
Pkgbase string
|
||||||
Pkgbuild string
|
Pkgbuild string
|
||||||
@@ -135,25 +142,6 @@ func containsSubStr(str string, subList []string) bool {
|
|||||||
return false
|
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) {
|
func (p *BuildPackage) repoVersion() (string, error) {
|
||||||
err := p.findPkgFiles()
|
err := p.findPkgFiles()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -578,7 +566,7 @@ func housekeeping(repo string, wg *sync.WaitGroup) error {
|
|||||||
buildManager.alpmMutex.Unlock()
|
buildManager.alpmMutex.Unlock()
|
||||||
if err != nil || pkgResolved.DB().Name() != pkg.DbPackage.Repository.String() {
|
if err != nil || pkgResolved.DB().Name() != pkg.DbPackage.Repository.String() {
|
||||||
// package not found on mirror/db -> not part of any repo anymore
|
// 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
|
buildManager.repoPurge[pkg.FullRepo] <- pkg
|
||||||
err = db.DbPackage.DeleteOne(pkg.DbPackage).Exec(context.Background())
|
err = db.DbPackage.DeleteOne(pkg.DbPackage).Exec(context.Background())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Reference in New Issue
Block a user