00001
00002
00003
00004
00005
00006
00007
00008
00012 #ifndef ZYPP_SOURCE_SUSETAGS_SUSETAGSIMPL_H
00013 #define ZYPP_SOURCE_SUSETAGS_SUSETAGSIMPL_H
00014
00015 #include <iosfwd>
00016 #include <string>
00017
00018 #include "zypp/Pathname.h"
00019 #include "zypp/source/SourceImpl.h"
00020 #include "zypp/base/DefaultFalseBool.h"
00021 #include "zypp/Product.h"
00022 #include "zypp/CheckSum.h"
00023 #include "zypp/source/susetags/SuseTagsProductImpl.h"
00024 #include "zypp/source/susetags/SuseTagsPackageImpl.h"
00025 #include "zypp/TmpPath.h"
00026
00027 using namespace zypp::filesystem;
00028
00030 namespace zypp
00031 {
00032
00033 namespace source
00034 {
00035
00036 namespace susetags
00037 {
00038
00039 struct SuseTagsPackageImplData
00040 {
00041 SuseTagsPackageImplData()
00042 {
00043 }
00044
00045 TranslatedText _summary;
00046 TranslatedText _description;
00047 TranslatedText _insnotify;
00048 TranslatedText _delnotify;
00049 TranslatedText _license_to_confirm;
00050 std::list<std::string> _authors;
00051 };
00052
00054
00055
00056
00058 class SuseTagsImpl : public SourceImpl
00059 {
00060 public:
00061 typedef intrusive_ptr<SuseTagsImpl> Ptr;
00062 typedef intrusive_ptr<const SuseTagsImpl> constPtr;
00063
00064 public:
00069 SuseTagsImpl();
00071 ~SuseTagsImpl();
00072
00073 public:
00074 virtual void createResolvables(Source_Ref source_r);
00075
00077 virtual ResStore provideResolvables(Source_Ref source_r, zypp::Resolvable::Kind kind);
00078
00079 virtual std::string type(void) const
00080 { return typeString(); }
00081
00086 static std::string typeString(void)
00087 { return "YaST"; }
00088 virtual Date timestamp() const;
00089 virtual unsigned numberOfMedia(void) const;
00090 virtual std::string vendor (void) const;
00091 virtual const std::list<Pathname> publicKeys();
00092 virtual std::string unique_id (void) const;
00093
00094 Pathname sourceDir( const std::string & dir );
00095 virtual void storeMetadata(const Pathname & cache_dir_r);
00096
00100 virtual media::MediaVerifierRef verifier(media::MediaNr media_nr);
00101
00102 protected:
00104 virtual std::ostream & dumpOn( std::ostream & str ) const;
00105 void initCacheDir(const Pathname & cache_dir_r);
00106 bool cacheExists() const;
00107 private:
00112 virtual void factoryInit();
00113
00114 const Pathname metadataRoot() const;
00115 const Pathname contentFile() const;
00116 const Pathname contentFileKey() const;
00117 const Pathname contentFileSignature() const;
00118 const Pathname descrDir() const;
00119 const Pathname mediaFile() const;
00120
00121 void saveMetadataTo(const Pathname & dir_r);
00122
00128 const Pathname mediaDescrDir() const;
00129
00135 const Pathname dataDir() const;
00136
00143 void readContentFile(const Pathname &p);
00144
00152 void checkMetadataChecksums(const Pathname &dir) const;
00153
00158 void readMediaFile(const Pathname &p);
00159
00160 TmpDir downloadMetadata();
00161 bool downloadNeeded(const Pathname &localdir);
00162
00163 void provideProducts(Source_Ref source_r, ResStore& store);
00164 void providePackages(Source_Ref source_r, ResStore& store);
00165 void provideSelections(Source_Ref source_r, ResStore& store);
00166 void provideSelection(Source_Ref source_r, ResStore& store);
00167 void providePatterns(Source_Ref source_r, ResStore& store);
00168
00172 bool verifyChecksumsMode() const;
00173
00178 void verifyFile( const Pathname &path, const std::string &key) const;
00179
00180 unsigned _media_count;
00181
00182
00183
00184
00185 Pathname _data_dir;
00186
00187
00188
00189
00190 Pathname _media_descr_dir;
00191
00192
00193 TmpDir _tmp_metadata_dir;
00194
00195 std::string _vendor;
00196 std::string _media_id;
00201 detail::ResImplTraits<SuseTagsProductImpl>::Ptr _prodImpl;
00202 Product::Ptr _product;
00203 public:
00204
00205
00206 std::map<NVRA, SuseTagsPackageImplData> _package_data;
00207
00208 std::map<NVRA, DefaultFalseBool> _is_shared;
00209
00210 std::map<NVRA, DefaultFalseBool> _provides_shared_data;
00211
00212
00213 std::list<std::string> _pkg_translations;
00214 };
00216
00218 }
00220
00221 using susetags::SuseTagsImpl;
00222
00224 }
00227 }
00229 #endif // ZYPP_SOURCE_SUSETAGS_SUSETAGSIMPL_H