diff options
35 files changed, 143 insertions, 124 deletions
diff --git a/gentoobrowse-api/Jamfile.jam b/gentoobrowse-api/Jamfile.jam index 26a5a10..c0bb91a 100644 --- a/gentoobrowse-api/Jamfile.jam +++ b/gentoobrowse-api/Jamfile.jam @@ -7,9 +7,7 @@ lib slicer-db : : : : <include>/usr/include/slicer ; lib Ice : : <name>Ice++11 ; lib pthread ; lib IceBox : : <name>IceBox++11 ; -lib boost_filesystem ; -lib boost_system ; -lib boost_thread ; +lib stdc++fs ; lib boost_date_time ; lib dbppcore : : : : <include>/usr/include/dbpp ; diff --git a/gentoobrowse-api/client/Jamfile.jam b/gentoobrowse-api/client/Jamfile.jam index 7c3edaa..af2deba 100644 --- a/gentoobrowse-api/client/Jamfile.jam +++ b/gentoobrowse-api/client/Jamfile.jam @@ -5,7 +5,6 @@ exe gbcli : : <library>../domain//gentoobrowse-domain <library>..//adhocutil - <library>..//boost_system <library>boost_program_options <implicit-dependency>../domain//gentoobrowse-domain <library>../api//gentoobrowse-api diff --git a/gentoobrowse-api/service/Jamfile.jam b/gentoobrowse-api/service/Jamfile.jam index 46bf541..84adc44 100644 --- a/gentoobrowse-api/service/Jamfile.jam +++ b/gentoobrowse-api/service/Jamfile.jam @@ -41,9 +41,7 @@ lib gentoobrowse-service++11 : <library>slicer-xml <library>../api//gentoobrowse-api <implicit-dependency>../api//gentoobrowse-api - <library>..//boost_system - <library>..//boost_thread - <library>..//boost_filesystem + <library>..//stdc++fs <library>..//boost_date_time <library>../..//glibmm <library>../..//libxmlpp diff --git a/gentoobrowse-api/service/changeSet.h b/gentoobrowse-api/service/changeSet.h index 321de4e..c13573c 100644 --- a/gentoobrowse-api/service/changeSet.h +++ b/gentoobrowse-api/service/changeSet.h @@ -3,7 +3,7 @@ #include <git2/diff.h> #include <portage-models.h> -#include <boost/filesystem/path.hpp> +#include <filesystem> #include <map> namespace Gentoo { @@ -12,7 +12,7 @@ namespace Gentoo { StringList pathParts; git_delta_t changeType; }; - typedef std::map<boost::filesystem::path, ChangeDetails> ChangeSet; + typedef std::map<std::filesystem::path, ChangeDetails> ChangeSet; } } diff --git a/gentoobrowse-api/service/maintenance/abstractFileProcessor.h b/gentoobrowse-api/service/maintenance/abstractFileProcessor.h index 91e66ce..cd44536 100644 --- a/gentoobrowse-api/service/maintenance/abstractFileProcessor.h +++ b/gentoobrowse-api/service/maintenance/abstractFileProcessor.h @@ -3,7 +3,7 @@ #include <connection.h> #include <maintenance.h> -#include <boost/filesystem/path.hpp> +#include <filesystem> #include <factory.h> #include "changeSet.h" @@ -24,8 +24,8 @@ namespace Gentoo { virtual void phaseEnd(DB::Connection *, ChangeSet &); virtual void tidy(DB::Connection *); - virtual void created(DB::Connection * dbc, int64_t repoid, const Gentoo::StringList & fn, const boost::filesystem::path & path) = 0; - virtual void modified(DB::Connection * dbc, int64_t repoid, const Gentoo::StringList & fn, const boost::filesystem::path & path) = 0; + virtual void created(DB::Connection * dbc, int64_t repoid, const Gentoo::StringList & fn, const std::filesystem::path & path) = 0; + virtual void modified(DB::Connection * dbc, int64_t repoid, const Gentoo::StringList & fn, const std::filesystem::path & path) = 0; virtual void deleted(DB::Connection * dbc, int64_t repoid, const Gentoo::StringList & fn) = 0; }; typedef std::shared_ptr<AbstractFileProcessor> FileProcessorPtr; diff --git a/gentoobrowse-api/service/maintenance/categoryMetaProcessor.cpp b/gentoobrowse-api/service/maintenance/categoryMetaProcessor.cpp index 552448f..5f5b41a 100644 --- a/gentoobrowse-api/service/maintenance/categoryMetaProcessor.cpp +++ b/gentoobrowse-api/service/maintenance/categoryMetaProcessor.cpp @@ -20,13 +20,13 @@ namespace Gentoo { } void - CategoryMetaProcessor::created(DB::Connection * dbc, int64_t r, const StringList & fn, const boost::filesystem::path & path) + CategoryMetaProcessor::created(DB::Connection * dbc, int64_t r, const StringList & fn, const std::filesystem::path & path) { modified(dbc, r, fn, path); } void - CategoryMetaProcessor::modified(DB::Connection * dbc, int64_t, const StringList & fn, const boost::filesystem::path & path) + CategoryMetaProcessor::modified(DB::Connection * dbc, int64_t, const StringList & fn, const std::filesystem::path & path) { auto m = sql::maintenance::categoryMetaUpdate.modify(dbc); U::XmlDoc md(path); diff --git a/gentoobrowse-api/service/maintenance/categoryMetaProcessor.h b/gentoobrowse-api/service/maintenance/categoryMetaProcessor.h index 570faef..0306f3e 100644 --- a/gentoobrowse-api/service/maintenance/categoryMetaProcessor.h +++ b/gentoobrowse-api/service/maintenance/categoryMetaProcessor.h @@ -12,8 +12,8 @@ namespace Gentoo { unsigned char order() const override; bool match(const PathParts & pp) const override; - void created(DB::Connection * dbc, int64_t repoid, const Gentoo::StringList & fn, const boost::filesystem::path & path) override; - void modified(DB::Connection * dbc, int64_t repoid, const Gentoo::StringList & fn, const boost::filesystem::path & path) override; + void created(DB::Connection * dbc, int64_t repoid, const Gentoo::StringList & fn, const std::filesystem::path & path) override; + void modified(DB::Connection * dbc, int64_t repoid, const Gentoo::StringList & fn, const std::filesystem::path & path) override; void deleted(DB::Connection * dbc, int64_t repoid, const Gentoo::StringList & fn) override; }; } diff --git a/gentoobrowse-api/service/maintenance/ebuildMetaProcessor.cpp b/gentoobrowse-api/service/maintenance/ebuildMetaProcessor.cpp index 34b451f..905ba95 100644 --- a/gentoobrowse-api/service/maintenance/ebuildMetaProcessor.cpp +++ b/gentoobrowse-api/service/maintenance/ebuildMetaProcessor.cpp @@ -3,7 +3,6 @@ #include <sqlWriter.h> #include <selectcommandUtil.impl.h> #include <sqlWriter.h> -#include <boost/filesystem/operations.hpp> #include <boost/algorithm/string/join.hpp> #include <boost/date_time/posix_time/conversion.hpp> #include <glibmm/regex.h> @@ -47,7 +46,7 @@ namespace Gentoo { } void - EbuildMetaProcessor::created(DB::Connection * dbc, int64_t repoId, const StringList & fn, const boost::filesystem::path & path) + EbuildMetaProcessor::created(DB::Connection * dbc, int64_t repoId, const StringList & fn, const std::filesystem::path & path) { Glib::MatchInfo matches; const Glib::ustring pv = fn[3]; @@ -86,7 +85,7 @@ namespace Gentoo { } void - EbuildMetaProcessor::modified(DB::Connection * dbc, int64_t repoId, const StringList & fn, const boost::filesystem::path & path) + EbuildMetaProcessor::modified(DB::Connection * dbc, int64_t repoId, const StringList & fn, const std::filesystem::path & path) { Glib::MatchInfo matches; const Glib::ustring pv = fn[3]; diff --git a/gentoobrowse-api/service/maintenance/ebuildMetaProcessor.h b/gentoobrowse-api/service/maintenance/ebuildMetaProcessor.h index c232933..89f2751 100644 --- a/gentoobrowse-api/service/maintenance/ebuildMetaProcessor.h +++ b/gentoobrowse-api/service/maintenance/ebuildMetaProcessor.h @@ -6,7 +6,7 @@ #include <portage-models.h> #include <connection.h> #include <modifycommand.h> -#include <boost/filesystem/path.hpp> +#include <filesystem> #include "utils/entityWhereFilter.h" namespace Gentoo { @@ -19,8 +19,8 @@ namespace Gentoo { EbuildMetaProcessor(); - void created(DB::Connection * dbc, int64_t repoid, const Gentoo::StringList & fn, const boost::filesystem::path & path) override; - void modified(DB::Connection * dbc, int64_t repoid, const Gentoo::StringList & fn, const boost::filesystem::path & path) override; + void created(DB::Connection * dbc, int64_t repoid, const Gentoo::StringList & fn, const std::filesystem::path & path) override; + void modified(DB::Connection * dbc, int64_t repoid, const Gentoo::StringList & fn, const std::filesystem::path & path) override; void deleted(DB::Connection * dbc, int64_t repoid, const Gentoo::StringList & fn) override; private: diff --git a/gentoobrowse-api/service/maintenance/masksProcessor.cpp b/gentoobrowse-api/service/maintenance/masksProcessor.cpp index c28f458..9476f20 100644 --- a/gentoobrowse-api/service/maintenance/masksProcessor.cpp +++ b/gentoobrowse-api/service/maintenance/masksProcessor.cpp @@ -22,13 +22,13 @@ namespace Gentoo { } void - MasksProcessor::created(DB::Connection * dbc, int64_t r, const StringList & fn, const boost::filesystem::path & path) + MasksProcessor::created(DB::Connection * dbc, int64_t r, const StringList & fn, const std::filesystem::path & path) { modified(dbc, r, fn, path); } void - MasksProcessor::modified(DB::Connection * dbc, int64_t, const StringList &, const boost::filesystem::path & path) + MasksProcessor::modified(DB::Connection * dbc, int64_t, const StringList &, const std::filesystem::path & path) { auto tempTable = Utils::Database::namedTemp(dbc, "tmp_masks", { { "n", "int" }, diff --git a/gentoobrowse-api/service/maintenance/masksProcessor.h b/gentoobrowse-api/service/maintenance/masksProcessor.h index 664a71e..31acfdc 100644 --- a/gentoobrowse-api/service/maintenance/masksProcessor.h +++ b/gentoobrowse-api/service/maintenance/masksProcessor.h @@ -4,7 +4,7 @@ #include "abstractFileProcessor.h" #include <connection.h> #include <modifycommand.h> -#include <boost/filesystem/path.hpp> +#include <filesystem> namespace Gentoo { namespace Service { @@ -14,8 +14,8 @@ namespace Gentoo { unsigned char order() const override; bool match(const PathParts & pp) const override; - void created(DB::Connection * dbc, int64_t repoid, const Gentoo::StringList & fn, const boost::filesystem::path & path) override; - void modified(DB::Connection * dbc, int64_t repoid, const Gentoo::StringList & fn, const boost::filesystem::path & path) override; + void created(DB::Connection * dbc, int64_t repoid, const Gentoo::StringList & fn, const std::filesystem::path & path) override; + void modified(DB::Connection * dbc, int64_t repoid, const Gentoo::StringList & fn, const std::filesystem::path & path) override; void deleted(DB::Connection * dbc, int64_t repoid, const Gentoo::StringList & fn) override; void phaseEnd(DB::Connection *, ChangeSet &) override; diff --git a/gentoobrowse-api/service/maintenance/newsProcessor.cpp b/gentoobrowse-api/service/maintenance/newsProcessor.cpp index e416eea..e42d043 100644 --- a/gentoobrowse-api/service/maintenance/newsProcessor.cpp +++ b/gentoobrowse-api/service/maintenance/newsProcessor.cpp @@ -18,24 +18,24 @@ namespace Gentoo { } void - NewsProcessor::created(DB::Connection * dbc, int64_t, const StringList &, const boost::filesystem::path & path) + NewsProcessor::created(DB::Connection * dbc, int64_t, const StringList &, const std::filesystem::path & path) { importNews<Slicer::SqlInsertSerializer>(dbc, path); } void - NewsProcessor::modified(DB::Connection * dbc, int64_t, const StringList &, const boost::filesystem::path & path) + NewsProcessor::modified(DB::Connection * dbc, int64_t, const StringList &, const std::filesystem::path & path) { importNews<Slicer::SqlUpdateSerializer>(dbc, path); } template <typename Serializer> void - NewsProcessor::importNews(DB::Connection * dbc, const boost::filesystem::path & path) + NewsProcessor::importNews(DB::Connection * dbc, const std::filesystem::path & path) { AdHoc::FileUtils::MemMap m(path); auto news = Portage::Utils::News::parse(m.sv<gchar>()); - news->newsid = path.parent_path().leaf().string(); + news->newsid = path.parent_path().filename(); Slicer::SerializeAny<Serializer>(news, dbc, "gentoobrowse.news"); } diff --git a/gentoobrowse-api/service/maintenance/newsProcessor.h b/gentoobrowse-api/service/maintenance/newsProcessor.h index b7a34ff..024da5d 100644 --- a/gentoobrowse-api/service/maintenance/newsProcessor.h +++ b/gentoobrowse-api/service/maintenance/newsProcessor.h @@ -3,7 +3,7 @@ #include "abstractFileProcessor.h" #include <connection.h> -#include <boost/filesystem/path.hpp> +#include <filesystem> #include <portage-models.h> namespace Gentoo { @@ -14,13 +14,13 @@ namespace Gentoo { unsigned char order() const override; bool match(const PathParts & pp) const override; - void created(DB::Connection * dbc, int64_t repoid, const Gentoo::StringList & fn, const boost::filesystem::path & path) override; - void modified(DB::Connection * dbc, int64_t repoid, const Gentoo::StringList & fn, const boost::filesystem::path & path) override; + void created(DB::Connection * dbc, int64_t repoid, const Gentoo::StringList & fn, const std::filesystem::path & path) override; + void modified(DB::Connection * dbc, int64_t repoid, const Gentoo::StringList & fn, const std::filesystem::path & path) override; void deleted(DB::Connection * dbc, int64_t repoid, const Gentoo::StringList & fn) override; private: template <typename Serializer> - static void importNews(DB::Connection * dbc, const boost::filesystem::path & path); + static void importNews(DB::Connection * dbc, const std::filesystem::path & path); }; } } diff --git a/gentoobrowse-api/service/maintenance/packageMetaProcessor.cpp b/gentoobrowse-api/service/maintenance/packageMetaProcessor.cpp index f77c2bb..9fe0ca3 100644 --- a/gentoobrowse-api/service/maintenance/packageMetaProcessor.cpp +++ b/gentoobrowse-api/service/maintenance/packageMetaProcessor.cpp @@ -21,13 +21,13 @@ namespace Gentoo { void - PackageMetaProcessor::created(DB::Connection * dbc, int64_t r, const StringList & fn, const boost::filesystem::path & path) + PackageMetaProcessor::created(DB::Connection * dbc, int64_t r, const StringList & fn, const std::filesystem::path & path) { modified(dbc, r, fn, path); } void - PackageMetaProcessor::modified(DB::Connection * dbc, int64_t, const StringList & fn, const boost::filesystem::path & path) + PackageMetaProcessor::modified(DB::Connection * dbc, int64_t, const StringList & fn, const std::filesystem::path & path) { auto m = sql::maintenance::packageMetaUpdate.modify(dbc); U::XmlDoc md(path); diff --git a/gentoobrowse-api/service/maintenance/packageMetaProcessor.h b/gentoobrowse-api/service/maintenance/packageMetaProcessor.h index 84ce4e4..1b63a4a 100644 --- a/gentoobrowse-api/service/maintenance/packageMetaProcessor.h +++ b/gentoobrowse-api/service/maintenance/packageMetaProcessor.h @@ -3,7 +3,7 @@ #include "abstractFileProcessor.h" #include <connection.h> -#include <boost/filesystem/path.hpp> +#include <filesystem> namespace Gentoo { namespace Service { @@ -13,8 +13,8 @@ namespace Gentoo { unsigned char order() const override; bool match(const PathParts & pp) const override; - void created(DB::Connection * dbc, int64_t repoid, const Gentoo::StringList & fn, const boost::filesystem::path & path) override; - void modified(DB::Connection * dbc, int64_t repoid, const Gentoo::StringList & fn, const boost::filesystem::path & path) override; + void created(DB::Connection * dbc, int64_t repoid, const Gentoo::StringList & fn, const std::filesystem::path & path) override; + void modified(DB::Connection * dbc, int64_t repoid, const Gentoo::StringList & fn, const std::filesystem::path & path) override; void deleted(DB::Connection * dbc, int64_t repoid, const Gentoo::StringList & fn) override; }; } diff --git a/gentoobrowse-api/service/maintenance/updatesProcessor.cpp b/gentoobrowse-api/service/maintenance/updatesProcessor.cpp index 64887f4..f5b0bd5 100644 --- a/gentoobrowse-api/service/maintenance/updatesProcessor.cpp +++ b/gentoobrowse-api/service/maintenance/updatesProcessor.cpp @@ -127,13 +127,13 @@ namespace Gentoo { } void - UpdatesProcessor::created(DB::Connection * dbc, int64_t r, const StringList & fn, const boost::filesystem::path & path) + UpdatesProcessor::created(DB::Connection * dbc, int64_t r, const StringList & fn, const std::filesystem::path & path) { modified(dbc, r, fn, path); } void - UpdatesProcessor::modified(DB::Connection * dbc, int64_t, const StringList & fn, const boost::filesystem::path & path) + UpdatesProcessor::modified(DB::Connection * dbc, int64_t, const StringList & fn, const std::filesystem::path & path) { AdHoc::FileUtils::MemMap u(path); Glib::ustring d(std::string(reinterpret_cast<const char *>(u.data), u.getStat().st_size)); diff --git a/gentoobrowse-api/service/maintenance/updatesProcessor.h b/gentoobrowse-api/service/maintenance/updatesProcessor.h index 7d7f258..06dc0f2 100644 --- a/gentoobrowse-api/service/maintenance/updatesProcessor.h +++ b/gentoobrowse-api/service/maintenance/updatesProcessor.h @@ -4,7 +4,7 @@ #include "abstractFileProcessor.h" #include <connection.h> #include <modifycommand.h> -#include <boost/filesystem/path.hpp> +#include <filesystem> namespace Gentoo { namespace Service { @@ -15,8 +15,8 @@ namespace Gentoo { unsigned char order() const override; bool match(const PathParts & pp) const override; - void created(DB::Connection * dbc, int64_t repoid, const Gentoo::StringList & fn, const boost::filesystem::path & path) override; - void modified(DB::Connection * dbc, int64_t repoid, const Gentoo::StringList & fn, const boost::filesystem::path & path) override; + void created(DB::Connection * dbc, int64_t repoid, const Gentoo::StringList & fn, const std::filesystem::path & path) override; + void modified(DB::Connection * dbc, int64_t repoid, const Gentoo::StringList & fn, const std::filesystem::path & path) override; void deleted(DB::Connection * dbc, int64_t repoid, const Gentoo::StringList & fn) override; void prepare(DB::Connection * dbc) override; diff --git a/gentoobrowse-api/service/maintenance/useGlobalProcessor.cpp b/gentoobrowse-api/service/maintenance/useGlobalProcessor.cpp index 7a3728e..4ce8d21 100644 --- a/gentoobrowse-api/service/maintenance/useGlobalProcessor.cpp +++ b/gentoobrowse-api/service/maintenance/useGlobalProcessor.cpp @@ -19,13 +19,13 @@ namespace Gentoo { } void - UseGlobalProcessor::created(DB::Connection * dbc, int64_t r, const StringList & fn, const boost::filesystem::path & path) + UseGlobalProcessor::created(DB::Connection * dbc, int64_t r, const StringList & fn, const std::filesystem::path & path) { modified(dbc, r, fn, path); } void - UseGlobalProcessor::modified(DB::Connection * dbc, int64_t, const StringList &, const boost::filesystem::path & path) + UseGlobalProcessor::modified(DB::Connection * dbc, int64_t, const StringList &, const std::filesystem::path & path) { DB::TablePatch p; p.dest = "gentoobrowse.use_global"; diff --git a/gentoobrowse-api/service/maintenance/useGlobalProcessor.h b/gentoobrowse-api/service/maintenance/useGlobalProcessor.h index fd54faa..c052873 100644 --- a/gentoobrowse-api/service/maintenance/useGlobalProcessor.h +++ b/gentoobrowse-api/service/maintenance/useGlobalProcessor.h @@ -4,7 +4,7 @@ #include "abstractFileProcessor.h" #include <connection.h> #include <modifycommand.h> -#include <boost/filesystem/path.hpp> +#include <filesystem> namespace Gentoo { namespace Service { @@ -14,8 +14,8 @@ namespace Gentoo { unsigned char order() const override; bool match(const PathParts & pp) const override; - void created(DB::Connection * dbc, int64_t repoid, const Gentoo::StringList & fn, const boost::filesystem::path & path) override; - void modified(DB::Connection * dbc, int64_t repoid, const Gentoo::StringList & fn, const boost::filesystem::path & path) override; + void created(DB::Connection * dbc, int64_t repoid, const Gentoo::StringList & fn, const std::filesystem::path & path) override; + void modified(DB::Connection * dbc, int64_t repoid, const Gentoo::StringList & fn, const std::filesystem::path & path) override; void deleted(DB::Connection * dbc, int64_t repoid, const Gentoo::StringList & fn) override; }; } diff --git a/gentoobrowse-api/service/maintenance/useGroupProcessor.cpp b/gentoobrowse-api/service/maintenance/useGroupProcessor.cpp index 757638b..93ab2ad 100644 --- a/gentoobrowse-api/service/maintenance/useGroupProcessor.cpp +++ b/gentoobrowse-api/service/maintenance/useGroupProcessor.cpp @@ -25,7 +25,7 @@ namespace Gentoo { } void - UseGroupProcessor::created(DB::Connection * dbc, int64_t, const StringList &, const boost::filesystem::path & path) + UseGroupProcessor::created(DB::Connection * dbc, int64_t, const StringList &, const std::filesystem::path & path) { auto m = sql::maintenance::useGroupsInsert.select(dbc); m->bindParamS(0, path.stem().string()); @@ -35,7 +35,7 @@ namespace Gentoo { } void - UseGroupProcessor::modified(DB::Connection * dbc, int64_t, const StringList &, const boost::filesystem::path & path) + UseGroupProcessor::modified(DB::Connection * dbc, int64_t, const StringList &, const std::filesystem::path & path) { auto m = sql::maintenance::useGroupsGetId.select(dbc); m->bindParamS(0, path.stem().string()); @@ -45,7 +45,7 @@ namespace Gentoo { } void - UseGroupProcessor::mergeContent(DB::Connection * dbc, const boost::filesystem::path & path, int64_t useGroupId) + UseGroupProcessor::mergeContent(DB::Connection * dbc, const std::filesystem::path & path, int64_t useGroupId) { DB::TablePatch p; p.dest = "gentoobrowse.use_group"; diff --git a/gentoobrowse-api/service/maintenance/useGroupProcessor.h b/gentoobrowse-api/service/maintenance/useGroupProcessor.h index 2cb066e..758af3a 100644 --- a/gentoobrowse-api/service/maintenance/useGroupProcessor.h +++ b/gentoobrowse-api/service/maintenance/useGroupProcessor.h @@ -4,7 +4,7 @@ #include "abstractFileProcessor.h" #include <connection.h> #include <modifycommand.h> -#include <boost/filesystem/path.hpp> +#include <filesystem> namespace Gentoo { namespace Service { @@ -14,12 +14,12 @@ namespace Gentoo { unsigned char order() const override; bool match(const PathParts & pp) const override; - void created(DB::Connection * dbc, int64_t repoid, const Gentoo::StringList & fn, const boost::filesystem::path & path) override; - void modified(DB::Connection * dbc, int64_t repoid, const Gentoo::StringList & fn, const boost::filesystem::path & path) override; + void created(DB::Connection * dbc, int64_t repoid, const Gentoo::StringList & fn, const std::filesystem::path & path) override; + void modified(DB::Connection * dbc, int64_t repoid, const Gentoo::StringList & fn, const std::filesystem::path & path) override; void deleted(DB::Connection * dbc, int64_t repoid, const Gentoo::StringList & fn) override; private: - void mergeContent(DB::Connection *, const boost::filesystem::path &, int64_t id); + void mergeContent(DB::Connection *, const std::filesystem::path &, int64_t id); }; } } diff --git a/gentoobrowse-api/service/maintenance/useLocalProcessor.cpp b/gentoobrowse-api/service/maintenance/useLocalProcessor.cpp index bf961f5..bce8c2a 100644 --- a/gentoobrowse-api/service/maintenance/useLocalProcessor.cpp +++ b/gentoobrowse-api/service/maintenance/useLocalProcessor.cpp @@ -21,13 +21,13 @@ namespace Gentoo { } void - UseLocalProcessor::created(DB::Connection * dbc, int64_t r, const StringList & fn, const boost::filesystem::path & path) + UseLocalProcessor::created(DB::Connection * dbc, int64_t r, const StringList & fn, const std::filesystem::path & path) { modified(dbc, r, fn, path); } void - UseLocalProcessor::modified(DB::Connection * dbc, int64_t, const StringList &, const boost::filesystem::path & path) + UseLocalProcessor::modified(DB::Connection * dbc, int64_t, const StringList &, const std::filesystem::path & path) { DB::TablePatch p; auto tempTable = Utils::Database::namedTemp(dbc, "tmp_uselocalraw", { diff --git a/gentoobrowse-api/service/maintenance/useLocalProcessor.h b/gentoobrowse-api/service/maintenance/useLocalProcessor.h index 4e4bace..4186a33 100644 --- a/gentoobrowse-api/service/maintenance/useLocalProcessor.h +++ b/gentoobrowse-api/service/maintenance/useLocalProcessor.h @@ -4,7 +4,7 @@ #include "abstractFileProcessor.h" #include <connection.h> #include <modifycommand.h> -#include <boost/filesystem/path.hpp> +#include <filesystem> namespace Gentoo { namespace Service { @@ -14,8 +14,8 @@ namespace Gentoo { unsigned char order() const override; bool match(const PathParts & pp) const override; - void created(DB::Connection * dbc, int64_t repoid, const Gentoo::StringList & fn, const boost::filesystem::path & path) override; - void modified(DB::Connection * dbc, int64_t repoid, const Gentoo::StringList & fn, const boost::filesystem::path & path) override; + void created(DB::Connection * dbc, int64_t repoid, const Gentoo::StringList & fn, const std::filesystem::path & path) override; + void modified(DB::Connection * dbc, int64_t repoid, const Gentoo::StringList & fn, const std::filesystem::path & path) override; void deleted(DB::Connection * dbc, int64_t repoid, const Gentoo::StringList & fn) override; }; } diff --git a/gentoobrowse-api/service/maintenanceBugs.cpp b/gentoobrowse-api/service/maintenanceBugs.cpp index 0b8e51a..04a595e 100644 --- a/gentoobrowse-api/service/maintenanceBugs.cpp +++ b/gentoobrowse-api/service/maintenanceBugs.cpp @@ -1,11 +1,11 @@ #include "maintenanceimpl.h" +#include <stack> #include <boost/lexical_cast.hpp> #include <selectcommandUtil.impl.h> #include <tablepatch.h> #include <sqlWriter.h> #include <buffer.h> #include <scopeExit.h> -#include <boost/filesystem/operations.hpp> #pragma GCC diagnostic ignored "-Wdeprecated-declarations" #include <curlStream.h> #include <libxml++/parsers/saxparser.h> @@ -74,7 +74,7 @@ namespace Gentoo { void Maintenance::refreshBugs(const Ice::Current & c) { - boost::filesystem::path root = properties(c)->getPropertyWithDefault( + std::filesystem::path root = properties(c)->getPropertyWithDefault( "GentooBrowseAPI.BugRoot", "https://bugs.gentoo.org/data/cached"); UpdatingBugs::write(std::cerr, root); diff --git a/gentoobrowse-api/service/maintenanceGitOperations.cpp b/gentoobrowse-api/service/maintenanceGitOperations.cpp index 7e34ab5..396ff5a 100644 --- a/gentoobrowse-api/service/maintenanceGitOperations.cpp +++ b/gentoobrowse-api/service/maintenanceGitOperations.cpp @@ -97,17 +97,6 @@ namespace Gentoo { } } - static inline - PathParts - split(const boost::filesystem::path & path) - { - PathParts pp; - for (const auto & p : path) { - pp.push_back(p.string()); - } - return pp; - } - static int insertFileChange(const git_diff_delta * delta, void * ptr) @@ -118,8 +107,8 @@ namespace Gentoo { case GIT_DELTA_MODIFIED: case GIT_DELTA_DELETED: { - boost::filesystem::path path(delta->new_file.path); - cs->insert({ path, { split(path), delta->status }}); + std::filesystem::path path(delta->new_file.path); + cs->insert({ path, { { path.begin(), path.end() }, delta->status }}); } break; default: @@ -177,7 +166,7 @@ namespace Gentoo { Maintenance::refreshPackageTree(const Ice::Current & c) { auto properties = c.adapter->getCommunicator()->getProperties(); - auto repoRoot = boost::filesystem::path(properties->getPropertyWithDefault("GentooBrowseAPI.RepoRoot", "/")); + auto repoRoot = std::filesystem::path(properties->getPropertyWithDefault("GentooBrowseAPI.RepoRoot", "/")); auto dbc = db->get(); DB::TransactionScope tx(*dbc.get()); for (auto & repo : fetch<Gentoo::Repositories>(dbc.get(), sql::maintenance::reposToGitRefresh)) { @@ -189,7 +178,7 @@ namespace Gentoo { AdHocFormatter(UpdatingFileContent, "Updating file content\n"); AdHocFormatter(UpdatedFileContent, "Updated file content\n"); void - Maintenance::applyFileChanges(DB::Connection * dbc, const boost::filesystem::path & repoRoot, const Repository & repo, ChangeSet & changes) const + Maintenance::applyFileChanges(DB::Connection * dbc, const std::filesystem::path & repoRoot, const Repository & repo, ChangeSet & changes) const { UpdatingFileContent::write(std::cerr); // Map of phase, to order, to processor @@ -199,12 +188,13 @@ namespace Gentoo { fps[processor->phase()].insert({ processor->order(), processor })->second->prepare(dbc); } // Processor -> repoId, PathParts, Path - typedef std::function<void(FileProcessorPtr, int64_t, const Gentoo::StringList &, const boost::filesystem::path &)> FileHandleFunc; + typedef std::function<void(FileProcessorPtr, int64_t, const Gentoo::StringList &, const std::filesystem::path &)> FileHandleFunc; std::map<git_delta_t, FileHandleFunc> funcs; funcs[GIT_DELTA_DELETED] = std::bind(&AbstractFileProcessor::deleted, pl::_1, dbc, pl::_2, pl::_3); funcs[GIT_DELTA_MODIFIED] = std::bind(&AbstractFileProcessor::modified, pl::_1, dbc, pl::_2, pl::_3, pl::_4); funcs[GIT_DELTA_ADDED] = std::bind(&AbstractFileProcessor::created, pl::_1, dbc, pl::_2, pl::_3, pl::_4); + const auto repoPath = repoRoot / std::filesystem::path(repo.path).lexically_relative("/"); // Phases for (const auto & phase : fps) { std::set<FileProcessorPtr> usedProcessors; @@ -214,7 +204,7 @@ namespace Gentoo { // Changes for (auto change = changes.begin(); change != changes.end(); ) { if (processor->match(change->second.pathParts)) { - funcs[change->second.changeType](processor, repo.repoid, change->second.pathParts, repoRoot / repo.path / change->first); + funcs[change->second.changeType](processor, repo.repoid, change->second.pathParts, repoPath / change->first); usedProcessors.insert(processor); change = changes.erase(change); } diff --git a/gentoobrowse-api/service/maintenanceimpl.h b/gentoobrowse-api/service/maintenanceimpl.h index ae0bdd8..8aece5b 100644 --- a/gentoobrowse-api/service/maintenanceimpl.h +++ b/gentoobrowse-api/service/maintenanceimpl.h @@ -26,7 +26,7 @@ namespace Gentoo { protected: Maintenance(const DB::ConnectionPoolPtr & d); - void applyFileChanges(DB::Connection *, const boost::filesystem::path &, const Repository &, ChangeSet &) const; + void applyFileChanges(DB::Connection *, const std::filesystem::path &, const Repository &, ChangeSet &) const; private: template<typename Task> diff --git a/gentoobrowse-api/service/utils/ebuildCacheParser.cpp b/gentoobrowse-api/service/utils/ebuildCacheParser.cpp index c3ac689..bbe804e 100644 --- a/gentoobrowse-api/service/utils/ebuildCacheParser.cpp +++ b/gentoobrowse-api/service/utils/ebuildCacheParser.cpp @@ -2,7 +2,7 @@ namespace Gentoo { namespace Utils { - EbuildCacheParser::EbuildCacheParser(const boost::filesystem::path & p) : + EbuildCacheParser::EbuildCacheParser(const std::filesystem::path & p) : AdHoc::FileUtils::MemMap(p) { auto chardata = sv(); diff --git a/gentoobrowse-api/service/utils/ebuildCacheParser.h b/gentoobrowse-api/service/utils/ebuildCacheParser.h index ca6d6f4..6874d40 100644 --- a/gentoobrowse-api/service/utils/ebuildCacheParser.h +++ b/gentoobrowse-api/service/utils/ebuildCacheParser.h @@ -5,7 +5,7 @@ #include <map> #include <string_view> #include <optional> -#include <boost/filesystem/path.hpp> +#include <filesystem> #include <glibmm/ustring.h> namespace Gentoo { @@ -14,7 +14,7 @@ namespace Gentoo { public: typedef std::map<std::string_view, const std::string_view> KVs; - EbuildCacheParser(const boost::filesystem::path & p); + EbuildCacheParser(const std::filesystem::path & p); std::optional<Glib::ustring> get(const std::string & key) const; std::optional<std::string_view> getRange(const std::string & key) const; diff --git a/gentoobrowse-api/service/utils/xmlUtils.cpp b/gentoobrowse-api/service/utils/xmlUtils.cpp index 03078d4..f938efa 100644 --- a/gentoobrowse-api/service/utils/xmlUtils.cpp +++ b/gentoobrowse-api/service/utils/xmlUtils.cpp @@ -2,8 +2,8 @@ namespace Gentoo { namespace Utils { - XmlDoc::XmlDoc(const boost::filesystem::path & path) : - xmlpp::DomParser(path.string()) + XmlDoc::XmlDoc(const std::filesystem::path & path) : + xmlpp::DomParser(path) { } diff --git a/gentoobrowse-api/service/utils/xmlUtils.h b/gentoobrowse-api/service/utils/xmlUtils.h index a02df6c..3e71f1d 100644 --- a/gentoobrowse-api/service/utils/xmlUtils.h +++ b/gentoobrowse-api/service/utils/xmlUtils.h @@ -2,14 +2,14 @@ #define GENTOOBROWSE_API_SERVICE_XMLUTILS_H #include <libxml++/parsers/domparser.h> -#include <boost/filesystem/path.hpp> +#include <filesystem> #include <optional> namespace Gentoo { namespace Utils { class XmlDoc : public xmlpp::DomParser { public: - XmlDoc(const boost::filesystem::path &); + XmlDoc(const std::filesystem::path &); std::optional<Glib::ustring> getXPathValue(const Glib::ustring &); }; diff --git a/gentoobrowse-api/unittests/Jamfile.jam b/gentoobrowse-api/unittests/Jamfile.jam index 2fd9f79..b765a6b 100644 --- a/gentoobrowse-api/unittests/Jamfile.jam +++ b/gentoobrowse-api/unittests/Jamfile.jam @@ -23,8 +23,7 @@ lib testCommon : <library>..//dbppcore <library>..//adhocutil <define>ROOT=\"$(me)\" - <library>..//boost_system - <library>..//boost_filesystem + <library>..//stdc++fs <library>..//Ice <library>..//IceBox <library>dryice @@ -40,8 +39,7 @@ lib testCommon : <library>../service//gentoobrowse-service++11 <implicit-dependency>../service//gentoobrowse-service++11 <library>..//Ice - <library>..//boost_system - <library>..//boost_filesystem + <library>..//stdc++fs <library>boost_utf <dependency>test-data <define>ROOT=\"$(me)\" @@ -89,9 +87,21 @@ run : testNews ; run + testMaintenanceBits.cpp + : : : + <dependency>../db/schema.sql + <define>BOOST_TEST_DYN_LINK + <library>testCommon + <library>git2 + <library>../service//icetray + <implicit-dependency>testCommon + ; + +run testMaintenance.cpp : : : <dependency>../db/schema.sql + <dependency>testMaintenanceBits <define>BOOST_TEST_DYN_LINK <library>testCommon <library>git2 diff --git a/gentoobrowse-api/unittests/testMaintenance.cpp b/gentoobrowse-api/unittests/testMaintenance.cpp index a23444a..da0e6cd 100644 --- a/gentoobrowse-api/unittests/testMaintenance.cpp +++ b/gentoobrowse-api/unittests/testMaintenance.cpp @@ -15,8 +15,8 @@ class MaintenanceClientCombined : public Maintenance, public TestClient { }; BOOST_FIXTURE_TEST_SUITE(maintenance, MaintenanceClientCombined) -const boost::filesystem::path treeDir(binDir / "tree"); -const boost::filesystem::path fixturesDir(rootDir / "fixtures"); +const std::filesystem::path treeDir(binDir / "tree"); +const std::filesystem::path fixturesDir(rootDir / "fixtures"); void dumpDb(DB::ConnectionPtr db); @@ -69,14 +69,14 @@ dumpDb(DB::ConnectionPtr db) class M2 : public Gentoo::Service::Maintenance { public: - typedef std::map<boost::filesystem::path, size_t> FileMap; + typedef std::map<std::filesystem::path, size_t> FileMap; M2(const DB::ConnectionPoolPtr & d) : Gentoo::Service::Maintenance(d) { } - void applyDiffOfFolders(const boost::filesystem::path & from, const boost::filesystem::path & to) const + void applyDiffOfFolders(const std::filesystem::path & from, const std::filesystem::path & to) const { auto dbc = db->get(); auto fromFiles = fileSet(from); @@ -86,25 +86,25 @@ class M2 : public Gentoo::Service::Maintenance { newFiles(changes, fromFiles, toFiles); removedFiles(changes, fromFiles, toFiles); changedFiles(changes, fromFiles, toFiles); - boost::filesystem::remove(treeDir); - boost::filesystem::create_symlink(to, treeDir); + std::filesystem::remove(treeDir); + std::filesystem::create_symlink(to, treeDir); Gentoo::Repository repo = { 1, "gentoo", to.string(), "origin", "master", "" }; applyFileChanges(dbc.get(), "/", repo, changes); - boost::filesystem::remove(treeDir); + std::filesystem::remove(treeDir); } - static FileMap fileSet(const boost::filesystem::path & p) + static FileMap fileSet(const std::filesystem::path & p) { FileMap found; - for (boost::filesystem::recursive_directory_iterator r(p); r != boost::filesystem::recursive_directory_iterator(); r++) { - if (boost::filesystem::is_regular(r->status())) { - found[boost::filesystem::relative(*r, p)] = boost::filesystem::file_size(*r); + for (std::filesystem::recursive_directory_iterator r(p); r != std::filesystem::recursive_directory_iterator(); r++) { + if (std::filesystem::is_regular_file(r->status())) { + found[std::filesystem::relative(*r, p)] = std::filesystem::file_size(*r); } } return found; } - static Gentoo::Service::PathParts split(const boost::filesystem::path & path) + static Gentoo::Service::PathParts split(const std::filesystem::path & path) { Gentoo::Service::PathParts pp; for (const auto & p : path) { @@ -155,8 +155,8 @@ BOOST_AUTO_TEST_CASE( refreshPackageTree ) insRepo->bindParamS(4, "8292397bf6a8c91215b03a558e8bc843aff25b64"); insRepo->execute(); - boost::filesystem::remove_all(binDir / "empty"); - boost::filesystem::create_directory(binDir / "empty"); + std::filesystem::remove_all(binDir / "empty"); + std::filesystem::create_directory(binDir / "empty"); auto p = std::make_shared<IceTray::MockPool>("GentooBrowseAPI", 1, 1); M2 m2(p); @@ -234,8 +234,8 @@ BOOST_AUTO_TEST_CASE( testUpdateGitRepository ) { auto db = DB::ConnectionPtr(DB::MockDatabase::openConnectionTo("GentooBrowseAPI")); auto testRepo = binDir / "testrepo"; - boost::filesystem::remove_all(testRepo); - boost::filesystem::create_directories(testRepo); + std::filesystem::remove_all(testRepo); + std::filesystem::create_directories(testRepo); // Create a stub repo to update git_libgit2_init(); git_repository * repo; @@ -261,11 +261,11 @@ BOOST_AUTO_TEST_CASE( testUpdateGitRepository ) m->updateRepositories(); // Verify checkout - BOOST_REQUIRE(boost::filesystem::is_directory(testRepo)); - BOOST_REQUIRE(boost::filesystem::is_directory(testRepo / "virtual")); - BOOST_REQUIRE(boost::filesystem::is_directory(testRepo / "net-misc")); - BOOST_REQUIRE(boost::filesystem::is_directory(testRepo / "net-misc" / "gentoobrowse-api")); - BOOST_REQUIRE(boost::filesystem::is_regular_file(testRepo / "net-misc" / "gentoobrowse-api" / "Manifest")); + BOOST_REQUIRE(std::filesystem::is_directory(testRepo)); + BOOST_REQUIRE(std::filesystem::is_directory(testRepo / "virtual")); + BOOST_REQUIRE(std::filesystem::is_directory(testRepo / "net-misc")); + BOOST_REQUIRE(std::filesystem::is_directory(testRepo / "net-misc" / "gentoobrowse-api")); + BOOST_REQUIRE(std::filesystem::is_regular_file(testRepo / "net-misc" / "gentoobrowse-api" / "Manifest")); } BOOST_AUTO_TEST_CASE( testRefreshGitRepository ) @@ -278,7 +278,7 @@ BOOST_AUTO_TEST_CASE( testRefreshGitRepository ) insRepo->bindParamS(3, "master"); insRepo->bindParamS(4, "8292397bf6a8c91215b03a558e8bc843aff25b64"); insRepo->execute(); - std::ifstream data((rootDir / "gitdata.sql").string()); + std::ifstream data(rootDir / "gitdata.sql"); db->executeScript(data, rootDir); BOOST_TEST_CONTEXT("Intiial values") { diff --git a/gentoobrowse-api/unittests/testMaintenanceBits.cpp b/gentoobrowse-api/unittests/testMaintenanceBits.cpp new file mode 100644 index 0000000..c7104d9 --- /dev/null +++ b/gentoobrowse-api/unittests/testMaintenanceBits.cpp @@ -0,0 +1,27 @@ +#define BOOST_TEST_MODULE TestMaintenanceBits +#include <boost/test/unit_test.hpp> + +#include <maintenance/abstractFileProcessor.h> + +BOOST_AUTO_TEST_CASE( match ) +{ + std::filesystem::path path { "metadata/md5-cache/app-admin/conky-1.10.6-r1" }; + Gentoo::Service::PathParts pp { path.begin(), path.end() }; + BOOST_REQUIRE_EQUAL(4, pp.size()); + BOOST_CHECK_EQUAL("metadata", pp[0]); + BOOST_CHECK_EQUAL("md5-cache", pp[1]); +} + +BOOST_AUTO_TEST_CASE( compose ) +{ + // std::filesystem composes slightly differently to boost::filesystem + // Specifically "/base" / "/sub" + // boost => "/base/sub" + // std => "/sub" + std::filesystem::path base {"/base"}, file {"file"}; + std::string sub {"/sub"}; + + std::filesystem::path comp = base / std::filesystem::path(sub).lexically_relative("/") / file; + BOOST_CHECK_EQUAL("/base/sub/file", comp); +} + diff --git a/gentoobrowse-api/unittests/testProcessAll.cpp b/gentoobrowse-api/unittests/testProcessAll.cpp index b06ad23..b3c2d77 100644 --- a/gentoobrowse-api/unittests/testProcessAll.cpp +++ b/gentoobrowse-api/unittests/testProcessAll.cpp @@ -5,8 +5,7 @@ #include <depend.h> #include <news.h> #include <utils/ebuildCacheParser.h> -#include <boost/filesystem/path.hpp> -#include <boost/filesystem/convenience.hpp> +#include <filesystem> void testDependRange(const std::optional<std::string_view> & r) @@ -17,17 +16,17 @@ testDependRange(const std::optional<std::string_view> & r) } auto -getFileList(const boost::filesystem::path & root, bool(*pred)(const boost::filesystem::path &)) +getFileList(const std::filesystem::path & root, bool(*pred)(const std::filesystem::path &)) { - std::vector<boost::filesystem::path> paths; - std::copy_if(boost::filesystem::recursive_directory_iterator(root), - boost::filesystem::recursive_directory_iterator(), + std::vector<std::filesystem::path> paths; + std::copy_if(std::filesystem::recursive_directory_iterator(root), + std::filesystem::recursive_directory_iterator(), std::back_inserter(paths), pred); return paths; } BOOST_DATA_TEST_CASE( ebuildCacheDependencies, boost::unit_test::data::make( - getFileList("/usr/portage/metadata/md5-cache", boost::filesystem::is_regular_file)), + getFileList("/usr/portage/metadata/md5-cache", std::filesystem::is_regular_file)), path ) { Gentoo::Utils::EbuildCacheParser ecp(path); @@ -37,7 +36,7 @@ BOOST_DATA_TEST_CASE( ebuildCacheDependencies, boost::unit_test::data::make( } BOOST_DATA_TEST_CASE( news, boost::unit_test::data::make( - getFileList("/usr/portage/metadata/news", boost::filesystem::is_regular_file)), + getFileList("/usr/portage/metadata/news", std::filesystem::is_regular_file)), path ) { AdHoc::FileUtils::MemMap n(path); diff --git a/gentoobrowse-api/util/Jamfile.jam b/gentoobrowse-api/util/Jamfile.jam index cb06c61..a8bf7b5 100644 --- a/gentoobrowse-api/util/Jamfile.jam +++ b/gentoobrowse-api/util/Jamfile.jam @@ -2,7 +2,6 @@ lib boost_program_options ; exe gbdbupdate : update.cpp : <library>..//adhocutil - <library>..//boost_system <library>boost_program_options <library>../api//gentoobrowse-api <implicit-dependency>../api//gentoobrowse-api |