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

10
main.go
View File

@@ -279,7 +279,13 @@ func (b *BuildManager) repoWorker(repo string) {
var realPkgs []string var realPkgs []string
for _, filePath := range pkg.PkgFiles { for _, filePath := range pkg.PkgFiles {
realPkgs = append(realPkgs, Package(filePath).Name()) if _, err := os.Stat(filePath); err == nil {
realPkgs = append(realPkgs, Package(filePath).Name())
}
}
if len(realPkgs) == 0 {
continue
} }
b.repoWG.Add(1) b.repoWG.Add(1)
@@ -293,7 +299,7 @@ func (b *BuildManager) repoWorker(repo string) {
} }
if pkg.DbPackage != nil { if pkg.DbPackage != nil {
_ = pkg.DbPackage.Update().ClearRepoVersion().Exec(context.Background()) _ = pkg.DbPackage.Update().ClearRepoVersion().ClearHash().Exec(context.Background())
} }
for _, file := range pkg.PkgFiles { 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 == "" { } else if dbPkg.Status == dbpackage.StatusLatest && dbPkg.RepoVersion == "" {
log.Infof("[HK] reseting missing package %s with no repo version", dbPkg.Pkgbase) 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 { if err != nil {
return err return err
} }