YUMSourceImpl.h

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------\
00002 |                          ____ _   __ __ ___                          |
00003 |                         |__  / \ / / . \ . \                         |
00004 |                           / / \ V /|  _/  _/                         |
00005 |                          / /__ | | | | | |                           |
00006 |                         /_____||_| |_| |_|                           |
00007 |                                                                      |
00008 \---------------------------------------------------------------------*/
00012 #ifndef ZYPP_SOURCE_YUM_YUMSOURCEIMPL_H
00013 #define ZYPP_SOURCE_YUM_YUMSOURCEIMPL_H
00014 
00015 #include "zypp/source/SourceImpl.h"
00016 #include "zypp/detail/ResImplTraits.h"
00017 #include "zypp/source/yum/YUMPackageImpl.h"
00018 #include "zypp/parser/yum/YUMParserData.h"
00019 #include "zypp/Package.h"
00020 #include "zypp/Atom.h"
00021 #include "zypp/Message.h"
00022 #include "zypp/Script.h"
00023 #include "zypp/Patch.h"
00024 #include "zypp/Product.h"
00025 #include "zypp/Selection.h"
00026 #include "zypp/Pattern.h"
00027 
00028 using namespace zypp::parser::yum;
00029 using namespace zypp::filesystem;
00030 
00032 namespace zypp
00033 { 
00034 
00035 namespace source
00036 { 
00037 namespace yum
00038 { 
00039 
00043 class YUMProber : public SourceProber
00044 {
00045 public:
00046   YUMProber( media::MediaAccessId media_id, const Pathname &path ) : SourceProber( media_id, path )
00047   {}
00048 
00049   virtual ~YUMProber()
00050   {}
00051 
00052   virtual bool operator()();
00053 
00054 };
00055 
00060 
00061 //
00062 //        CLASS NAME : YUMSourceImpl
00063 //
00066 class YUMSourceImpl : public SourceImpl
00067 {
00068 public:
00069 
00070   typedef source::yum::YUMProber     Prober;
00071 
00076   YUMSourceImpl();
00077 
00078 public:
00079 
00080   virtual Date timestamp() const;
00081   virtual void storeMetadata(const Pathname & cache_dir_r);
00082 
00083   virtual std::set<zypp::Resolvable::Kind> resolvableKinds() const;
00084   
00085   virtual std::string type(void) const
00086   {
00087     return typeString();
00088   }
00089 
00094   static std::string typeString(void)
00095   {
00096     return "YUM";
00097   }
00098 
00103   bool downloadNeeded(const Pathname & localdir);
00104 
00105   Package::Ptr createPackage(
00106     Source_Ref source_r,
00107     const zypp::parser::yum::YUMPrimaryData & parsed,
00108     const zypp::parser::yum::YUMFileListData & filelist,
00109     const zypp::parser::yum::YUMOtherData & other,
00110     zypp::detail::ResImplTraits<zypp::source::yum::YUMPackageImpl>::Ptr & impl
00111   );
00112   Atom::Ptr augmentPackage(
00113     Source_Ref source_r,
00114     const zypp::parser::yum::YUMPatchPackage & parsed
00115   );
00116   Selection::Ptr createGroup(
00117     Source_Ref source_r,
00118     const zypp::parser::yum::YUMGroupData & parsed
00119   );
00120   Pattern::Ptr createPattern(
00121     Source_Ref source_r,
00122     const zypp::parser::yum::YUMPatternData & parsed
00123   );
00124   Message::Ptr createMessage(
00125     Source_Ref source_r,
00126     const zypp::parser::yum::YUMPatchMessage & parsed,
00127     Patch::constPtr patch
00128   );
00129   Script::Ptr createScript(
00130     Source_Ref source_r,
00131     const zypp::parser::yum::YUMPatchScript & parsed
00132   );
00133   Patch::Ptr createPatch(
00134     Source_Ref source_r,
00135     const zypp::parser::yum::YUMPatchData & parsed
00136   );
00137   Product::Ptr createProduct(
00138     Source_Ref source_r,
00139     const zypp::parser::yum::YUMProductData & parsed
00140   );
00141 
00142 
00143   Dependencies createDependencies(
00144     const zypp::parser::yum::YUMObjectData & parsed,
00145     const Resolvable::Kind my_kind
00146   );
00147 
00148   Dependencies createGroupDependencies(
00149     const zypp::parser::yum::YUMGroupData & parsed
00150   );
00151 
00152   Capability createCapability(const YUMDependency & dep,
00153                               const Resolvable::Kind & my_kind);
00154 private:
00159   virtual void factoryInit();
00160 
00162   // * \throw EXCEPTION on fail
00163   // */
00164   //void checkMetadataChecksums() const;
00165 
00166   void readRepomd();
00167 
00168   virtual void createResolvables(Source_Ref source_r);
00169   virtual ResStore provideResolvablesByKind(Source_Ref source_r, zypp::Resolvable::Kind kind);
00170 
00171   void provideProducts(Source_Ref source_r, ResStore& store);
00172   void providePackages(Source_Ref source_r, ResStore& store);
00173   void provideSelections(Source_Ref source_r, ResStore& store);
00174   void providePatterns(Source_Ref source_r, ResStore& store);
00175   void providePatches(Source_Ref source_r, ResStore& store);
00176 
00177   std::list<YUMRepomdData_Ptr> _repo_primary;
00178   std::list<YUMRepomdData_Ptr> _repo_files;
00179   std::list<YUMRepomdData_Ptr> _repo_group;
00180   std::list<YUMRepomdData_Ptr> _repo_pattern;
00181   std::list<YUMRepomdData_Ptr> _repo_product;
00182   std::list<YUMRepomdData_Ptr> _repo_patches;
00183 
00184 
00185 private:
00186 
00187   const Pathname metadataRoot() const;
00188   bool cacheExists();
00189 
00190   const TmpDir downloadMetadata();
00191   void saveMetadataTo(const Pathname & dir_r);
00192   const Pathname repomdFile() const;
00193   const Pathname repomdFileSignature() const;
00194   const Pathname repomdFileKey() const;
00195 
00196   typedef struct
00197   {
00198     zypp::detail::ResImplTraits<zypp::source::yum::YUMPackageImpl>::Ptr impl;
00199     zypp::Package::Ptr package;
00200   }
00201   ImplAndPackage;
00202 
00203   typedef std::map<zypp::NVRA, ImplAndPackage> PackageImplMapT;
00204   PackageImplMapT _package_impl;
00205 
00206 };
00207 
00209 } // namespace yum
00211 } // namespace source
00214 } // namespace zypp
00216 #endif // ZYPP_SOURCE_YUM_YUMSOURCEIMPL_H

Generated on Tue Nov 28 16:49:33 2006 for zypp by  doxygen 1.5.0