add debug package cleanup to housekeeping

This commit is contained in:
2023-12-16 12:39:15 +01:00
parent a834c7fb04
commit 1c1f1fba17
2 changed files with 15 additions and 0 deletions

View File

@@ -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()

View File

@@ -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))
}
}
}
}