diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2016-06-01 15:26:50 +0100 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2016-06-01 15:26:50 +0100 |
commit | 8a5a58e045a3906266b1673f02abbc9dab82f467 (patch) | |
tree | 6da74cfa35436745e9278f224f55eb6a13b8b9d4 | |
parent | Import package tree news (diff) | |
download | gentoobrowse-api-8a5a58e045a3906266b1673f02abbc9dab82f467.tar.bz2 gentoobrowse-api-8a5a58e045a3906266b1673f02abbc9dab82f467.tar.xz gentoobrowse-api-8a5a58e045a3906266b1673f02abbc9dab82f467.zip |
Don't delete packages and categories immediately when deleting ebuilds (they might come back), do them in apply
-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; }; } } |