Date _buildtime;
};
+ inline bool operator==(const BaseVersion & bv1, const BaseVersion & bv2)
+ { return bv1.edition() == bv2.edition(); }
+
} // namespace zypp
///////////////////////////////////////////////////////////////////
#endif // ZYPP_BASEVERSION_H
, _buildtime(buildtime)
, _base_version(base_version)
{}
- Arch arch() { return _arch; }
- Pathname filename() { return _filename; }
- ByteCount downloadsize() { return _downloadsize; }
- CheckSum checksum() { return _checksum; }
- Date buildtime() { return _buildtime; }
- BaseVersion baseVersion() { return _base_version; }
+ Arch arch() const { return _arch; }
+ Pathname filename() const { return _filename; }
+ ByteCount downloadsize() const { return _downloadsize; }
+ CheckSum checksum() const { return _checksum; }
+ Date buildtime() const { return _buildtime; }
+ BaseVersion baseVersion() const { return _base_version; }
private:
Arch _arch;
Pathname _filename;
*
*/
#include "zypp/Package.h"
+#include "zypp/base/Exception.h"
using namespace std;
std::list<DeltaRpm> Package::deltaRpms() const
{ return pimpl().deltaRpms(); }
+ /** */
+ Pathname Package::getPlainRpm() const
+ { return source().provideFile(plainRpm()); }
+
+ /** */
+ Pathname Package::getDeltaRpm(BaseVersion & base_r) const
+ {
+#warning (2x): TODO: BaseVersion compare checks only Edition
+ std::list<DeltaRpm> deltas = deltaRpms();
+ for (std::list<DeltaRpm>::const_iterator it = deltas.begin();
+ it != deltas.end(); it++)
+ {
+ if (base_r == it->baseVersion())
+ return source().provideFile(it->filename());
+ }
+ ZYPP_THROW(Exception("No matching delta RPM found"));
+ return source().provideFile(plainRpm()); // never reached
+ }
+
+ /** */
+ Pathname Package::getPatchRpm(BaseVersion & base_r) const
+ {
+ std::list<PatchRpm> patches = patchRpms();
+ for (std::list<PatchRpm>::const_iterator it = patches.begin();
+ it != patches.end(); it++)
+ {
+ std::list<BaseVersion> bases = it->baseVersions();
+ for (std::list<BaseVersion>::const_iterator bvit = bases.begin();
+ bvit != bases.end(); bvit++)
+ {
+ if (base_r == *bvit)
+ return source().provideFile(it->filename());
+ }
+ }
+ ZYPP_THROW(Exception("No matching patch RPM found"));
+ return source().provideFile(plainRpm()); // never reached
+ }
+
/////////////////////////////////////////////////////////////////
} // namespace zypp
///////////////////////////////////////////////////////////////////
std::list<PatchRpm> patchRpms() const;
/** */
std::list<DeltaRpm> deltaRpms() const;
+ /**
+ * \throws Exception
+ */
+ Pathname getPlainRpm() const;
+ /**
+ * \throws Exception
+ */
+ Pathname getDeltaRpm(BaseVersion & base_r) const;
+ /**
+ * \throws Exception
+ */
+ Pathname getPatchRpm(BaseVersion & base_r) const;
// data here:
, _buildtime(buildtime)
, _base_versions(base_versions)
{}
- Arch arch() { return _arch; }
- Pathname filename() { return _filename; }
- ByteCount downloadsize() { return _downloadsize; }
- CheckSum checksum() { return _checksum; }
- Date buildtime() { return _buildtime; }
- std::list<BaseVersion> baseVersions() { return _base_versions; }
+ Arch arch() const { return _arch; }
+ Pathname filename() const { return _filename; }
+ ByteCount downloadsize() const { return _downloadsize; }
+ CheckSum checksum() const { return _checksum; }
+ Date buildtime() const { return _buildtime; }
+ std::list<BaseVersion> baseVersions() const { return _base_versions; }
private:
Arch _arch;
Pathname _filename;