From f20fb4c790d774e09fae26026188b2d225283034 Mon Sep 17 00:00:00 2001 From: Jiri Srain Date: Tue, 24 Jan 2006 12:00:11 +0000 Subject: [PATCH] Package class provides path to its RPM/patchRPM/deltaRPM --- zypp/Package.cc | 11 +++++++++++ zypp/Package.h | 8 ++++++++ zypp/Source.cc | 5 +++++ zypp/Source.h | 6 ++++++ zypp/detail/PackageImplIf.cc | 10 ++++++++++ zypp/detail/PackageImplIf.h | 9 +++++++++ zypp/source/SourceImpl.cc | 2 +- zypp/source/SourceImpl.h | 2 +- zypp/source/yum/YUMPackageImpl.cc | 4 ++++ zypp/source/yum/YUMPackageImpl.h | 6 +++--- 10 files changed, 58 insertions(+), 5 deletions(-) diff --git a/zypp/Package.cc b/zypp/Package.cc index c62fd51..cf2642d 100644 --- a/zypp/Package.cc +++ b/zypp/Package.cc @@ -121,6 +121,17 @@ namespace zypp License Package::licenseToConfirm() const { return pimpl().licenseToConfirm(); } + /** */ + Pathname Package::plainRpm() const + { return pimpl().location(); } + + /** */ + std::list Package::patchRpms() const + { return pimpl().patchRpms(); } + + /** */ + std::list Package::deltaRpms() const + { return pimpl().deltaRpms(); } ///////////////////////////////////////////////////////////////// } // namespace zypp diff --git a/zypp/Package.h b/zypp/Package.h index c007c0e..34eb641 100644 --- a/zypp/Package.h +++ b/zypp/Package.h @@ -76,7 +76,15 @@ namespace zypp Text filenames() const; /** */ License licenseToConfirm() const; + /** */ + Pathname plainRpm() const; + /** */ + std::list patchRpms() const; + /** */ + std::list deltaRpms() const; + // data here: + protected: Package( const NVRAD & nvrad_r ); diff --git a/zypp/Source.cc b/zypp/Source.cc index 943b408..4239548 100644 --- a/zypp/Source.cc +++ b/zypp/Source.cc @@ -53,6 +53,11 @@ namespace zypp std::ostream & Source::dumpOn( std::ostream & str ) const { return _pimpl->dumpOn( str ); } + const Pathname Source::provideFile(const Pathname & file, const unsigned media_nr) + { return _pimpl->provideFile(file, media_nr); } + + + ///////////////////////////////////////////////////////////////// } // namespace zypp /////////////////////////////////////////////////////////////////// diff --git a/zypp/Source.h b/zypp/Source.h index 76ee5cc..7e93e38 100644 --- a/zypp/Source.h +++ b/zypp/Source.h @@ -17,6 +17,7 @@ #include "zypp/base/PtrTypes.h" #include "zypp/ResStore.h" +#include "zypp/Pathname.h" /////////////////////////////////////////////////////////////////// namespace zypp @@ -62,6 +63,10 @@ namespace zypp private: /** Pointer to implementation */ RW_pointer > _pimpl; + + public: + /** Provide a file to local filesystem */ + const Pathname provideFile(const Pathname & file, const unsigned media_nr = 1); }; /////////////////////////////////////////////////////////////////// @@ -69,6 +74,7 @@ namespace zypp inline std::ostream & operator<<( std::ostream & str, const Source & obj ) { return obj.dumpOn( str ); } + ///////////////////////////////////////////////////////////////// } // namespace zypp /////////////////////////////////////////////////////////////////// diff --git a/zypp/detail/PackageImplIf.cc b/zypp/detail/PackageImplIf.cc index 0f386ac..61664d6 100644 --- a/zypp/detail/PackageImplIf.cc +++ b/zypp/detail/PackageImplIf.cc @@ -53,6 +53,9 @@ namespace zypp Changelog PackageImplIf::changelog() const { return Changelog(); } + Pathname PackageImplIf::location() const + { return Pathname(); } + std::string PackageImplIf::url() const { return std::string(); } @@ -86,6 +89,13 @@ namespace zypp License PackageImplIf::licenseToConfirm() const { return License(); } + std::list PackageImplIf::deltaRpms() const + { return std::list(); } + + std::list PackageImplIf::patchRpms() const + { return std::list(); } + + ///////////////////////////////////////////////////////////////// } // namespace detail /////////////////////////////////////////////////////////////////// diff --git a/zypp/detail/PackageImplIf.h b/zypp/detail/PackageImplIf.h index 1fbe101..f9e481c 100644 --- a/zypp/detail/PackageImplIf.h +++ b/zypp/detail/PackageImplIf.h @@ -18,6 +18,8 @@ #include "zypp/Edition.h" #include "zypp/Arch.h" #include "zypp/Changelog.h" +#include "zypp/PatchRpm.h" +#include "zypp/DeltaRpm.h" /////////////////////////////////////////////////////////////////// namespace zypp @@ -79,6 +81,8 @@ namespace zypp virtual PackageGroup group() const PURE_VIRTUAL; /** */ virtual Changelog changelog() const PURE_VIRTUAL; + /** */ + virtual Pathname location() const PURE_VIRTUAL; /** Don't ship it as class Url, because it might be * in fact anything but a legal Url. */ virtual std::string url() const PURE_VIRTUAL; @@ -100,6 +104,11 @@ namespace zypp virtual Text authors() const PURE_VIRTUAL; /** */ virtual Text filenames() const PURE_VIRTUAL; + /** */ + virtual std::list deltaRpms() const PURE_VIRTUAL; + /** */ + virtual std::list patchRpms() const PURE_VIRTUAL; + //@} /** \name Additional Package Attributes. diff --git a/zypp/source/SourceImpl.cc b/zypp/source/SourceImpl.cc index 220906a..3b9457d 100644 --- a/zypp/source/SourceImpl.cc +++ b/zypp/source/SourceImpl.cc @@ -44,7 +44,7 @@ namespace zypp SourceImpl::~SourceImpl() {} - const Pathname SourceImpl::provideFile(const Pathname & file_r) + const Pathname SourceImpl::provideFile(const Pathname & file_r, const unsigned media_nr) { _media->provideFile (file_r); return _media->localPath (file_r); diff --git a/zypp/source/SourceImpl.h b/zypp/source/SourceImpl.h index f4e43fd..0a7479a 100644 --- a/zypp/source/SourceImpl.h +++ b/zypp/source/SourceImpl.h @@ -61,7 +61,7 @@ namespace zypp { return _store; } /** Provide a file to local filesystem */ - const Pathname provideFile(const Pathname & file); + const Pathname provideFile(const Pathname & file, const unsigned media_nr = 1); /** Overload to realize stream output. */ virtual std::ostream & dumpOn( std::ostream & str ) const diff --git a/zypp/source/yum/YUMPackageImpl.cc b/zypp/source/yum/YUMPackageImpl.cc index b0229bc..dd6c2fc 100644 --- a/zypp/source/yum/YUMPackageImpl.cc +++ b/zypp/source/yum/YUMPackageImpl.cc @@ -255,6 +255,10 @@ namespace zypp Changelog YUMPackageImpl::changelog() const { return _changelog; } + /** */ + Pathname YUMPackageImpl::location() const + { return _location; } + /** Don't ship it as class Url, because it might be * in fact anything but a legal Url. */ std::string YUMPackageImpl::url() const diff --git a/zypp/source/yum/YUMPackageImpl.h b/zypp/source/yum/YUMPackageImpl.h index 02a4c6d..b5d1eec 100644 --- a/zypp/source/yum/YUMPackageImpl.h +++ b/zypp/source/yum/YUMPackageImpl.h @@ -76,6 +76,8 @@ namespace zypp virtual PackageGroup group() const; /** */ virtual Changelog changelog() const; + /** */ + virtual Pathname location() const; /** Don't ship it as class Url, because it might be * in fact anything but a legal Url. */ virtual std::string url() const; @@ -172,8 +174,6 @@ namespace zypp /** */ virtual std::list suggests() const; /** */ - virtual std::string location() const; - /** */ virtual unsigned int medianr() const; /** */ virtual std::string md5sum() const; @@ -210,7 +210,7 @@ namespace zypp unsigned _mediaid; CheckSum _checksum; Text _filenames; - std::string _location; + Pathname _location; std::list _delta_rpms; std::list _patch_rpms; -- 2.7.4