-
Notifications
You must be signed in to change notification settings - Fork 2
/
db.h
131 lines (104 loc) · 4.3 KB
/
db.h
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
#ifndef PKGDEPDB_DB_H__
#define PKGDEPDB_DB_H__
namespace pkgdepdb {
struct DB {
static uint16_t CURRENT;
uint16_t loaded_version_;
bool strict_linking_; // stored as flag bit
string name_;
StringList library_path_;
PackageList packages_;
ObjectList objects_;
StringSet ignore_file_rules_;
std::map<string, StringList> package_library_path_;
StringSet base_packages_;
StringSet assume_found_rules_;
// non-serialized {
const Config& config_;
bool contains_package_depends_;
bool contains_make_depends_;
bool contains_check_depends_;
bool contains_groups_;
bool contains_filelists_;
bool contains_pkgbase_;
// }
DB() = delete;
DB(const Config&);
~DB();
DB(bool wiped, const DB& copy);
bool InstallPackage(Package* &&pkg);
bool DeletePackage (const string& name, bool destroy = true);
bool DeletePackage (PackageList::const_iterator, bool destroy = true);
Elf *FindFor (const Elf*, const string& lib,
const StringList *extrapath) const;
void LinkObject (Elf*, const Package *owner,
ObjectSet &req_found,
StringSet &req_missing) const;
void LinkObject_do (Elf*, const Package *owner);
void RelinkAll ();
void FixPaths ();
bool WipePackages ();
bool WipeFilelists ();
#ifdef PKGDEPDB_ENABLE_THREADS
void RelinkAll_Threaded();
#endif
Package* FindPkg (const string& name) const;
PackageList::const_iterator FindPkg_i (const string& name) const;
void ShowInfo();
void ShowInfo_json();
void ShowPackages (bool filter_broken, bool filter_notempty,
const FilterList&, const ObjFilterList&);
void ShowPackages_json(bool filter_broken, bool filter_notempty,
const FilterList&, const ObjFilterList&);
void ShowObjects (const FilterList&, const ObjFilterList&);
void ShowObjects_json (const FilterList&, const ObjFilterList&);
void ShowMissing ();
void ShowMissing_json ();
void ShowFound ();
void ShowFound_json ();
void ShowFilelist (const FilterList&, const StrFilterList&);
void ShowFilelist_json(const FilterList&, const StrFilterList&);
void CheckIntegrity(const FilterList &pkg_filters,
const ObjFilterList &obj_filters) const;
void CheckIntegrity(const Package *pkg,
const PkgMap &pkgmap,
const PkgListMap &providemap,
const PkgListMap &replacemap,
const PkgMap &basemap,
const ObjListMap &objmap,
const vec<const Package*> &base,
const ObjFilterList &obj_filters) const;
bool Store(const string& filename);
bool Load (const string& filename);
bool Empty() const;
bool LD_Append (const string& dir);
bool LD_Prepend(const string& dir);
bool LD_Delete (const string& dir);
bool LD_Delete (size_t i);
bool LD_Insert (const string& dir, size_t i);
bool LD_Clear ();
bool IgnoreFile_Add (const string& name);
bool IgnoreFile_Delete(const string& name);
bool IgnoreFile_Delete(size_t id);
bool AssumeFound_Add (const string& name);
bool AssumeFound_Delete(const string& name);
bool AssumeFound_Delete(size_t id);
bool BasePackages_Add (const string& name);
bool BasePackages_Delete(const string& name);
bool BasePackages_Delete(size_t id);
bool PKG_LD_Insert(const string& pkg, const string& path, size_t);
bool PKG_LD_Delete(const string& pkg, const string& path);
bool PKG_LD_Delete(const string& pkg, size_t i);
bool PKG_LD_Clear (const string& pkg);
bool IsBroken(const Package *pkg) const;
bool IsBroken(const Elf *elf) const;
bool IsEmpty (const Package *elf, const ObjFilterList &filters) const;
private:
bool ElfFinds(const Elf*, const string& lib,
const StringList *extrapath) const;
const StringList* GetObjectLibPath(const Elf*) const;
const StringList* GetPackageLibPath(const Package*) const;
};
bool db_store_json(DB *db, const string& filename);
} // ::pkgdepdb
#endif