fixed purging with no packages present to purge

This commit is contained in:
2022-05-20 12:46:10 +02:00
parent bcea0e99cb
commit bb16bdcb61
2 changed files with 9 additions and 3 deletions

View File

@@ -279,8 +279,14 @@ func (b *BuildManager) repoWorker(repo string) {
var realPkgs []string
for _, filePath := range pkg.PkgFiles {
if _, err := os.Stat(filePath); err == nil {
realPkgs = append(realPkgs, Package(filePath).Name())
}
}
if len(realPkgs) == 0 {
continue
}
b.repoWG.Add(1)
args := []string{"-s", "-v", filepath.Join(conf.Basedir.Repo, pkg.FullRepo, "os", conf.Arch, pkg.FullRepo) + ".db.tar.xz"}
@@ -293,7 +299,7 @@ func (b *BuildManager) repoWorker(repo string) {
}
if pkg.DbPackage != nil {
_ = pkg.DbPackage.Update().ClearRepoVersion().Exec(context.Background())
_ = pkg.DbPackage.Update().ClearRepoVersion().ClearHash().Exec(context.Background())
}
for _, file := range pkg.PkgFiles {

View File

@@ -590,7 +590,7 @@ func housekeeping(repo string, march string, wg *sync.WaitGroup) error {
}
} else if dbPkg.Status == dbpackage.StatusLatest && dbPkg.RepoVersion == "" {
log.Infof("[HK] reseting missing package %s with no repo version", dbPkg.Pkgbase)
err = dbPkg.Update().SetStatus(dbpackage.StatusQueued).ClearHash().ClearRepoVersion().SetUpdated(time.Now().UTC()).Exec(context.Background())
err = dbPkg.Update().SetStatus(dbpackage.StatusQueued).ClearHash().ClearRepoVersion().Exec(context.Background())
if err != nil {
return err
}