add debug package cleanup to housekeeping
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
log "github.com/sirupsen/logrus"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"somegit.dev/ALHP/ALHP.GO/ent"
|
||||
"somegit.dev/ALHP/ALHP.GO/ent/dbpackage"
|
||||
@@ -304,3 +305,16 @@ func logHK() error {
|
||||
}
|
||||
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