katja: Show only updates

This commit is contained in:
2025-03-12 13:04:58 +01:00
parent dfa5a732ba
commit 67d798dcb0
6 changed files with 111 additions and 21 deletions

View File

@ -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<std::string, database_package> read_installed_database();
using package_database = std::multimap<std::string, database_package>;
package_database read_installed_database();
}

View File

@ -5,6 +5,26 @@
*/
#pragma once
#include <string>
#include <vector>
#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<package_identifier> get_updates(const package_database& database) = 0;
};
}

View File

@ -10,6 +10,8 @@
#include <filesystem>
#include <optional>
#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<std::string, std::filesystem::path> info_paths;
public:
sbo_repository(const std::filesystem::path& repository_path);
std::vector<package_identifier> get_updates(const package_database& database) override;
};
std::optional<info_file> read_slackbuild_info(const std::filesystem::path& info_filepath);
void search_for_slackbuilds(std::vector<info_file>& info_files, const std::filesystem::path& directory);
void search_for_slackbuilds(std::map<std::string, std::filesystem::path>& info_files,
const std::filesystem::path& directory);
}