summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKatolaZ <katolaz@freaknet.org>2018-01-10 23:47:19 +0000
committerKatolaZ <katolaz@freaknet.org>2018-01-10 23:47:19 +0000
commit567a64aa25a1823f6188c8e17edfca4caf6499b0 (patch)
treeaa111e0803cfd031e9fef7cd927cfa4f4711914b
parentae0b7ac7d3d8b10fe5862a9d7268f559c4a4e445 (diff)
added Suite, Section, Component, Priority
-rw-r--r--d1pkgweb.go17
-rw-r--r--deb822/package.go10
2 files changed, 23 insertions, 4 deletions
diff --git a/d1pkgweb.go b/d1pkgweb.go
index 60c761f..d9f236f 100644
--- a/d1pkgweb.go
+++ b/d1pkgweb.go
@@ -5,6 +5,7 @@ import (
"d1pkgweb/deb822"
"fmt"
"os"
+ "strings"
)
var templ = `<html>
@@ -21,7 +22,13 @@ div.pkgname{
font-size: 150%;
margin-top: 40px;
margin-left: 40px;
- border-bottom: 2px solid #444444;
+}
+
+div.pkg_suite{
+ font-size: 110%;
+ margin-top: 15px;
+ margin-left: 40px;
+ margin-bottom: 60px;
}
div.description{
@@ -60,7 +67,8 @@ li.rec_item{
</style>
-<div class="pkgname">{{.Name}} {{.Version}}</div>
+<div class="pkgname">{{.Name}} {{.Version}} [{{.Section}} - {{.Priority}}]</div>
+<div class="pkg_suite">[{{.Suite}} - {{.Component}}]</div>
<div class="description">
{{.Description}}
</div>
@@ -102,6 +110,9 @@ func main() {
fnames := args[1:]
for _, fname := range fnames {
+ nameComps := strings.Split(fname, "_")
+ suite := nameComps[3]
+ component := nameComps[4]
f, err := os.Open(fname)
if err != nil {
defer f.Close()
@@ -115,7 +126,7 @@ func main() {
if r != nil {
for s, err := deb822.ScanStanza(r); s["Package"] != ""; s, err = deb822.ScanStanza(r) {
if err == nil {
- deb822.Stanza2HtmlPage(s, templ, ".")
+ deb822.Stanza2HtmlPage(s, templ, ".", suite, component)
} else {
fmt.Printf("error: %s\n", err)
}
diff --git a/deb822/package.go b/deb822/package.go
index 3c1c172..9d3b1a1 100644
--- a/deb822/package.go
+++ b/deb822/package.go
@@ -19,6 +19,10 @@ type Package struct {
Recommends []string
Maintainer string
Filename string
+ Suite string
+ Component string
+ Section string
+ Priority string
}
var regexpRemove = regexp.MustCompile("(DEVUAN/|DEBIAN/|[0-9]+:)")
@@ -49,6 +53,8 @@ func NewPackage(s Stanza) (Package, error) {
if len(p.Recommends) == 0 {
p.Recommends = nil
}
+ p.Section = s["Section"]
+ p.Priority = s["Priority"]
return p, nil
}
@@ -67,13 +73,15 @@ func PrintPackage(p Package, templ string, out io.Writer) {
/*Stanza2HtmlPage Render the html webpage of a package and save it in the
/* corresponding "pool" directory.
*/
-func Stanza2HtmlPage(s Stanza, templ string, baseDir string) error {
+func Stanza2HtmlPage(s Stanza, templ string, baseDir string, suite string, component string) error {
fname := s["Filename"]
if fname == "" {
return fmt.Errorf("No Filename provided")
}
p, err := NewPackage(s)
+ p.Suite = suite
+ p.Component = component
if err != nil {
log.Fatal("empty package!!!")
}