From 8c1e8c1835f7ccc3f3339a12d1500a9df57dc735 Mon Sep 17 00:00:00 2001 From: Giovanni Harting <539@idlegandalf.com> Date: Sun, 21 Nov 2021 15:24:27 +0100 Subject: [PATCH] switched status page to a dark theme, added archweb links --- config_dist.yaml | 10 -------- main.go | 9 ++----- tpl/packages.html | 60 +++++++++++++++++++++++++++++++++-------------- utils.go | 28 +++++++--------------- 4 files changed, 53 insertions(+), 54 deletions(-) diff --git a/config_dist.yaml b/config_dist.yaml index e50b40d..627e514 100644 --- a/config_dist.yaml +++ b/config_dist.yaml @@ -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 \ No newline at end of file diff --git a/main.go b/main.go index 76bca0b..222063a 100644 --- a/main.go +++ b/main.go @@ -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, diff --git a/tpl/packages.html b/tpl/packages.html index 7e29c42..0ef321e 100644 --- a/tpl/packages.html +++ b/tpl/packages.html @@ -16,8 +16,34 @@ ALHP Status + + - + -
+
{{range $march := .March}}

{{$march.Name}}

{{range $repo := $march.Repos}} -
+

-
- + @@ -61,30 +88,29 @@ - + {{range $pkg := $repo.Packages}} - - + + - -
Pkgbase StatusLTO SVN2GIT Version {{$repo.Name}}-{{$march.Name}} VersionInfoInfo
{{$pkg.Pkgbase}} AW -
{{$pkg.Pkgbase}} {{$pkg.Status}} {{$pkg.Skip}} - {{if $pkg.LTO}}{{end}} - {{if $pkg.LTODisabled}}{{end}} + + {{if $pkg.LTO}}{{end}} + {{if $pkg.LTODisabled}}{{end}} {{if $pkg.LTOUnknown}}{{end}} {{$pkg.Svn2GitVersion}} {{$pkg.Version}} + {{with $pkg.Log}}{{end}} + AW diff --git a/utils.go b/utils.go index c3fee66..0b1ed1a 100644 --- a/utils.go +++ b/utils.go @@ -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 {