]> git.ipfire.org Git - pakfire.git/blob - src/libpakfire/include/pakfire/package.h
Import libpakfire
[pakfire.git] / src / libpakfire / include / pakfire / package.h
1 /*#############################################################################
2 # #
3 # Pakfire - The IPFire package management system #
4 # Copyright (C) 2013 Pakfire development team #
5 # #
6 # This program is free software: you can redistribute it and/or modify #
7 # it under the terms of the GNU General Public License as published by #
8 # the Free Software Foundation, either version 3 of the License, or #
9 # (at your option) any later version. #
10 # #
11 # This program is distributed in the hope that it will be useful, #
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
14 # GNU General Public License for more details. #
15 # #
16 # You should have received a copy of the GNU General Public License #
17 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
18 # #
19 #############################################################################*/
20
21 #ifndef PAKFIRE_PACKAGE_H
22 #define PAKFIRE_PACKAGE_H
23
24 #include <solv/pooltypes.h>
25
26 #include <pakfire/relation.h>
27 #include <pakfire/relationlist.h>
28 #include <pakfire/pool.h>
29 #include <pakfire/types.h>
30
31 PakfirePackage pakfire_package_create(PakfirePool pool, Id id);
32 PakfirePackage pakfire_package_create2(PakfirePool pool, PakfireRepo repo, const char* name, const char* evr, const char* arch);
33 void pakfire_package_free(PakfirePackage pkg);
34
35 int pakfire_package_identical(PakfirePackage pkg1, PakfirePackage pkg2);
36 int pakfire_package_cmp(PakfirePackage pkg1, PakfirePackage pkg2);
37 int pakfire_package_evr_cmp(PakfirePackage pkg1, PakfirePackage pkg2);
38
39 Id pakfire_package_id(PakfirePackage pkg);
40
41 char* pakfire_package_get_nevra(PakfirePackage pkg);
42 const char* pakfire_package_get_name(PakfirePackage pkg);
43 void pakfire_package_set_name(PakfirePackage pkg, const char* name);
44 const char* pakfire_package_get_evr(PakfirePackage pkg);
45 void pakfire_package_set_evr(PakfirePackage pkg, const char* evr);
46 unsigned long pakfire_package_get_epoch(PakfirePackage pkg);
47 const char* pakfire_package_get_version(PakfirePackage pkg);
48 const char* pakfire_package_get_release(PakfirePackage pkg);
49 const char* pakfire_package_get_arch(PakfirePackage pkg);
50 void pakfire_package_set_arch(PakfirePackage pkg, const char* arch);
51
52 const char* pakfire_package_get_uuid(PakfirePackage pkg);
53 void pakfire_package_set_uuid(PakfirePackage pkg, const char* uuid);
54 const char* pakfire_package_get_checksum(PakfirePackage pkg);
55 void pakfire_package_set_checksum(PakfirePackage pkg, const char* checksum);
56 const char* pakfire_package_get_summary(PakfirePackage pkg);
57 void pakfire_package_set_summary(PakfirePackage pkg, const char* summary);
58 const char* pakfire_package_get_description(PakfirePackage pkg);
59 void pakfire_package_set_description(PakfirePackage pkg, const char* description);
60 const char* pakfire_package_get_license(PakfirePackage pkg);
61 void pakfire_package_set_license(PakfirePackage pkg, const char* license);
62 const char* pakfire_package_get_url(PakfirePackage pkg);
63 void pakfire_package_set_url(PakfirePackage pkg, const char* url);
64 const char** pakfire_package_get_groups(PakfirePackage pkg);
65 void pakfire_package_set_groups(PakfirePackage pkg, const char** grouplist);
66 const char* pakfire_package_get_vendor(PakfirePackage pkg);
67 void pakfire_package_set_vendor(PakfirePackage pkg, const char* vendor);
68 const char* pakfire_package_get_maintainer(PakfirePackage pkg);
69 void pakfire_package_set_maintainer(PakfirePackage pkg, const char* maintainer);
70 const char* pakfire_package_get_filename(PakfirePackage pkg);
71 void pakfire_package_set_filename(PakfirePackage pkg, const char* filename);
72 int pakfire_package_is_installed(PakfirePackage pkg);
73 unsigned long long pakfire_package_get_downloadsize(PakfirePackage pkg);
74 void pakfire_package_set_downloadsize(PakfirePackage pkg, unsigned long long downloadsize);
75 unsigned long long pakfire_package_get_installsize(PakfirePackage pkg);
76 void pakfire_package_set_installsize(PakfirePackage pkg, unsigned long long installsize);
77 unsigned long long pakfire_package_get_size(PakfirePackage pkg);
78 const char* pakfire_package_get_buildhost(PakfirePackage pkg);
79 void pakfire_package_set_buildhost(PakfirePackage pkg, const char* buildhost);
80 unsigned long long pakfire_package_get_buildtime(PakfirePackage pkg);
81 void pakfire_package_set_buildtime(PakfirePackage pkg, unsigned long long buildtime);
82 unsigned long long pakfire_package_get_installtime(PakfirePackage pkg);
83
84 PakfireRelationList pakfire_package_get_provides(PakfirePackage pkg);
85 void pakfire_package_set_provides(PakfirePackage pkg, PakfireRelationList relationlist);
86 void pakfire_package_add_provides(PakfirePackage pkg, PakfireRelation relation);
87 PakfireRelationList pakfire_package_get_requires(PakfirePackage pkg);
88 void pakfire_package_set_requires(PakfirePackage pkg, PakfireRelationList relationlist);
89 void pakfire_package_add_requires(PakfirePackage pkg, PakfireRelation relation);
90 PakfireRelationList pakfire_package_get_conflicts(PakfirePackage pkg);
91 void pakfire_package_set_conflicts(PakfirePackage pkg, PakfireRelationList relationlist);
92 void pakfire_package_add_conflicts(PakfirePackage pkg, PakfireRelation relation);
93 PakfireRelationList pakfire_package_get_obsoletes(PakfirePackage pkg);
94 void pakfire_package_set_obsoletes(PakfirePackage pkg, PakfireRelationList relationlist);
95 void pakfire_package_add_obsoletes(PakfirePackage pkg, PakfireRelation relation);
96 PakfireRelationList pakfire_package_get_recommends(PakfirePackage pkg);
97 void pakfire_package_set_recommends(PakfirePackage pkg, PakfireRelationList relationlist);
98 void pakfire_package_add_recommends(PakfirePackage pkg, PakfireRelation relation);
99 PakfireRelationList pakfire_package_get_suggests(PakfirePackage pkg);
100 void pakfire_package_set_suggests(PakfirePackage pkg, PakfireRelationList relationlist);
101 void pakfire_package_add_suggests(PakfirePackage pkg, PakfireRelation relation);
102
103 PakfireRepo pakfire_package_get_repo(PakfirePackage pkg);
104 void pakfire_package_set_repo(PakfirePackage pkg, PakfireRepo repo);
105
106 char* pakfire_package_get_location(PakfirePackage pkg);
107
108 char* pakfire_package_dump(PakfirePackage pkg, int flags);
109
110 int pakfire_package_is_cached(PakfirePackage pkg);
111 char* pakfire_package_get_cache_path(PakfirePackage pkg);
112 char* pakfire_package_get_cache_full_path(PakfirePackage pkg);
113
114 PakfireFile pakfire_package_get_filelist(PakfirePackage pkg);
115 PakfireFile pakfire_package_filelist_append(PakfirePackage pkg, const char* filename);
116 #if 0
117 PakfireFile pakfire_package_filelist_append(PakfirePackage pkg);
118 #endif
119 void pakfire_package_filelist_remove(PakfirePackage pkg);
120
121 enum pakfire_package_keynames {
122 PAKFIRE_PKG,
123 PAKFIRE_PKG_ALL,
124 PAKFIRE_PKG_ARCH,
125 PAKFIRE_PKG_CONFLICTS,
126 PAKFIRE_PKG_DESCRIPTION,
127 PAKFIRE_PKG_EPOCH,
128 PAKFIRE_PKG_EVR,
129 PAKFIRE_PKG_FILE,
130 PAKFIRE_PKG_NAME,
131 PAKFIRE_PKG_OBSOLETES,
132 PAKFIRE_PKG_PROVIDES,
133 PAKFIRE_PKG_RELEASE,
134 PAKFIRE_PKG_REPONAME,
135 PAKFIRE_PKG_REQUIRES,
136 PAKFIRE_PKG_SOURCERPM,
137 PAKFIRE_PKG_SUMMARY,
138 PAKFIRE_PKG_URL,
139 PAKFIRE_PKG_VERSION,
140 PAKFIRE_PKG_LOCATION
141 };
142
143 enum pakfire_package_dump_flags {
144 PAKFIRE_PKG_DUMP_FILELIST = 1 << 0,
145 PAKFIRE_PKG_DUMP_LONG = 1 << 1,
146 };
147
148 #ifdef PAKFIRE_PRIVATE
149
150 struct _PakfirePackage {
151 PakfirePool pool;
152 Id id;
153 int nrefs;
154 PakfireFile filelist;
155 };
156
157 static inline PakfirePool pakfire_package_pool(PakfirePackage pkg) {
158 return pkg->pool;
159 }
160
161 static inline Pool* pakfire_package_solv_pool(PakfirePackage pkg) {
162 return pakfire_package_pool(pkg)->pool;
163 }
164
165 #endif
166
167 #endif /* PAKFIRE_PACKAGE_H */