more patch stuff

This commit is contained in:
Jeff Carr 2025-09-05 01:24:34 -05:00
parent 4a27e7702b
commit 817107dc16
4 changed files with 16 additions and 2 deletions

View File

@ -21,7 +21,7 @@ func (f *Forge) HttpPost(url string, data []byte) ([]byte, error) {
usr, _ := user.Current()
req.Header.Set("author", usr.Username)
req.Header.Set("hostname", "fixme:hostname")
req.Header.Set("hostname", f.hostname)
client := &http.Client{}
resp, err := client.Do(req)

View File

@ -342,7 +342,11 @@ func (psets *Patchsets) PrintTable() {
var countCONTENTS int
var countPARTS int
for x, pset := range psets.GetPatchsets() {
log.Info(pset.Uuid, pset.Name)
log.Info(pset.Uuid, pset.Name, pset.State)
if pset.State == "DONE" {
// old patchset
continue
}
cId := log.Sprintf("%d", x)
countCONTENTS += 1
for i, p := range pset.Patches.GetPatches() {

View File

@ -178,6 +178,7 @@ func (f *Forge) setenv() {
f.repoPB = os.Getenv("FORGE_REPOPB")
f.forgeURL = os.Getenv("FORGE_URL")
f.patchDir = os.Getenv("FORGE_PATCHDIR")
f.hostname = os.Getenv("HOSTNAME")
if os.Getenv("FORGE_GOWORK") == "true" {
f.goWork = true
}

View File

@ -28,6 +28,14 @@ func (f *Forge) GetPatches() error {
return nil
}
func (f *Forge) expireAllPatchsets() {
all := f.Patchsets.All()
for all.Scan() {
pset := all.Next()
pset.State = "DONE"
}
}
func (f *Forge) loadUpstreamPatchsets(psets *Patchsets) {
var foundnew bool
@ -36,6 +44,7 @@ func (f *Forge) loadUpstreamPatchsets(psets *Patchsets) {
pset := all.Next()
found := f.Patchsets.FindByUuid(pset.Uuid)
if found == nil {
f.expireAllPatchsets()
log.Info("new patchset", pset.Name, pset.Uuid)
pset.State = "new"
foundnew = true