more patch stuff
This commit is contained in:
parent
4a27e7702b
commit
817107dc16
2
http.go
2
http.go
|
@ -21,7 +21,7 @@ func (f *Forge) HttpPost(url string, data []byte) ([]byte, error) {
|
||||||
|
|
||||||
usr, _ := user.Current()
|
usr, _ := user.Current()
|
||||||
req.Header.Set("author", usr.Username)
|
req.Header.Set("author", usr.Username)
|
||||||
req.Header.Set("hostname", "fixme:hostname")
|
req.Header.Set("hostname", f.hostname)
|
||||||
|
|
||||||
client := &http.Client{}
|
client := &http.Client{}
|
||||||
resp, err := client.Do(req)
|
resp, err := client.Do(req)
|
||||||
|
|
|
@ -342,7 +342,11 @@ func (psets *Patchsets) PrintTable() {
|
||||||
var countCONTENTS int
|
var countCONTENTS int
|
||||||
var countPARTS int
|
var countPARTS int
|
||||||
for x, pset := range psets.GetPatchsets() {
|
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)
|
cId := log.Sprintf("%d", x)
|
||||||
countCONTENTS += 1
|
countCONTENTS += 1
|
||||||
for i, p := range pset.Patches.GetPatches() {
|
for i, p := range pset.Patches.GetPatches() {
|
||||||
|
|
1
init.go
1
init.go
|
@ -178,6 +178,7 @@ func (f *Forge) setenv() {
|
||||||
f.repoPB = os.Getenv("FORGE_REPOPB")
|
f.repoPB = os.Getenv("FORGE_REPOPB")
|
||||||
f.forgeURL = os.Getenv("FORGE_URL")
|
f.forgeURL = os.Getenv("FORGE_URL")
|
||||||
f.patchDir = os.Getenv("FORGE_PATCHDIR")
|
f.patchDir = os.Getenv("FORGE_PATCHDIR")
|
||||||
|
f.hostname = os.Getenv("HOSTNAME")
|
||||||
if os.Getenv("FORGE_GOWORK") == "true" {
|
if os.Getenv("FORGE_GOWORK") == "true" {
|
||||||
f.goWork = true
|
f.goWork = true
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,14 @@ func (f *Forge) GetPatches() error {
|
||||||
return nil
|
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) {
|
func (f *Forge) loadUpstreamPatchsets(psets *Patchsets) {
|
||||||
var foundnew bool
|
var foundnew bool
|
||||||
|
|
||||||
|
@ -36,6 +44,7 @@ func (f *Forge) loadUpstreamPatchsets(psets *Patchsets) {
|
||||||
pset := all.Next()
|
pset := all.Next()
|
||||||
found := f.Patchsets.FindByUuid(pset.Uuid)
|
found := f.Patchsets.FindByUuid(pset.Uuid)
|
||||||
if found == nil {
|
if found == nil {
|
||||||
|
f.expireAllPatchsets()
|
||||||
log.Info("new patchset", pset.Name, pset.Uuid)
|
log.Info("new patchset", pset.Name, pset.Uuid)
|
||||||
pset.State = "new"
|
pset.State = "new"
|
||||||
foundnew = true
|
foundnew = true
|
||||||
|
|
Loading…
Reference in New Issue