summaryrefslogtreecommitdiff
path: root/Load.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-10-21 16:25:45 -0500
committerJeff Carr <[email protected]>2025-10-21 16:25:45 -0500
commit66d0426ccc05f7b88c102739f1f7f37984d927ac (patch)
tree7dfbf663beaa916e22c0cf853d145e999da68b8f /Load.go
parentd54c59107289968116211111ff52850768fcec24 (diff)
load PatchesPB
Diffstat (limited to 'Load.go')
-rw-r--r--Load.go29
1 files changed, 15 insertions, 14 deletions
diff --git a/Load.go b/Load.go
index 8a5118f..b6ffdd3 100644
--- a/Load.go
+++ b/Load.go
@@ -11,6 +11,7 @@ package forgepb
import (
"errors"
+ "os"
"go.wit.com/lib/ENV"
"go.wit.com/lib/config"
@@ -60,24 +61,24 @@ func (f *Forge) reposCacheLoad() error {
return err
}
-/*
-func (f *Forge) loadPatchsets() error {
- f.Patchsets = NewSets()
-
- data, err := os.ReadFile(config.Get("PatchPB"))
- if err != nil {
- return err
+func (f *Forge) patchesCacheLoad() error {
+ if f.Patches != nil {
+ return errors.New("already loaded")
+ }
+ f.Patches = NewPatches()
+ err := config.LoadAppnameCache(f.Patches, "forge")
+ if errors.Is(err, os.ErrNotExist) {
+ // is a new file
+ f.Patches.Save()
+ return os.ErrNotExist
}
-
- err = f.Patchsets.Unmarshal(data)
if err != nil {
- log.Infof("LoadPatchsets() proto.Marshal() error %v\n", err)
- return err
+ log.Printf("patchesCacheLoad() failed err (%v) filename (%s)\n", err, f.Patches.Filename)
+ panic("failed to load patches")
}
- // log.Infof("LoadPatchsets() found %d patches.\n", f.Patchsets.Len())
- return nil
+ ENV.SetGlobal("lib/forgepb", "PatchesPB", f.Patches.Filename)
+ return err
}
-*/
func makeDefaultConfig() (*ForgeConfigs, error) {
cfg := NewForgeConfigs()