50 lines
1.0 KiB
Go
50 lines
1.0 KiB
Go
package main
|
|
|
|
import (
|
|
"os"
|
|
|
|
"go.wit.com/lib/protobuf/forgepb"
|
|
"go.wit.com/log"
|
|
)
|
|
|
|
// does a standard forgepb & zoopb init
|
|
|
|
func standardMachineInit() {
|
|
var err error
|
|
// load the ~/.config/forge/ config
|
|
if err = me.forge.ConfigLoad(); err != nil {
|
|
log.Warn("forgepb.ConfigLoad() failed", err)
|
|
os.Exit(-1)
|
|
}
|
|
|
|
me.forge.PrintTable()
|
|
|
|
// load the ~/.config/forge/ machine file from zoopb
|
|
if err = me.machine.ConfigLoad(); err != nil {
|
|
log.Warn("zoopb.ConfigLoad() failed", err)
|
|
os.Exit(-1)
|
|
}
|
|
me.machine.InitWit()
|
|
|
|
// list all packages from mirrors.wit.com
|
|
/*
|
|
loop := me.machine.Wit.SortByName()
|
|
for loop.Scan() {
|
|
p := loop.Package()
|
|
log.Info("package:", p.Name, p.Version, p.PkgName)
|
|
}
|
|
*/
|
|
|
|
// use ~/go/src unless we find a go.work file in a parent directory
|
|
if me.goSrcPath, err = forgepb.FindGoSrc(); err != nil {
|
|
log.Info(err)
|
|
os.Exit(-1)
|
|
}
|
|
|
|
// this ENV value is used by the repolist and repostatus packages
|
|
if me.goSrcPath != "" {
|
|
os.Setenv("REPO_WORK_PATH", me.goSrcPath)
|
|
|
|
}
|
|
}
|