SF.net SVN: gar:[23849] csw/mgar/gar/v2/go/src/promote-packages/ promote-packages.go

wahwah at users.sourceforge.net wahwah at users.sourceforge.net
Sun Jul 20 17:33:37 CEST 2014


Revision: 23849
          http://sourceforge.net/p/gar/code/23849
Author:   wahwah
Date:     2014-07-20 15:33:35 +0000 (Sun, 20 Jul 2014)
Log Message:
-----------
promote-packages: Persistence and report paths

They are now controllable with CLI options.

Modified Paths:
--------------
    csw/mgar/gar/v2/go/src/promote-packages/promote-packages.go

Modified: csw/mgar/gar/v2/go/src/promote-packages/promote-packages.go
===================================================================
--- csw/mgar/gar/v2/go/src/promote-packages/promote-packages.go	2014-07-20 13:50:42 UTC (rev 23848)
+++ csw/mgar/gar/v2/go/src/promote-packages/promote-packages.go	2014-07-20 15:33:35 UTC (rev 23849)
@@ -47,14 +47,25 @@
 // Command line flags
 var from_catrel_flag string
 var to_catrel_flag string
+var htmlReportFlag string
+var packageTimesFilename string
 
-const htmlReportPath = "/home/maciej/public_html/promote-packages.html"
 
 func init() {
   flag.StringVar(&from_catrel_flag, "from-catrel", "unstable",
                  "Actually, only unstable makes sense here.")
   flag.StringVar(&to_catrel_flag, "to-catrel", "bratislava",
                  "The testing release.")
+  flag.StringVar(&htmlReportFlag, "html-report-path",
+                 "/home/maciej/public_html/promote-packages.html",
+                 "Full path to the file where the HTML report will be " +
+                 "written. If the file already exists, it will be " +
+                 "overwritten. ")
+  flag.StringVar(&packageTimesFilename, "package-times-json-file",
+                 "/home/maciej/.checkpkg/package-times.json",
+                 "JSON file with package times state. This file is used " +
+                 "for persistence: it remembers when each of the packages " +
+                 "was last modified in the unstable catalog.")
 }
 
 type CatalogSpecTransition struct {
@@ -103,8 +114,6 @@
   return PackageTimeInfo{}
 }
 
-const packageTimesFilename = "/home/maciej/.checkpkg/package-times.json"
-
 func (t *CatalogReleaseTimeInfo) Load() error {
   log.Println("Loading", packageTimesFilename)
   fh, err := os.Open(packageTimesFilename)
@@ -536,9 +545,9 @@
 func writeReport(rd reportData) {
   t := template.Must(template.ParseFiles(
       "src/promote-packages/report-template.html"))
-  fo, err := os.Create(htmlReportPath)
+  fo, err := os.Create(htmlReportFlag)
   if err != nil {
-    log.Println("Could not open", htmlReportPath)
+    log.Println("Could not open", htmlReportFlag)
     panic(err)
   }
   defer fo.Close()

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the devel mailing list