From 67d798dcb056b815b5439b05bd823a4a46843899 Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Wed, 12 Mar 2025 13:04:58 +0100 Subject: katja: Show only updates --- include/katja/database.hpp | 10 ++++++---- include/katja/repository.hpp | 20 ++++++++++++++++++++ include/katja/sbo.hpp | 14 ++++++++++++++ 3 files changed, 40 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/katja/database.hpp b/include/katja/database.hpp index ee4816e..ca85ab1 100644 --- a/include/katja/database.hpp +++ b/include/katja/database.hpp @@ -20,10 +20,10 @@ namespace katja static database_package create_database_package(const std::string& fullname); public: - const std::string build_tag; - const std::string architecture; - const std::string version; const std::string name; + const std::string version; + const std::string architecture; + const std::string build_tag; database_package(const std::string& fullname); @@ -33,5 +33,7 @@ namespace katja std::string to_string() const; }; - std::multimap read_installed_database(); + using package_database = std::multimap; + + package_database read_installed_database(); } diff --git a/include/katja/repository.hpp b/include/katja/repository.hpp index ca20277..0a799bd 100644 --- a/include/katja/repository.hpp +++ b/include/katja/repository.hpp @@ -5,6 +5,26 @@ */ #pragma once +#include +#include + +#include "katja/database.hpp" + namespace katja { + struct package_identifier + { + const std::string name; + const std::string version; + const std::string architecture; + const std::string data; + + std::string to_string() const; + }; + + class repository + { + public: + virtual std::vector get_updates(const package_database& database) = 0; + }; } diff --git a/include/katja/sbo.hpp b/include/katja/sbo.hpp index ff16dd7..3c7a5d9 100644 --- a/include/katja/sbo.hpp +++ b/include/katja/sbo.hpp @@ -10,6 +10,8 @@ #include #include +#include "katja/repository.hpp" + namespace katja { struct info_file @@ -24,6 +26,18 @@ namespace katja const std::string homepage, const std::string& email, const std::string& maintainer); }; + class sbo_repository final : public repository + { + std::map info_paths; + + public: + sbo_repository(const std::filesystem::path& repository_path); + + std::vector get_updates(const package_database& database) override; + }; + std::optional read_slackbuild_info(const std::filesystem::path& info_filepath); void search_for_slackbuilds(std::vector& info_files, const std::filesystem::path& directory); + void search_for_slackbuilds(std::map& info_files, + const std::filesystem::path& directory); } -- cgit v1.2.3