summaryrefslogtreecommitdiff
path: root/backend/pkgtools.h
blob: e51b4b9dbe9d8d74f1cf882be6d9966a3f4ce1f2 (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
/*
 * 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 <cstdint>
#include <glib-object.h>
#include "utils.h"

namespace katja
{
class Pkgtools
{
public:
	const char *get_name () const noexcept;
	const char *get_mirror () const noexcept;
    std::uint8_t get_order () const noexcept;
	bool is_blacklisted (const char *pkg) const noexcept;

	virtual ~Pkgtools () noexcept;

	bool download (JobData *job_data,
			char *dest_dir_name, char *pkg_name) noexcept;
	void install (JobData *job_data, char *pkg_name) noexcept;

	virtual GSList *collect_cache_info (const char *tmpl) noexcept = 0;
	virtual void generate_cache (JobData *job_data,
			const char *tmpl) noexcept = 0;

protected:
	char *name = nullptr;
	char *mirror = nullptr;
    std::uint8_t order;
	GRegex *blacklist = nullptr;
};

}