diff options
40 files changed, 95 insertions, 2 deletions
diff --git a/gentoobrowse-api/api/impl.cpp b/gentoobrowse-api/api/impl.cpp index 762e9d6..ba17dae 100644 --- a/gentoobrowse-api/api/impl.cpp +++ b/gentoobrowse-api/api/impl.cpp @@ -3,6 +3,7 @@ namespace Gentoo { AdHocFormatter(GitErrorMessage, "Git Error: %?: %? (code %?, class %?)"); + void GitError::ice_print(std::ostream & s) const { diff --git a/gentoobrowse-api/service/changeSet.h b/gentoobrowse-api/service/changeSet.h index c8508dd..1a9e63b 100644 --- a/gentoobrowse-api/service/changeSet.h +++ b/gentoobrowse-api/service/changeSet.h @@ -11,6 +11,7 @@ namespace Gentoo::Service { StringList pathParts; git_delta_t changeType {}; }; + using ChangeSet = std::map<std::filesystem::path, ChangeDetails, std::less<>>; } diff --git a/gentoobrowse-api/service/maintenance/abstractFileProcessor.h b/gentoobrowse-api/service/maintenance/abstractFileProcessor.h index b83b594..6672e0f 100644 --- a/gentoobrowse-api/service/maintenance/abstractFileProcessor.h +++ b/gentoobrowse-api/service/maintenance/abstractFileProcessor.h @@ -9,6 +9,7 @@ #include <memory> #include <string> #include <vector> + // IWYU pragma: no_include "factory.impl.h" namespace DB { class Connection; @@ -40,6 +41,7 @@ namespace Gentoo::Service { = 0; virtual void deleted(DB::Connection * dbc, int64_t repoid, const Gentoo::StringList & fn) = 0; }; + using FileProcessorPtr = std::shared_ptr<AbstractFileProcessor>; using FileProcessorFactory = AdHoc::Factory<AbstractFileProcessor>; } diff --git a/gentoobrowse-api/service/maintenance/categoryMetaProcessor.cpp b/gentoobrowse-api/service/maintenance/categoryMetaProcessor.cpp index 98862c6..b8db86c 100644 --- a/gentoobrowse-api/service/maintenance/categoryMetaProcessor.cpp +++ b/gentoobrowse-api/service/maintenance/categoryMetaProcessor.cpp @@ -13,6 +13,7 @@ #include <sql/maintenance/categoryMetaUpdate.sql.h> #include <staticSqlSource.h> #include <string> + namespace DB { class Connection; } @@ -27,11 +28,13 @@ namespace Gentoo::Service { { return 2; } + unsigned char CategoryMetaProcessor::order() const { return 2; } + bool CategoryMetaProcessor::match(const PathParts & pp) const { @@ -67,4 +70,5 @@ namespace Gentoo::Service { m->execute(); } } + FACTORY(Gentoo::Service::CategoryMetaProcessor, Gentoo::Service::FileProcessorFactory); diff --git a/gentoobrowse-api/service/maintenance/categoryMetaProcessor.h b/gentoobrowse-api/service/maintenance/categoryMetaProcessor.h index 857972e..bf5c3b9 100644 --- a/gentoobrowse-api/service/maintenance/categoryMetaProcessor.h +++ b/gentoobrowse-api/service/maintenance/categoryMetaProcessor.h @@ -4,6 +4,7 @@ #include "portage-models.h" #include <cstdint> #include <filesystem> + namespace DB { class Connection; } diff --git a/gentoobrowse-api/service/maintenance/ebuildMetaProcessor.cpp b/gentoobrowse-api/service/maintenance/ebuildMetaProcessor.cpp index b317bf5..bfedaa3 100644 --- a/gentoobrowse-api/service/maintenance/ebuildMetaProcessor.cpp +++ b/gentoobrowse-api/service/maintenance/ebuildMetaProcessor.cpp @@ -36,6 +36,7 @@ #include <sqlWriter.h> #include <staticSqlSource.h> #include <tablepatch.h> + namespace Glib { class Regex; } @@ -54,11 +55,13 @@ namespace Gentoo::Service { { return 2; } + unsigned char EbuildMetaProcessor::order() const { return 1; } + bool EbuildMetaProcessor::match(const PathParts & pp) const { @@ -311,4 +314,5 @@ namespace Gentoo::Service { } } } + FACTORY(Gentoo::Service::EbuildMetaProcessor, Gentoo::Service::FileProcessorFactory); diff --git a/gentoobrowse-api/service/maintenance/ebuildMetaProcessor.h b/gentoobrowse-api/service/maintenance/ebuildMetaProcessor.h index 5f63c62..5fb62e2 100644 --- a/gentoobrowse-api/service/maintenance/ebuildMetaProcessor.h +++ b/gentoobrowse-api/service/maintenance/ebuildMetaProcessor.h @@ -11,9 +11,11 @@ #include <string> #include <utility> #include <vector> + namespace DB { class Connection; } + namespace Gentoo::Utils { class EbuildCacheParser; } diff --git a/gentoobrowse-api/service/maintenance/masksProcessor.cpp b/gentoobrowse-api/service/maintenance/masksProcessor.cpp index 2988e26..dcfe122 100644 --- a/gentoobrowse-api/service/maintenance/masksProcessor.cpp +++ b/gentoobrowse-api/service/maintenance/masksProcessor.cpp @@ -22,6 +22,7 @@ #include <string_view> #include <tablepatch.h> #include <utility> + // IWYU pragma: no_include <glib.h> namespace Gentoo::Service { @@ -30,11 +31,13 @@ namespace Gentoo::Service { { return 2; } + unsigned char MasksProcessor::order() const { return 10; } + bool MasksProcessor::match(const PathParts & pp) const { @@ -82,8 +85,10 @@ namespace Gentoo::Service { } i->execute(); } + DB::ModifyCommand * i; }; + MaskInserter(tempTable.second.get()).extract(f.sv<gchar>().data(), f.sv<gchar>().length()); // Dates are hand-typed and sometimes typos occur... ensure they're at // least within the range of Boost ptimes. @@ -118,4 +123,5 @@ namespace Gentoo::Service { dbc->modify("DELETE FROM gentoobrowse.masksets")->execute(); } } + FACTORY(Gentoo::Service::MasksProcessor, Gentoo::Service::FileProcessorFactory); diff --git a/gentoobrowse-api/service/maintenance/masksProcessor.h b/gentoobrowse-api/service/maintenance/masksProcessor.h index b2e800e..bcb5c4c 100644 --- a/gentoobrowse-api/service/maintenance/masksProcessor.h +++ b/gentoobrowse-api/service/maintenance/masksProcessor.h @@ -5,6 +5,7 @@ #include "portage-models.h" #include <cstdint> #include <filesystem> + namespace DB { class Connection; } diff --git a/gentoobrowse-api/service/maintenance/newsProcessor.cpp b/gentoobrowse-api/service/maintenance/newsProcessor.cpp index 95450e2..d893d1c 100644 --- a/gentoobrowse-api/service/maintenance/newsProcessor.cpp +++ b/gentoobrowse-api/service/maintenance/newsProcessor.cpp @@ -15,6 +15,7 @@ #include <staticSqlSource.h> #include <string> #include <vector> + // IWYU pragma: no_include <glib.h> namespace Gentoo::Service { @@ -23,11 +24,13 @@ namespace Gentoo::Service { { return 2; } + unsigned char NewsProcessor::order() const { return 10; } + bool NewsProcessor::match(const PathParts & pp) const { @@ -65,4 +68,5 @@ namespace Gentoo::Service { del->execute(); } } + FACTORY(Gentoo::Service::NewsProcessor, Gentoo::Service::FileProcessorFactory); diff --git a/gentoobrowse-api/service/maintenance/newsProcessor.h b/gentoobrowse-api/service/maintenance/newsProcessor.h index 219f858..ed84b7b 100644 --- a/gentoobrowse-api/service/maintenance/newsProcessor.h +++ b/gentoobrowse-api/service/maintenance/newsProcessor.h @@ -4,6 +4,7 @@ #include <cstdint> #include <filesystem> #include <portage-models.h> + namespace DB { class Connection; } diff --git a/gentoobrowse-api/service/maintenance/packageMetaProcessor.cpp b/gentoobrowse-api/service/maintenance/packageMetaProcessor.cpp index a39b5a0..b6b86e2 100644 --- a/gentoobrowse-api/service/maintenance/packageMetaProcessor.cpp +++ b/gentoobrowse-api/service/maintenance/packageMetaProcessor.cpp @@ -13,6 +13,7 @@ #include <sql/maintenance/packageMetaUpdate.sql.h> #include <staticSqlSource.h> #include <string> + namespace DB { class Connection; } @@ -27,11 +28,13 @@ namespace Gentoo::Service { { return 2; } + unsigned char PackageMetaProcessor::order() const { return 3; } + bool PackageMetaProcessor::match(const PathParts & pp) const { @@ -71,4 +74,5 @@ namespace Gentoo::Service { m->execute(); } } + FACTORY(Gentoo::Service::PackageMetaProcessor, Gentoo::Service::FileProcessorFactory); diff --git a/gentoobrowse-api/service/maintenance/packageMetaProcessor.h b/gentoobrowse-api/service/maintenance/packageMetaProcessor.h index 6980079..72beeb5 100644 --- a/gentoobrowse-api/service/maintenance/packageMetaProcessor.h +++ b/gentoobrowse-api/service/maintenance/packageMetaProcessor.h @@ -4,6 +4,7 @@ #include "portage-models.h" #include <cstdint> #include <filesystem> + namespace DB { class Connection; } diff --git a/gentoobrowse-api/service/maintenance/updatesProcessor.cpp b/gentoobrowse-api/service/maintenance/updatesProcessor.cpp index 3295f54..9e4a536 100644 --- a/gentoobrowse-api/service/maintenance/updatesProcessor.cpp +++ b/gentoobrowse-api/service/maintenance/updatesProcessor.cpp @@ -26,6 +26,7 @@ #include <string> #include <tablepatch.h> #include <utility> + namespace Glib { class Regex; } @@ -41,11 +42,13 @@ namespace Gentoo::Service { { return 1; } + unsigned char UpdatesProcessor::order() const { return 1; } + bool UpdatesProcessor::match(const PathParts & pp) const { @@ -78,6 +81,7 @@ namespace Gentoo::Service { drop->execute(); } } + SPECIAL_MEMBERS_DELETE(UpdatesPatch); void @@ -186,4 +190,5 @@ namespace Gentoo::Service { del->bindParamS(0, p.back()); } } + FACTORY(Gentoo::Service::UpdatesProcessor, Gentoo::Service::FileProcessorFactory); diff --git a/gentoobrowse-api/service/maintenance/updatesProcessor.h b/gentoobrowse-api/service/maintenance/updatesProcessor.h index 0ef6872..4fa33ac 100644 --- a/gentoobrowse-api/service/maintenance/updatesProcessor.h +++ b/gentoobrowse-api/service/maintenance/updatesProcessor.h @@ -5,12 +5,14 @@ #include "portage-models.h" #include <cstdint> #include <filesystem> + namespace DB { class Connection; } namespace Gentoo::Service { class UpdatesPatch; + class UpdatesProcessor : public AbstractFileProcessor { public: UpdatesProcessor() = default; diff --git a/gentoobrowse-api/service/maintenance/useGlobalProcessor.cpp b/gentoobrowse-api/service/maintenance/useGlobalProcessor.cpp index e38da9b..811cd87 100644 --- a/gentoobrowse-api/service/maintenance/useGlobalProcessor.cpp +++ b/gentoobrowse-api/service/maintenance/useGlobalProcessor.cpp @@ -12,6 +12,7 @@ #include <modifycommand.h> #include <string> #include <tablepatch.h> + namespace Glib { class Regex; } @@ -27,11 +28,13 @@ namespace Gentoo::Service { { return 2; } + unsigned char UseGlobalProcessor::order() const { return 10; } + bool UseGlobalProcessor::match(const PathParts & pp) const { @@ -74,4 +77,5 @@ namespace Gentoo::Service { dbc->modify("DELETE FROM gentoobrowse.use_global")->execute(); } } + FACTORY(Gentoo::Service::UseGlobalProcessor, Gentoo::Service::FileProcessorFactory); diff --git a/gentoobrowse-api/service/maintenance/useGlobalProcessor.h b/gentoobrowse-api/service/maintenance/useGlobalProcessor.h index 4fc9a71..223e4db 100644 --- a/gentoobrowse-api/service/maintenance/useGlobalProcessor.h +++ b/gentoobrowse-api/service/maintenance/useGlobalProcessor.h @@ -4,6 +4,7 @@ #include "portage-models.h" #include <cstdint> #include <filesystem> + namespace DB { class Connection; } diff --git a/gentoobrowse-api/service/maintenance/useGroupProcessor.cpp b/gentoobrowse-api/service/maintenance/useGroupProcessor.cpp index 7f2261d..5d25a21 100644 --- a/gentoobrowse-api/service/maintenance/useGroupProcessor.cpp +++ b/gentoobrowse-api/service/maintenance/useGroupProcessor.cpp @@ -20,6 +20,7 @@ #include <staticSqlSource.h> #include <string> #include <tablepatch.h> + namespace Glib { class Regex; } @@ -35,11 +36,13 @@ namespace Gentoo::Service { { return 2; } + unsigned char UseGroupProcessor::order() const { return 10; } + bool UseGroupProcessor::match(const PathParts & pp) const { @@ -106,4 +109,5 @@ namespace Gentoo::Service { m->execute(); } } + FACTORY(Gentoo::Service::UseGroupProcessor, Gentoo::Service::FileProcessorFactory); diff --git a/gentoobrowse-api/service/maintenance/useGroupProcessor.h b/gentoobrowse-api/service/maintenance/useGroupProcessor.h index 6d6cb57..d709096 100644 --- a/gentoobrowse-api/service/maintenance/useGroupProcessor.h +++ b/gentoobrowse-api/service/maintenance/useGroupProcessor.h @@ -4,6 +4,7 @@ #include "portage-models.h" #include <cstdint> #include <filesystem> + namespace DB { class Connection; } diff --git a/gentoobrowse-api/service/maintenance/useLocalProcessor.cpp b/gentoobrowse-api/service/maintenance/useLocalProcessor.cpp index 74932bc..17fead6 100644 --- a/gentoobrowse-api/service/maintenance/useLocalProcessor.cpp +++ b/gentoobrowse-api/service/maintenance/useLocalProcessor.cpp @@ -16,6 +16,7 @@ #include <string> #include <tablepatch.h> #include <utility> + namespace Glib { class Regex; } @@ -31,11 +32,13 @@ namespace Gentoo::Service { { return 2; } + unsigned char UseLocalProcessor::order() const { return 10; } + bool UseLocalProcessor::match(const PathParts & pp) const { @@ -83,4 +86,5 @@ namespace Gentoo::Service { dbc->modify("DELETE FROM gentoobrowse.use_local")->execute(); } } + FACTORY(Gentoo::Service::UseLocalProcessor, Gentoo::Service::FileProcessorFactory); diff --git a/gentoobrowse-api/service/maintenance/useLocalProcessor.h b/gentoobrowse-api/service/maintenance/useLocalProcessor.h index 9d8b848..1255b91 100644 --- a/gentoobrowse-api/service/maintenance/useLocalProcessor.h +++ b/gentoobrowse-api/service/maintenance/useLocalProcessor.h @@ -4,6 +4,7 @@ #include "portage-models.h" #include <cstdint> #include <filesystem> + namespace DB { class Connection; } diff --git a/gentoobrowse-api/service/maintenanceBugs.cpp b/gentoobrowse-api/service/maintenanceBugs.cpp index d7832fd..b88c857 100644 --- a/gentoobrowse-api/service/maintenanceBugs.cpp +++ b/gentoobrowse-api/service/maintenanceBugs.cpp @@ -32,6 +32,7 @@ #include <tablepatch.h> #include <utility> #include <utils/dbUtils.h> + namespace Ice { struct Current; } @@ -95,6 +96,7 @@ namespace Gentoo::Service { AdHocFormatter(UpdatingBugsResult, "Refreshed bug list: %? added, %? updated, %? removed"); AdHocFormatter(UpdatingBugsResultPerf, "|added=%? updated=%? removed=%?"); constexpr const std::string_view NagiosServiceName("GB API Bug Updates"); + void Maintenance::refreshBugs(const Ice::Current & c) { diff --git a/gentoobrowse-api/service/maintenanceGitOperations.cpp b/gentoobrowse-api/service/maintenanceGitOperations.cpp index ebeeb83..5948fc8 100644 --- a/gentoobrowse-api/service/maintenanceGitOperations.cpp +++ b/gentoobrowse-api/service/maintenanceGitOperations.cpp @@ -40,6 +40,7 @@ #include <systemd/sd-daemon.h> #include <utility> #include <vector> + // IWYU pragma: no_include "resourcePool.impl.h" namespace Gentoo::Service { @@ -63,6 +64,7 @@ namespace Gentoo::Service { AdHocFormatter(UpdatingChangeLog, "Updating change log for repository %? with range %?...%?"); AdHocFormatter(UpdatedChangeLog, "Updated change log for repository %?, added %? new entries"); + static void writeChangeLog(DB::Connection * db, int64_t repoId, git_repository * repo, const git_oid & lastCommitOid, const git_oid & headCommitOid) @@ -168,6 +170,7 @@ namespace Gentoo::Service { } AdHocFormatter(FindingChanges, "Finding changes for repository %? with range %?...%?"); + ChangeSet writeChangesToFileList( int64_t repoId, git_repository * repo, const git_oid & lastCommitOid, const git_oid & headCommitOid) @@ -187,6 +190,7 @@ namespace Gentoo::Service { constexpr const std::string_view NagiosServiceName("GB API Package Updates"); AdHocFormatter(NagiosServiceUpdate, "Package tree(s) updated|changes=%?"); + void Maintenance::refreshPackageTree(const Ice::Current & c) { @@ -214,6 +218,7 @@ namespace Gentoo::Service { AdHocFormatter(UpdatingFileContent, "Updating file content"); AdHocFormatter(UpdatedFileContent, "Updated file content"); + void Maintenance::applyFileChanges(DB::Connection * dbc, const std::filesystem::path & repoRoot, const Repository & repo, ChangeSet & changes) const diff --git a/gentoobrowse-api/service/news.h b/gentoobrowse-api/service/news.h index 0610675..4259e8e 100644 --- a/gentoobrowse-api/service/news.h +++ b/gentoobrowse-api/service/news.h @@ -3,6 +3,7 @@ #include "portage-models.h" #include <lexer.h> #include <string_view> + // IWYU pragma: no_include <glib.h> namespace Portage::Utils { diff --git a/gentoobrowse-api/service/notificationsimpl.h b/gentoobrowse-api/service/notificationsimpl.h index 2cc6935..7345605 100644 --- a/gentoobrowse-api/service/notificationsimpl.h +++ b/gentoobrowse-api/service/notificationsimpl.h @@ -8,6 +8,7 @@ #include <string> #include <visibility.h> #include <xsltInternals.h> + namespace Gentoo { struct NewsContent; } diff --git a/gentoobrowse-api/service/portageimpl.h b/gentoobrowse-api/service/portageimpl.h index 4bc5963..509e22a 100644 --- a/gentoobrowse-api/service/portageimpl.h +++ b/gentoobrowse-api/service/portageimpl.h @@ -9,6 +9,7 @@ #include <portage.h> #include <string_view> #include <visibility.h> + namespace Ice { struct Current; } diff --git a/gentoobrowse-api/service/usersimpl.cpp b/gentoobrowse-api/service/usersimpl.cpp index e7abdab..83aba65 100644 --- a/gentoobrowse-api/service/usersimpl.cpp +++ b/gentoobrowse-api/service/usersimpl.cpp @@ -27,6 +27,7 @@ #include <sql/users/verify.sql.h> #include <staticSqlSource.h> #include <vector> + // IWYU pragma: no_include "resourcePool.impl.h" namespace Gentoo::Service { diff --git a/gentoobrowse-api/service/usersimpl.h b/gentoobrowse-api/service/usersimpl.h index 5b8d1af..31eff33 100644 --- a/gentoobrowse-api/service/usersimpl.h +++ b/gentoobrowse-api/service/usersimpl.h @@ -9,9 +9,11 @@ #include <string_view> #include <users.h> #include <visibility.h> + namespace Ice { struct Current; } + namespace IceTray { template<typename Connection> class TransactionalDatabaseClient; } diff --git a/gentoobrowse-api/service/utils/dbUtils.cpp b/gentoobrowse-api/service/utils/dbUtils.cpp index d08307a..49cd4de 100644 --- a/gentoobrowse-api/service/utils/dbUtils.cpp +++ b/gentoobrowse-api/service/utils/dbUtils.cpp @@ -44,6 +44,7 @@ namespace Gentoo::Utils::Database { { return tablePatchInserter(dbc, p.src, p.cols); } + DB::ModifyCommandPtr tablePatchInserter(DB::Connection * dbc, const std::string & t, const std::set<std::string> & c) { diff --git a/gentoobrowse-api/service/utils/dbUtils.h b/gentoobrowse-api/service/utils/dbUtils.h index 8a691b6..56eeb91 100644 --- a/gentoobrowse-api/service/utils/dbUtils.h +++ b/gentoobrowse-api/service/utils/dbUtils.h @@ -5,6 +5,7 @@ #include <set> #include <string> #include <utility> + namespace DB { class Connection; class TablePatch; diff --git a/gentoobrowse-api/service/utils/ebuildCacheParser.h b/gentoobrowse-api/service/utils/ebuildCacheParser.h index c36030e..df40b6e 100644 --- a/gentoobrowse-api/service/utils/ebuildCacheParser.h +++ b/gentoobrowse-api/service/utils/ebuildCacheParser.h @@ -6,6 +6,7 @@ #include <optional> #include <string> #include <string_view> + namespace Glib { class ustring; } diff --git a/gentoobrowse-api/service/utils/entityWhereFilter.h b/gentoobrowse-api/service/utils/entityWhereFilter.h index d01ca82..492d123 100644 --- a/gentoobrowse-api/service/utils/entityWhereFilter.h +++ b/gentoobrowse-api/service/utils/entityWhereFilter.h @@ -3,9 +3,11 @@ #include <set> #include <sqlWriter.h> #include <string> + namespace AdHoc { class Buffer; } + namespace DB { class Command; } diff --git a/gentoobrowse-api/service/utils/git.cpp b/gentoobrowse-api/service/utils/git.cpp index 2e1a3eb..140c41f 100644 --- a/gentoobrowse-api/service/utils/git.cpp +++ b/gentoobrowse-api/service/utils/git.cpp @@ -28,6 +28,7 @@ namespace Gentoo::Utils::Git { } AdHocFormatter(RefSpec, "refs/heads/%?:refs/remotes/%?/%?"); + GitAnnotatedCommitPtr gitFetch(git_repository * repo, git_remote * remote, const char * remoteBranchName) { @@ -45,6 +46,7 @@ namespace Gentoo::Utils::Git { AdHocFormatter(FastForward, "Performing fast-forward %? -> %?"); AdHocFormatter(CheckOut, "Checking out %?"); + git_oid gitFastForward(git_repository * repo, const git_annotated_commit * fetch_head) { @@ -80,6 +82,7 @@ namespace Gentoo::Utils::Git { AdHocFormatter(Updating, "Updating repository in %? from %?/%?"); AdHocFormatter(UpdateComplete, "Update complete to %?"); + void updateRepository(const std::string & path, const std::string & upstream, const std::string & branch) { diff --git a/gentoobrowse-api/service/utils/splitEbuildProps.h b/gentoobrowse-api/service/utils/splitEbuildProps.h index 9020c22..0c16b94 100644 --- a/gentoobrowse-api/service/utils/splitEbuildProps.h +++ b/gentoobrowse-api/service/utils/splitEbuildProps.h @@ -5,9 +5,11 @@ #include <optional> #include <sqlWriter.h> #include <string> + namespace AdHoc { class Buffer; } + namespace DB { class Command; } diff --git a/gentoobrowse-api/unittests/mockDefs.h b/gentoobrowse-api/unittests/mockDefs.h index 32284fd..a65eee8 100644 --- a/gentoobrowse-api/unittests/mockDefs.h +++ b/gentoobrowse-api/unittests/mockDefs.h @@ -19,9 +19,11 @@ #include <string_view> #include <users.h> #include <visibility.h> + namespace IceTray::Mime { class TextPart; } + namespace PQ { class Mock; } @@ -69,6 +71,7 @@ public: BOOST_TEST_CONTEXT(sql) { \ sqlRequireEqual<type>(db, sql, expected); \ } + template<typename T> void sqlRequireEqual(DB::ConnectionPtr db, const char * const sql, const T & expected) diff --git a/gentoobrowse-api/unittests/testMaintenance.cpp b/gentoobrowse-api/unittests/testMaintenance.cpp index 6b1621c..42691e4 100644 --- a/gentoobrowse-api/unittests/testMaintenance.cpp +++ b/gentoobrowse-api/unittests/testMaintenance.cpp @@ -30,11 +30,11 @@ #include <string> #include <utility> #include <vector> + // IWYU pragma: no_include <boost/type_index/type_index_facade.hpp> // IWYU pragma: no_include "resourcePool.impl.h" -class MaintenanceClientCombined : public Maintenance, public TestClient { -}; +class MaintenanceClientCombined : public Maintenance, public TestClient { }; BOOST_FIXTURE_TEST_SUITE(maintenance, MaintenanceClientCombined) @@ -147,6 +147,7 @@ public: } } } + static void removedFiles(Gentoo::Service::ChangeSet & changes, const FileMap & from, const FileMap & to) { @@ -156,6 +157,7 @@ public: } } } + static void changedFiles(Gentoo::Service::ChangeSet & changes, const FileMap & from, const FileMap & to) { @@ -193,6 +195,7 @@ BOOST_AUTO_TEST_CASE(refreshPackageTree) doRefreshPackageTree(db, 5, 1, 482, 981, 3626, 4593, 501, 393, 238, 50, 1573, 2008, 1543, 81, 152, 7); Gentoo::PortagePtr portage = std::make_shared<Gentoo::Service::Portage>(p); + BOOST_TEST_CONTEXT_VAR(acjtr, portage->findPackage("app-crypt", "johntheripper", Ice::Current())) { BOOST_TEST_CONTEXT_VAR(acjtrUses, portage->getPackageUses(acjtr->packageid, Ice::Current())) @@ -211,6 +214,7 @@ BOOST_AUTO_TEST_CASE(refreshPackageTree) BOOST_REQUIRE_EQUAL("cpu_flags_x86", *acjtrUses[7]->group); } } + BOOST_TEST_CONTEXT_VAR(nms, portage->findPackage("net-proxy", "squid", Ice::Current())) { BOOST_TEST_CONTEXT_VAR(nmsUses, portage->getPackageUses(nms->packageid, Ice::Current())) @@ -332,6 +336,7 @@ BOOST_AUTO_TEST_CASE(testRefreshGitRepository, *boost::unit_test::precondition([ SQL_REQUIRE_EQUAL(R"SQL(SELECT lastCommit FROM gentoobrowse.repos)SQL", std::string, "40539afe6705aee26a55bb861f5e892ae7240057"); + BOOST_TEST_CONTEXT("libkgapi was moved correctly") { BOOST_TEST_CONTEXT("from net-libs to kde-apps") { SQL_REQUIRE_EQUAL(R"SQL(SELECT COUNT(*) FROM gentoobrowse.categories c, gentoobrowse.packages p @@ -341,6 +346,7 @@ BOOST_AUTO_TEST_CASE(testRefreshGitRepository, *boost::unit_test::precondition([ WHERE c.categoryid = p.categoryid AND p.name = 'libkgapi' AND c.name='net-libs')SQL", int64_t, 0); } + BOOST_TEST_CONTEXT("And it was created new in the right category") { SQL_REQUIRE_EQUAL(R"SQL(SELECT p.packageid FROM gentoobrowse.categories c, gentoobrowse.packages p WHERE c.categoryid = p.categoryid AND p.name = 'libkgapi' AND c.name='kde-apps')SQL", @@ -349,6 +355,7 @@ BOOST_AUTO_TEST_CASE(testRefreshGitRepository, *boost::unit_test::precondition([ WHERE c.categoryid = p.categoryid AND p.name = 'libkgapi' AND c.name='kde-apps')SQL", int64_t, 8); } + BOOST_TEST_CONTEXT("Original ebuilds in moved package were deleted") { SQL_REQUIRE_EQUAL(R"SQL(SELECT COUNT(*) FROM gentoobrowse.ebuilds e WHERE e.packageid = 9)SQL", int64_t, 0); SQL_REQUIRE_EQUAL( @@ -357,6 +364,7 @@ BOOST_AUTO_TEST_CASE(testRefreshGitRepository, *boost::unit_test::precondition([ R"SQL(SELECT COUNT(*) FROM gentoobrowse.ebuilds e WHERE e.ebuildid in (12, 13))SQL", int64_t, 0); } } + BOOST_TEST_CONTEXT("Change log was imported correctly") { SQL_REQUIRE_EQUAL("SELECT COUNT(*) FROM gentoobrowse.changelog", int64_t, 43); SQL_REQUIRE_EQUAL("SELECT COUNT(*) FROM gentoobrowse.changelog WHERE commitid = " diff --git a/gentoobrowse-api/unittests/testMasks.cpp b/gentoobrowse-api/unittests/testMasks.cpp index d45e6f1..24d41fd 100644 --- a/gentoobrowse-api/unittests/testMasks.cpp +++ b/gentoobrowse-api/unittests/testMasks.cpp @@ -18,6 +18,7 @@ #include <set> #include <string> #include <string_view> + // IWYU pragma: no_include <glib.h> class MaskTester : public Portage::Utils::Masks { diff --git a/gentoobrowse-api/unittests/testPortage.cpp b/gentoobrowse-api/unittests/testPortage.cpp index c6b3cb4..09a2392 100644 --- a/gentoobrowse-api/unittests/testPortage.cpp +++ b/gentoobrowse-api/unittests/testPortage.cpp @@ -14,6 +14,7 @@ #include <string> #include <utility> #include <vector> + namespace Slicer { class NoRowsReturned; } diff --git a/gentoobrowse-api/unittests/testProcessAll.cpp b/gentoobrowse-api/unittests/testProcessAll.cpp index 8b4d2a9..f4d8ab2 100644 --- a/gentoobrowse-api/unittests/testProcessAll.cpp +++ b/gentoobrowse-api/unittests/testProcessAll.cpp @@ -15,6 +15,7 @@ #include <string_view> #include <utils/ebuildCacheParser.h> #include <vector> + // IWYU pragma: no_include <glib.h> void diff --git a/gentoobrowse-api/unittests/testUsers.cpp b/gentoobrowse-api/unittests/testUsers.cpp index 29443ee..61f168a 100644 --- a/gentoobrowse-api/unittests/testUsers.cpp +++ b/gentoobrowse-api/unittests/testUsers.cpp @@ -14,9 +14,11 @@ #include <mockMail.h> #include <string> #include <vector> + namespace Slicer { class NoRowsReturned; } + // IWYU pragma: no_include <boost/core/enable_if.hpp> // IWYU pragma: no_include <boost/mpl/identity.hpp> |