diff options
-rw-r--r-- | gentoobrowse-api/service/maintenance/ebuildMetaProcessor.cpp | 20 | ||||
-rw-r--r-- | gentoobrowse-api/service/maintenance/ebuildMetaProcessor.h | 1 |
2 files changed, 15 insertions, 6 deletions
diff --git a/gentoobrowse-api/service/maintenance/ebuildMetaProcessor.cpp b/gentoobrowse-api/service/maintenance/ebuildMetaProcessor.cpp index 2ba14e7..ccb498a 100644 --- a/gentoobrowse-api/service/maintenance/ebuildMetaProcessor.cpp +++ b/gentoobrowse-api/service/maintenance/ebuildMetaProcessor.cpp @@ -132,6 +132,19 @@ namespace Gentoo { t.dest = "gentoobrowse.ebuild_rdeps"; dbc->patchTable(&t); } + if (!catsDeleteFrom.empty()) { + bool any = false; + for(const auto & categoryName : catsDeleteFrom) { + // Prune packages + auto pp = dbc->modify(sql::maintenance::packagePrune.getSql()); + pp->bindParamS(0, categoryName); + any |= pp->execute(); + } + if (any) { + // Prune categories + dbc->modify(sql::maintenance::categoryPrune.getSql())->execute(); + } + } } void @@ -224,12 +237,7 @@ namespace Gentoo { m->bindParamS(2, packageName); m->bindParamS(3, ebuildVersion); m->execute(false); - // Prune packages - auto pp = dbc->modify(sql::maintenance::packagePrune.getSql()); - pp->bindParamS(0, categoryName); - pp->execute(); - // Prune categories - dbc->modify(sql::maintenance::categoryPrune.getSql())->execute(); + catsDeleteFrom.insert(categoryName); } } } diff --git a/gentoobrowse-api/service/maintenance/ebuildMetaProcessor.h b/gentoobrowse-api/service/maintenance/ebuildMetaProcessor.h index a337e8b..2e92217 100644 --- a/gentoobrowse-api/service/maintenance/ebuildMetaProcessor.h +++ b/gentoobrowse-api/service/maintenance/ebuildMetaProcessor.h @@ -28,6 +28,7 @@ namespace Gentoo { DB::ModifyCommandPtr depInsert; std::set<int64_t> ebuildIds; + std::set<std::string> catsDeleteFrom; }; } } |