added disk usage data to PackageImplIf interface, provide this info from
[platform/upstream/libzypp.git] / zypp / target / rpm / RpmPackageImpl.cc
1 /*---------------------------------------------------------------------\
2 |                          ____ _   __ __ ___                          |
3 |                         |__  / \ / / . \ . \                         |
4 |                           / / \ V /|  _/  _/                         |
5 |                          / /__ | | | | | |                           |
6 |                         /_____||_| |_| |_|                           |
7 |                                                                      |
8 \---------------------------------------------------------------------*/
9 /** \file zypp/target/rpm/RPMPackageImpl.cc
10  *
11 */
12
13 #include "zypp/target/rpm/RpmPackageImpl.h"
14 #include "zypp/base/String.h"
15 #include "zypp/base/Logger.h"
16
17 #include <list>
18 #include <string>
19
20 using namespace std;
21 using namespace zypp::detail;
22
23 ///////////////////////////////////////////////////////////////////
24 namespace zypp
25 { /////////////////////////////////////////////////////////////////
26   ///////////////////////////////////////////////////////////////////
27   namespace target
28   { /////////////////////////////////////////////////////////////////
29     namespace rpm
30     {
31       ///////////////////////////////////////////////////////////////////
32       //
33       //        CLASS NAME : RPMPackageImpl
34       //
35       ///////////////////////////////////////////////////////////////////
36
37
38       RPMPackageImpl::RPMPackageImpl(
39         const RpmHeader::constPtr data
40       )
41       : _summary(data->tag_summary()),
42         _description(),
43         _buildtime(data->tag_buildtime()),
44         _buildhost(data->tag_buildhost()),
45         _url(data->tag_url()),
46         _vendor(data->tag_vendor()),
47         _license(data->tag_license()),
48         _packager(data->tag_packager()),
49         _group(data->tag_group()),
50         _changelog(data->tag_changelog()),
51         _type("rpm"), // FIXME in the future
52 //      _authors(data->authors),
53 //      _keywords(data->keywords),
54         _filenames(data->tag_filenames())
55 #if 0
56       : _size_package( strtol(parsed.sizePackage.c_str(), 0, 10)),
57         _size_archive( strtol(parsed.sizeArchive.c_str(), 0, 10)),
58         _size_installed( strtol(parsed.sizeInstalled.c_str(), 0, 10)),
59         _sourcepkg( parsed.sourcerpm),
60         _dir_sizes(parsed.dirSizes),
61 #endif
62       {
63         _description.push_back(data->tag_description());
64       }
65
66
67       /** Package summary */
68       Label RPMPackageImpl::summary() const
69       { return _summary; }
70
71       /** Package description */
72       Text RPMPackageImpl::description() const
73       { return _description; }
74
75       Text RPMPackageImpl::insnotify() const
76       // metadata doesn't priovide this attribute
77       { return ResObjectImplIf::insnotify(); }
78
79       Text RPMPackageImpl::delnotify() const
80       // metadata doesn't priovide this attribute
81       { return ResObjectImplIf::delnotify(); }
82
83       ByteCount RPMPackageImpl::size() const
84       { }
85
86       bool RPMPackageImpl::providesSources() const
87       { return ResObjectImplIf::providesSources(); }
88
89       Label RPMPackageImpl::instSrcLabel() const
90       { return ResObjectImplIf::instSrcLabel(); }
91       
92       Vendor RPMPackageImpl::instSrcVendor() const
93       { return ResObjectImplIf::instSrcVendor(); }
94       
95       /** */
96       Date RPMPackageImpl::buildtime() const
97       { return _buildtime; }
98
99       /** */
100       std::string RPMPackageImpl::buildhost() const
101       { return _buildhost; }
102
103       /** */
104       Date RPMPackageImpl::installtime() const
105       { return PackageImplIf::installtime(); }
106
107       /** */
108       std::string RPMPackageImpl::distribution() const
109       { }
110
111       /** */
112       Vendor RPMPackageImpl::vendor() const
113       { return _vendor; }
114
115       /** */
116       Label RPMPackageImpl::license() const
117       { return _license; }
118
119       /** */
120       std::string RPMPackageImpl::packager() const
121       { return _packager; }
122
123       /** */
124       PackageGroup RPMPackageImpl::group() const
125       { return _group; }
126
127       /** */
128       Changelog RPMPackageImpl::changelog() const
129       { return _changelog; }
130
131       /** Don't ship it as class Url, because it might be
132        * in fact anything but a legal Url. */
133       std::string RPMPackageImpl::url() const
134       { return _url; }
135
136       /** */
137       std::string RPMPackageImpl::os() const
138       // metadata doesn't priovide this attribute
139       { return PackageImplIf::os(); }
140
141       /** */
142       Text RPMPackageImpl::prein() const
143       // metadata doesn't priovide this attribute
144       { return PackageImplIf::prein(); }
145
146       /** */
147       Text RPMPackageImpl::postin() const
148       // metadata doesn't priovide this attribute
149       { return PackageImplIf::postin(); }
150
151       /** */
152       Text RPMPackageImpl::preun() const
153       // metadata doesn't priovide this attribute
154       { return PackageImplIf::preun(); }
155
156       /** */
157       Text RPMPackageImpl::postun() const
158       // metadata doesn't priovide this attribute
159       { return PackageImplIf::postun(); }
160
161       /** */
162       ByteCount RPMPackageImpl::sourcesize() const
163       { }
164
165       /** */
166       ByteCount RPMPackageImpl::archivesize() const
167       { }
168
169       /** */
170       Text RPMPackageImpl::authors() const
171       { return _authors; }
172
173       /** */
174       Text RPMPackageImpl::filenames() const
175       { return _filenames; }
176
177       License RPMPackageImpl::licenseToConfirm() const
178       { return _license_to_confirm; }
179
180       /** */
181       std::string RPMPackageImpl::type() const
182       { return _type; }
183
184       /** */
185       std::list<std::string> RPMPackageImpl::keywords() const
186       { return _keywords; }
187
188 #if 0
189       /** */
190       std::list<std::string> RPMPackageImpl::insnotify() const
191       { return std::list<std::string>(); }
192       /** */
193       std::list<std::string> RPMPackageImpl::delnotify() const
194       { return std::list<std::string>(); }
195       /** */
196       unsigned RPMPackageImpl::packageSize() const
197       { return _size_package; }
198       /** */
199       unsigned RPMPackageImpl::archiveSize() const
200       { return _size_archive; }
201       /** */
202       unsigned RPMPackageImpl::installedSize() const
203       { return _size_installed; }
204 // FIXME do not understand items below
205       /** */
206       bool RPMPackageImpl::providesSources() const
207       {
208         return false;
209       }
210       /** */
211       std::string RPMPackageImpl::instSrcLabel() const
212       {
213         return "";
214       }
215       /** */
216       std::string RPMPackageImpl::instSrcVendor() const
217       {
218         return "";
219       }
220       /** */
221       unsigned RPMPackageImpl::instSrcRank() const
222       {
223         return 0;
224       }
225       /** */
226       std::string RPMPackageImpl::buildhost() const
227       {
228         return _buildhost;
229       }
230       /** */
231       std::string RPMPackageImpl::distribution() const
232       {
233         return "";
234       }
235       /** */
236       std::string RPMPackageImpl::vendor() const
237       {
238         return _vendor;
239       }
240       /** */
241       std::string RPMPackageImpl::license() const
242       {
243         return _license;
244       }
245       /** */
246       std::list<std::string> RPMPackageImpl::licenseToConfirm() const
247       {
248         return std::list<std::string>();
249       }
250       /** */
251       std::string RPMPackageImpl::packager() const
252       {
253         return _packager;
254       }
255       /** */
256       std::string RPMPackageImpl::group() const
257       {
258         return _group;
259       }
260       /** */
261       std::list<std::string> RPMPackageImpl::changelog() const
262       {}
263       /** */
264       std::string RPMPackageImpl::url() const
265       {
266         return _url;
267       }
268       /** */
269       std::string RPMPackageImpl::os() const
270       {}
271       /** */
272       std::list<std::string> RPMPackageImpl::prein() const
273       {}
274       /** */
275       std::list<std::string> RPMPackageImpl::postin() const
276       {}
277       /** */
278       std::list<std::string> RPMPackageImpl::preun() const
279       {}
280       /** */
281       std::list<std::string> RPMPackageImpl::postun() const
282       {}
283       /** */
284       std::string RPMPackageImpl::sourcepkg() const
285       { return _sourcepkg; }
286       /** */
287       std::list<std::string> RPMPackageImpl::authors() const
288       { return _authors; }
289       /** */
290       std::list<std::string> RPMPackageImpl::filenames() const
291       {}
292       /** */
293       std::list<std::string> RPMPackageImpl::recommends() const
294       {}
295       /** */
296       std::list<std::string> RPMPackageImpl::suggests() const
297       {}
298       /** */
299       std::string RPMPackageImpl::location() const
300       {}
301       /** */
302       std::string RPMPackageImpl::md5sum() const
303       {}
304       /** */
305       std::string RPMPackageImpl::externalUrl() const
306       {}
307       /** */
308       std::list<Edition> RPMPackageImpl::patchRpmBaseVersions() const
309       {}
310       /** */
311       unsigned RPMPackageImpl::patchRpmSize() const
312       {}
313       /** */
314       bool RPMPackageImpl::forceInstall() const
315       {}
316       /** */
317       std::string RPMPackageImpl::patchRpmMD5() const
318       {}
319       /** */
320       bool RPMPackageImpl::isRemote() const
321       {}
322       /** */
323       bool RPMPackageImpl::prefererCandidate() const
324       {}
325       /** */
326       DiskUsage RPMPackageImpl::diskUsage() const
327       { return _disk_usage; }
328
329 #endif
330
331     } // namespace rpm
332     /////////////////////////////////////////////////////////////////
333   } // namespace target
334   ///////////////////////////////////////////////////////////////////
335   /////////////////////////////////////////////////////////////////
336 } // namespace zypp
337 ///////////////////////////////////////////////////////////////////