SuseTagsImpl.h

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------\
00002 |                          ____ _   __ __ ___                          |
00003 |                         |__  / \ / / . \ . \                         |
00004 |                           / / \ V /|  _/  _/                         |
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       //        CLASS NAME : SuseTagsImpl
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         // data dir we are using
00183         // depends if we are on media or
00184         // cache
00185         Pathname _data_dir;
00186 
00187         // descr dir on media.
00188         // we need it if we refresh
00189         // already running from cache
00190         Pathname _media_descr_dir;
00191 
00192         // in case we dont have cache
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         // shared data between packages with same NVRA
00206         std::map<NVRA, SuseTagsPackageImplData> _package_data;
00207         // list of packages which depend on another package for its data
00208         std::map<NVRA, DefaultFalseBool> _is_shared;
00209         // list of packages which provide data to another package
00210         std::map<NVRA, DefaultFalseBool> _provides_shared_data;
00211 
00212         // list of translation files
00213         std::list<std::string> _pkg_translations;
00214       };
00216 
00218     } // namespace susetags
00220 
00221     using susetags::SuseTagsImpl;
00222 
00224   } // namespace source
00227 } // namespace zypp
00229 #endif // ZYPP_SOURCE_SUSETAGS_SUSETAGSIMPL_H

Generated on Mon Jun 5 19:10:38 2006 for zypp by  doxygen 1.4.6