Add database backend (SQLite) (#26)

Add database with background information for each pkgbase, for possible future use.
A static status page is generated from the db.

Currently includes:

* sub-packages
* build-time
* build-duration
* status (failed, latest, skipped, queued, building, build)
* version (both from PKGBUILD and repo)
* last checked

Database is currently only used for informational purposes. Goal is to refactor many (expensive) methods to use the db instead of searching/parsing files.

Reviewed-on: https://git.harting.dev/anonfunc/ALHP.GO/pulls/26
Co-authored-by: Giovanni Harting <539@idlegandalf.com>
Co-committed-by: Giovanni Harting <539@idlegandalf.com>
This commit is contained in:
2021-07-13 18:07:29 +02:00
parent 9c8366372f
commit b0cfe7b205
27 changed files with 6949 additions and 47 deletions

72
tpl/status.html Normal file
View File

@@ -0,0 +1,72 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta content="width=device-width, initial-scale=1" name="viewport">
<!-- Bootstrap CSS -->
<link crossorigin="anonymous" href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css"
integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" rel="stylesheet">
<title>ALHP Status</title>
</head>
<body>
<div class="container">
{{range $march := .March}}<h3>{{$march.Name}}</h3>
<div class="accordion" id="accordion-{{$march.Name}}">
{{range $repo := $march.Repos}}
<div class="accordion-item">
<h2 class="accordion-header" id="heading-{{$march.Name}}-{{$repo.Name}}">
<button aria-controls="collapse-{{$march.Name}}-{{$repo.Name}}" aria-expanded="false"
class="accordion-button"
data-bs-target="#collapse-{{$march.Name}}-{{$repo.Name}}"
data-bs-toggle="collapse" type="button">
{{$march.Name}}-{{$repo.Name}}
</button>
</h2>
<div aria-labelledby="heading-{{$march.Name}}-{{$repo.Name}}" class="accordion-collapse collapse show"
data-bs-parent="#accordion-{{$march.Name}}" id="collapse-{{$march.Name}}-{{$repo.Name}}">
<div class="accordion-body">
<table class="table">
<thead>
<tr>
<th scope="col">Pkgbase</th>
<th scope="col">Status</th>
<th scope="col">Skipped</th>
<th scope="col">SVN2GIT Version</th>
<th scope="col">Version</th>
<th scope="col">Build Date</th>
<th scope="col">Build Duration</th>
<th scope="col">Check date</th>
</tr>
</thead>
<tbody>
{{range $pkg := $repo.Packages}}
<tr class="{{$pkg.Class}}">
<td>{{$pkg.Pkgbase}}</td>
<td>{{$pkg.Status}}</td>
<td>{{$pkg.Skip}}</td>
<td>{{$pkg.Svn2GitVersion}}</td>
<td>{{$pkg.Version}}</td>
<td>{{$pkg.BuildDate}}</td>
<td>{{if $pkg.BuildDuration}}{{$pkg.BuildDuration}}{{end}}</td>
<td>{{$pkg.Checked}}</td>
</tr>
{{end}}
</tbody>
</table>
</div>
</div>
</div>
{{end}}
</div>
{{end}}
</div>
<script crossorigin="anonymous"
integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM"
src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>