#pragma once #include "package.h" #include #include #include #include #include #include namespace katja { struct info { std::string prgnam; std::string version; std::string homepage; std::vector download; std::vector md5sum; std::vector download_x86_64; std::vector md5sum_x86_64; std::vector requires; std::string maintainer; std::string email; }; class sbo : public repository { using ordered_set = boost::multi_index_container< std::string, boost::multi_index::indexed_by< boost::multi_index::ordered_unique>, boost::multi_index::sequenced<> > >; boost::filesystem::path git_binary; std::filesystem::path cache_path; template void git(const std::string& command, const std::filesystem::path& cwd, const Args&... args) const { if (cwd.empty()) { boost::process::system(git_binary, command, args...); } else { boost::process::system(git_binary, "-C", cwd.native(), command, args...); } } info parse_info_file(const std::filesystem::path& package_directory) const; /** * Returns the list of packages in the repository. * * @return A map containing package names as key, and its category * directory name as value. */ std::unordered_map collect_packages() const; void resolve_dependencies(const std::string& package_name, const std::unordered_map& package_categories, ordered_set& resolved) const; public: explicit sbo(); virtual std::unordered_map list(const std::set& package_names) override; virtual void refresh() override; virtual std::forward_list check_dependencies(const std::string& package_name) override; }; }