diff options
| -rw-r--r-- | argv.template.go | 3 | ||||
| -rw-r--r-- | doNewest.go | 8 | ||||
| -rw-r--r-- | main.go | 10 | ||||
| -rw-r--r-- | makePackagesFile.go | 12 | ||||
| -rw-r--r-- | structs.go | 14 | 
5 files changed, 23 insertions, 24 deletions
diff --git a/argv.template.go b/argv.template.go index e7a9948..1808722 100644 --- a/argv.template.go +++ b/argv.template.go @@ -10,6 +10,7 @@ import (  	"go.wit.com/dev/alexflint/arg"  	"go.wit.com/gui" +	"go.wit.com/lib/ENV"  	"go.wit.com/lib/fhelp"  	"go.wit.com/log"  ) @@ -63,7 +64,7 @@ func (args) InitGui() error {  func (args) Exit() {  	gui.UnloadToolkits() -	if me.argv.Verbose() { +	if ENV.Verbose() {  		log.Info("argv.Exit() called", APPNAME+".Exit()")  	}  	// remove this from the template for your app (or make one for youself if you need it) diff --git a/doNewest.go b/doNewest.go index 1016c21..2088202 100644 --- a/doNewest.go +++ b/doNewest.go @@ -3,8 +3,8 @@ package main  import (  	"time" +	"go.wit.com/lib/ENV"  	"go.wit.com/lib/cobol" -	"go.wit.com/lib/config"  	"go.wit.com/lib/protobuf/zoopb"  	"go.wit.com/log"  ) @@ -19,7 +19,7 @@ func doGetNewest(arch string) *zoopb.Packages {  		found := newest.FindByPackage(p.Package)  		if found == nil {  			// package is new -			if config.Verbose() { +			if ENV.Verbose() {  				log.Printf("%-20.20s %-20.20s %-80.80s\n", "new package", p.Package, p.Filename)  			}  			newest.Clone(p) @@ -29,11 +29,11 @@ func doGetNewest(arch string) *zoopb.Packages {  		newtime := found.Ctime.AsTime()  		durs := cobol.Since(p.Ctime) + " vs found " + cobol.Since(found.Ctime)  		if time.Since(curtime) > time.Since(newtime) { -			if config.Verbose() { +			if ENV.Verbose() {  				log.Printf("%-20.20s %-20.20s %-80.80s %s\n", "found is newer", p.Package, p.Filename, durs)  			}  		} else { -			if config.Verbose() { +			if ENV.Verbose() {  				log.Printf("%-20.20s %-20.20s %-80.80s %s\n", "found is older", p.Package, p.Filename, durs)  			}  			newest.Delete(found) @@ -6,7 +6,7 @@ import (  	"os"  	"path/filepath" -	"go.wit.com/lib/config" +	"go.wit.com/lib/ENV"  	"go.wit.com/lib/gui/shell"  	"go.wit.com/lib/protobuf/argvpb"  	"go.wit.com/lib/protobuf/zoopb" @@ -22,17 +22,17 @@ func main() {  	// read in protobuf file  	me.pb = zoopb.NewPackages() -	me.pb.Filename = config.GetPanic("mirrors.pb") +	me.pb.Filename = ENV.GetPanic("mirrors.pb")  	if err := me.pb.Load(); err != nil { -		me.pb.BaseDir = config.GetPanic("BaseDir") +		me.pb.BaseDir = ENV.GetPanic("BaseDir")  		me.pb.Save()  		me.argv.GoodExit("created new pb file: " + me.pb.Filename + ". rerun mirrors.")  	}  	// force check the PB variable  	// todo: redo all this now that there is a generalized lib/config/ -	if me.pb.BaseDir != config.GetPanic("BaseDir") { -		me.pb.BaseDir = config.GetPanic("BaseDir") +	if me.pb.BaseDir != ENV.GetPanic("BaseDir") { +		me.pb.BaseDir = ENV.GetPanic("BaseDir")  		me.pb.Save()  		me.argv.BadExit("pb.BaseDir is bank", nil)  	} diff --git a/makePackagesFile.go b/makePackagesFile.go index c30acde..1bc95f1 100644 --- a/makePackagesFile.go +++ b/makePackagesFile.go @@ -11,7 +11,7 @@ import (  	"strings"  	"time" -	"go.wit.com/lib/config" +	"go.wit.com/lib/ENV"  	"go.wit.com/lib/debian"  	"go.wit.com/lib/gui/shell"  	"go.wit.com/log" @@ -19,8 +19,8 @@ import (  func doPurge() error {  	// all paths should be relative to this BaseDir path -	if err := os.Chdir(config.GetPanic("BaseDir")); err != nil { -		log.Info("could not change to dir", config.GetPanic("BaseDir"), err) +	if err := os.Chdir(ENV.GetPanic("BaseDir")); err != nil { +		log.Info("could not change to dir", ENV.GetPanic("BaseDir"), err)  		panic("could not change to dir")  	}  	var err error @@ -30,7 +30,7 @@ func doPurge() error {  }  func makePackagesFile(arch string) (string, error) { -	os.Chdir(config.GetPanic("BaseDir")) +	os.Chdir(ENV.GetPanic("BaseDir"))  	if err := os.MkdirAll("dists/sid/main/binary-"+arch, 0755); err != nil {  		log.Info("did not work", err) @@ -115,11 +115,11 @@ func doSignRelease() error {  	// fmt.Fprintf(rfile, "SHA256:\n")  	rfile.Close() -	gpgKeyID := config.GetPanic("gpgKeyID") +	gpgKeyID := ENV.GetPanic("gpgKeyID")  	// Sign the file  	log.Println("Signing with GPG key:", gpgKeyID) -	distPath := config.GetPanic("distPath") +	distPath := ENV.GetPanic("distPath")  	// Create InRelease  	cmdClearSign := exec.Command("gpg", "--default-key", gpgKeyID, "--clearsign", "-o", filepath.Join(distPath, "InRelease"), releasePath)  	if err := runCommand(cmdClearSign); err != nil { @@ -4,7 +4,6 @@ import (  	"sync"  	"go.wit.com/dev/alexflint/arg" -	"go.wit.com/lib/config"  	"go.wit.com/lib/fhelp"  	"go.wit.com/lib/protobuf/argvpb"  	"go.wit.com/lib/protobuf/forgepb" @@ -15,11 +14,10 @@ var me *mainType  // this app's variables  type mainType struct { -	once   sync.Once       // one-time initialized data -	argv   *argvpb.Argv    // more experiments for bash handling -	pp     *arg.Parser     // for parsing the command line args.  Yay to alexf lint! -	myGui  *fhelp.GuiPrep  // for initializing the GUI toolkits -	forge  *forgepb.Forge  // your customized repo preferences and settings -	pb     *zoopb.Packages // the mirrors packages -	config *config.Config  // the mirrors packages +	once  sync.Once       // one-time initialized data +	argv  *argvpb.Argv    // more experiments for bash handling +	pp    *arg.Parser     // for parsing the command line args.  Yay to alexf lint! +	myGui *fhelp.GuiPrep  // for initializing the GUI toolkits +	forge *forgepb.Forge  // your customized repo preferences and settings +	pb    *zoopb.Packages // the mirrors packages  }  | 
