diff --git a/cmd/csaf_aggregator/indices.go b/cmd/csaf_aggregator/indices.go index c4473f1..e2524a4 100644 --- a/cmd/csaf_aggregator/indices.go +++ b/cmd/csaf_aggregator/indices.go @@ -24,6 +24,21 @@ import ( "github.com/csaf-poc/csaf_distribution/util" ) +const ( + // interimsCSV is the name of the file to store the URLs + // of the interim advisories. + interimsCSV = "interims.csv" + + // changesCSV is the name of the file to store the + // the paths to the advisories sorted in descending order + // of the release date along with the release date. + changesCSV = "changes.csv" + + // indexTXT is the name of the file to store the + // the paths of the advisories. + indexTXT = "index.txt" +) + func (w *worker) writeInterims(label string, summaries []summary) error { // Filter out the interims. @@ -44,7 +59,7 @@ func (w *worker) writeInterims(label string, summaries []summary) error { ss[j].summary.CurrentReleaseDate) }) - fname := filepath.Join(w.dir, label, "interim.csv") + fname := filepath.Join(w.dir, label, interimsCSV) f, err := os.Create(fname) if err != nil { return err @@ -85,7 +100,7 @@ func (w *worker) writeCSV(label string, summaries []summary) error { ss[j].summary.CurrentReleaseDate) }) - fname := filepath.Join(w.dir, label, "changes.csv") + fname := filepath.Join(w.dir, label, changesCSV) f, err := os.Create(fname) if err != nil { return err @@ -121,7 +136,7 @@ func (w *worker) writeCSV(label string, summaries []summary) error { func (w *worker) writeIndex(label string, summaries []summary) error { - fname := filepath.Join(w.dir, label, "index.txt") + fname := filepath.Join(w.dir, label, indexTXT) f, err := os.Create(fname) if err != nil { return err diff --git a/cmd/csaf_aggregator/interim.go b/cmd/csaf_aggregator/interim.go index d28c9bd..c01ca8a 100644 --- a/cmd/csaf_aggregator/interim.go +++ b/cmd/csaf_aggregator/interim.go @@ -176,9 +176,9 @@ func (w *worker) interimWork(wg *sync.WaitGroup, jobs <-chan *interimJob) { label = strings.ToLower(label) labelPath := filepath.Join(providerPath, label) - interimsCSV := filepath.Join(labelPath, "interims.csv") + interCSV := filepath.Join(labelPath, interimsCSV) interims, err := readInterims( - interimsCSV, w.processor.cfg.InterimYears) + interCSV, w.processor.cfg.InterimYears) if err != nil { return err } @@ -200,8 +200,8 @@ func (w *worker) interimWork(wg *sync.WaitGroup, jobs <-chan *interimJob) { if err != nil { return err } - interimsCSV := filepath.Join(dst, label, "interims.csv") - if err := writeInterims(interimsCSV, finalized); err != nil { + interCSV := filepath.Join(dst, label, interimsCSV) + if err := writeInterims(interCSV, finalized); err != nil { return err } }