1 /*---------------------------------------------------------------------\
3 | |__ / \ / / . \ . \ |
8 \---------------------------------------------------------------------*/
9 /** \file zypp/Package.cc
12 #include "zypp/Package.h"
13 #include "zypp/source/SourceImpl.h"
14 #include "zypp/base/Exception.h"
18 ///////////////////////////////////////////////////////////////////
20 { /////////////////////////////////////////////////////////////////
22 ///////////////////////////////////////////////////////////////////
24 // METHOD NAME : Package::Package
27 Package::Package( const NVRAD & nvrad_r )
28 : ResObject( TraitsType::kind, nvrad_r )
31 ///////////////////////////////////////////////////////////////////
33 // METHOD NAME : Package::~Package
39 ///////////////////////////////////////////////////////////////////
41 // Package interface forwarded to implementation
43 ///////////////////////////////////////////////////////////////////
45 Changelog Package::changelog() const
46 { return pimpl().changelog(); }
48 /** Time of package installation */
49 Date Package::installtime() const
50 { return pimpl().installtime(); }
53 Date Package::buildtime() const
54 { return pimpl().buildtime(); }
57 std::string Package::buildhost() const
58 { return pimpl().buildhost(); }
61 std::string Package::distribution() const
62 { return pimpl().distribution(); }
65 Vendor Package::vendor() const
66 { return pimpl().vendor(); }
69 Label Package::license() const
70 { return pimpl().license(); }
73 std::string Package::packager() const
74 { return pimpl().packager(); }
77 PackageGroup Package::group() const
78 { return pimpl().group(); }
81 /** Don't ship it as class Url, because it might be
82 * in fact anything but a legal Url. */
83 std::string Package::url() const
84 { return pimpl().url(); }
87 std::string Package::os() const
88 { return pimpl().os(); }
91 Text Package::prein() const
92 { return pimpl().prein(); }
95 Text Package::postin() const
96 { return pimpl().postin(); }
99 Text Package::preun() const
100 { return pimpl().preun(); }
103 Text Package::postun() const
104 { return pimpl().postun(); }
107 ByteCount Package::sourcesize() const
108 { return pimpl().sourcesize(); }
111 ByteCount Package::archivesize() const
112 { return pimpl().archivesize(); }
115 std::list<std::string> Package::authors() const
116 { return pimpl().authors(); }
119 std::list<std::string> Package::filenames() const
120 { return pimpl().filenames(); }
123 License Package::licenseToConfirm() const
124 { return pimpl().licenseToConfirm(); }
127 Pathname Package::plainRpm() const
128 { return pimpl().location(); }
131 std::list<PatchRpm> Package::patchRpms() const
132 { return pimpl().patchRpms(); }
135 std::list<DeltaRpm> Package::deltaRpms() const
136 { return pimpl().deltaRpms(); }
139 Pathname Package::getPlainRpm() const
140 { return source().provideFile(plainRpm()); }
143 Pathname Package::getDeltaRpm(BaseVersion & base_r) const
145 #warning (2x): TODO: BaseVersion compare checks only Edition
146 std::list<DeltaRpm> deltas = deltaRpms();
147 for (std::list<DeltaRpm>::const_iterator it = deltas.begin();
148 it != deltas.end(); it++)
150 if (base_r == it->baseVersion())
151 return source().provideFile(it->filename());
153 ZYPP_THROW(Exception("No matching delta RPM found"));
154 return source().provideFile(plainRpm()); // never reached
158 Pathname Package::getPatchRpm(BaseVersion & base_r) const
160 std::list<PatchRpm> patches = patchRpms();
161 for (std::list<PatchRpm>::const_iterator it = patches.begin();
162 it != patches.end(); it++)
164 std::list<BaseVersion> bases = it->baseVersions();
165 for (std::list<BaseVersion>::const_iterator bvit = bases.begin();
166 bvit != bases.end(); bvit++)
169 return source().provideFile(it->filename());
172 ZYPP_THROW(Exception("No matching patch RPM found"));
173 return source().provideFile(plainRpm()); // never reached
176 bool Package::installOnly() const
177 { return pimpl().installOnly(); }
179 unsigned Package::mediaId() const
180 { return pimpl().mediaId(); }
182 /////////////////////////////////////////////////////////////////
184 ///////////////////////////////////////////////////////////////////