aboutsummaryrefslogtreecommitdiff
path: root/include/katja/sbo.hpp
blob: 3c7a5d99948a9d51c8db25abb484595fe49fa9c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/*
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at https://mozilla.org/MPL/2.0/.
 */
#pragma once

#include <string>
#include <vector>
#include <filesystem>
#include <optional>

#include "katja/repository.hpp"

namespace katja
{
    struct info_file
    {
        const std::string program_name;
        const std::string version;
        const std::string homepage;
        const std::string email;
        const std::string maintainer;

        info_file(const std::string& program_name, const std::string& version,
                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);
}