00001
00002
00003
00004
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 #include "zypp/TmpPath.h"
00028
00029 using namespace zypp::parser::yum;
00030 using namespace zypp::filesystem;
00031
00033 namespace zypp
00034 {
00035
00036 namespace source
00037 {
00038 namespace yum
00039 {
00040
00045
00046
00047
00048
00051 class YUMSourceImpl : public SourceImpl
00052 {
00053 public:
00054
00059 YUMSourceImpl();
00060
00061 public:
00062
00063 virtual Date timestamp() const;
00064 virtual void storeMetadata(const Pathname & cache_dir_r);
00065
00066 virtual std::string type(void) const
00067 { return typeString(); }
00068
00073 static std::string typeString(void)
00074 { return "YUM"; }
00075
00076 virtual void createResolvables(Source_Ref source_r);
00077
00082 bool downloadNeeded(const Pathname & localdir);
00083
00084 Package::Ptr createPackage(
00085 Source_Ref source_r,
00086 const zypp::parser::yum::YUMPrimaryData & parsed,
00087 const zypp::parser::yum::YUMFileListData & filelist,
00088 const zypp::parser::yum::YUMOtherData & other,
00089 zypp::detail::ResImplTraits<zypp::source::yum::YUMPackageImpl>::Ptr & impl
00090 );
00091 Atom::Ptr augmentPackage(
00092 Source_Ref source_r,
00093 const zypp::parser::yum::YUMPatchPackage & parsed
00094 );
00095 Selection::Ptr createGroup(
00096 Source_Ref source_r,
00097 const zypp::parser::yum::YUMGroupData & parsed
00098 );
00099 Pattern::Ptr createPattern(
00100 Source_Ref source_r,
00101 const zypp::parser::yum::YUMPatternData & parsed
00102 );
00103 Message::Ptr createMessage(
00104 Source_Ref source_r,
00105 const zypp::parser::yum::YUMPatchMessage & parsed,
00106 Patch::constPtr patch
00107 );
00108 Script::Ptr createScript(
00109 Source_Ref source_r,
00110 const zypp::parser::yum::YUMPatchScript & parsed
00111 );
00112 Patch::Ptr createPatch(
00113 Source_Ref source_r,
00114 const zypp::parser::yum::YUMPatchData & parsed
00115 );
00116 Product::Ptr createProduct(
00117 Source_Ref source_r,
00118 const zypp::parser::yum::YUMProductData & parsed
00119 );
00120
00121
00122 Dependencies createDependencies(
00123 const zypp::parser::yum::YUMObjectData & parsed,
00124 const Resolvable::Kind my_kind
00125 );
00126
00127 Dependencies createGroupDependencies(
00128 const zypp::parser::yum::YUMGroupData & parsed
00129 );
00130
00131 Capability createCapability(const YUMDependency & dep,
00132 const Resolvable::Kind & my_kind);
00133 private:
00138 virtual void factoryInit();
00139
00143 void checkMetadataChecksums() const;
00144 private:
00145
00146 const Pathname metadataRoot() const;
00147 bool cacheExists();
00148 const TmpDir downloadMetadata();
00149 void saveMetadataTo(const Pathname & dir_r);
00150 const Pathname repomdFile() const;
00151 const Pathname repomdFileSignature() const;
00152 const Pathname repomdFileKey() const;
00153
00154 TmpDir _tmp_metadata_dir;
00155
00156 typedef struct {
00157 zypp::detail::ResImplTraits<zypp::source::yum::YUMPackageImpl>::Ptr impl;
00158 zypp::Package::Ptr package;
00159 } ImplAndPackage;
00160
00161 typedef std::map<zypp::NVRA, ImplAndPackage> PackageImplMapT;
00162 PackageImplMapT _package_impl;
00163
00164 public:
00165 static bool checkCheckSum (const Pathname & filename, std::string csum_type, const std::string & csum);
00166
00167 };
00168
00170 }
00172 }
00175 }
00177 #endif // ZYPP_SOURCE_YUM_YUMSOURCEIMPL_H