add debug package cleanup to housekeeping
This commit is contained in:
@@ -492,6 +492,7 @@ func (b *BuildManager) syncWorker(ctx context.Context) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Warningf("log-housekeeping failed: %v", err)
|
log.Warningf("log-housekeeping failed: %v", err)
|
||||||
}
|
}
|
||||||
|
debugHK()
|
||||||
|
|
||||||
// fetch updates between sync runs
|
// fetch updates between sync runs
|
||||||
b.alpmMutex.Lock()
|
b.alpmMutex.Lock()
|
||||||
|
@@ -4,6 +4,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
"os"
|
"os"
|
||||||
|
"os/exec"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"somegit.dev/ALHP/ALHP.GO/ent"
|
"somegit.dev/ALHP/ALHP.GO/ent"
|
||||||
"somegit.dev/ALHP/ALHP.GO/ent/dbpackage"
|
"somegit.dev/ALHP/ALHP.GO/ent/dbpackage"
|
||||||
@@ -304,3 +305,16 @@ func logHK() error {
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func debugHK() {
|
||||||
|
for _, march := range conf.March {
|
||||||
|
if _, err := os.Stat(filepath.Join(conf.Basedir.Debug, march)); err == nil {
|
||||||
|
log.Debugf("[DHK/%s] start cleanup debug packages", march)
|
||||||
|
cleanCmd := exec.Command("paccache", "-rc", filepath.Join(conf.Basedir.Debug, march), "-k", "1")
|
||||||
|
res, err := cleanCmd.CombinedOutput()
|
||||||
|
if err != nil {
|
||||||
|
log.Warningf("[DHK/%s] cleanup debug packages failed: %v (%s)", march, err, string(res))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user