summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKatolaZ <katolaz@freaknet.org>2018-01-13 23:44:19 +0000
committerKatolaZ <katolaz@freaknet.org>2018-01-13 23:44:19 +0000
commit704c8957b2d3958ff6e030c0badc75f808ea8a9f (patch)
treebaa8ca4b2aa6a56b554f196cde54bc4f43958325
parent44e6a294f5aab03af34c8c7623443e41867bb921 (diff)
Distinct dest dir for each release
-rw-r--r--d1pkgweb.go5
-rw-r--r--deb822/package.go16
2 files changed, 9 insertions, 12 deletions
diff --git a/d1pkgweb.go b/d1pkgweb.go
index 09fe675..b8b048f 100644
--- a/d1pkgweb.go
+++ b/d1pkgweb.go
@@ -24,8 +24,9 @@ func main() {
//fmt.Printf("Got config: %s\n", *conf)
for _, relCfg := range conf.PkgSets { // For each release...
+ relName := relCfg.Release
for _, suiteCfg := range relCfg.Suites { // For each suite of the release
- suite := suiteCfg.Name
+ suiteName := suiteCfg.Name
for _, component := range suiteCfg.Components { // For each component in the suite
fullURL := fmt.Sprintf("%s/%s", relCfg.RepoURL, component.URL)
fmt.Fprintf(os.Stderr, "Processing: %s\n", fullURL)
@@ -41,7 +42,7 @@ func main() {
r := bufio.NewScanner(uncompressed)
for s, err := deb822.ScanStanza(r); s["Package"] != ""; s, err = deb822.ScanStanza(r) {
if err == nil {
- deb822.Stanza2HtmlPage(s, pkgTempl, ".", suite, component.Name)
+ deb822.Stanza2HtmlPage(s, pkgTempl, ".", relName, suiteName, component.Name)
} else {
fmt.Printf("error: %s\n", err)
}
diff --git a/deb822/package.go b/deb822/package.go
index 41a9613..525f112 100644
--- a/deb822/package.go
+++ b/deb822/package.go
@@ -79,7 +79,7 @@ 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, suite string, component string) error {
+func Stanza2HtmlPage(s Stanza, templ string, baseDir string, release string, suite string, component string) error {
fname := s["Filename"]
if fname == "" {
@@ -91,21 +91,17 @@ func Stanza2HtmlPage(s Stanza, templ string, baseDir string, suite string, compo
if err != nil {
log.Fatal("empty package!!!")
}
- nameVersion := fmt.Sprintf("%s_%s", p.Name, p.Version)
- //fmt.Printf(" nameVersion: %s\n", nameVersion)
- //fmt.Printf(" baseDir: %s\n", baseDir)
+ //nameVersion := fmt.Sprintf("%s_%s", p.Name, p.Version)
fname = regexpRemove.ReplaceAllString(fname, "")
- //fmt.Printf(" fname: %s\n", fname)
-
- /// FIXME!!!! ERROR IN DETECTION OF PACKAGE NAME!!!!
- dirName := fmt.Sprintf("%s/%s", baseDir, strings.Split(fname, nameVersion)[0])
+ //dirName := fmt.Sprintf("%s/%s", baseDir, strings.Split(fname, nameVersion)[0])
+ dirName := fmt.Sprintf("%s/%s/%s/", baseDir, release, suite)
err = os.MkdirAll(dirName, 0755)
if err == nil {
- //fmt.Printf(" dirName: %s\n Package: %s\n Version: %s\n", dirName, p.Name, p.Version)
+ //htmlFile := fmt.Sprintf("%s%s_%s.html", dirName, p.Name, p.Version)
htmlFile := fmt.Sprintf("%s%s_%s.html", dirName, p.Name, p.Version)
- //fmt.Printf("Creating file: %s\n---------\n", htmlFile)
+
if f, err := os.Open(htmlFile); err == nil {
f.Close()
fmt.Fprintf(os.Stderr, " Skipping %s -- it exists\n", htmlFile)