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 
00026 using namespace zypp::filesystem;
00027 
00029 namespace zypp
00030 { 
00031 
00032   namespace source
00033   { 
00034 
00035     namespace susetags
00036     { 
00037 
00038       struct SuseTagsPackageImplData
00039       {
00040         SuseTagsPackageImplData()
00041         {
00042         }
00043 
00044         TranslatedText _summary;
00045         TranslatedText _description;
00046         TranslatedText _insnotify;
00047         TranslatedText _delnotify;
00048         TranslatedText _license_to_confirm;
00049         std::list<std::string> _authors;
00050       };
00051 
00053       //
00054       //        CLASS NAME : SuseTagsImpl
00055       //
00057       class SuseTagsImpl : public SourceImpl
00058       {
00059       public:
00060         typedef intrusive_ptr<SuseTagsImpl>       Ptr;
00061         typedef intrusive_ptr<const SuseTagsImpl> constPtr;
00062 
00063       public:
00068         SuseTagsImpl();
00070         ~SuseTagsImpl();
00071 
00072       public:
00073         virtual void createResolvables(Source_Ref source_r);
00074 
00076         virtual ResStore provideResolvables(Source_Ref source_r, zypp::Resolvable::Kind kind);
00077 
00078         virtual std::string type(void) const
00079         { return typeString(); }
00080 
00085         static std::string typeString(void)
00086         { return "YaST"; }
00087         virtual Date timestamp() const;
00088         virtual unsigned numberOfMedia(void) const;
00089         virtual std::string vendor (void) const;
00090         virtual const std::list<Pathname> publicKeys();
00091         virtual std::string unique_id (void) const;
00092 
00093         Pathname sourceDir( const std::string & dir );
00094         virtual void storeMetadata(const Pathname & cache_dir_r);
00095 
00099         virtual media::MediaVerifierRef verifier(media::MediaNr media_nr);
00100 
00101       protected:
00103         virtual std::ostream & dumpOn( std::ostream & str ) const;
00104         void initCacheDir(const Pathname & cache_dir_r);
00105         bool cacheExists() const;
00106       private:
00111         virtual void factoryInit();
00112         
00113         const Pathname metadataRoot() const;
00114         const Pathname contentFile() const;
00115         const Pathname contentFileKey() const;
00116         const Pathname contentFileSignature() const;
00117         const Pathname descrDir() const;
00118         const Pathname mediaFile() const;
00119         
00120         void saveMetadataTo(const Pathname & dir_r);
00121         
00127         const Pathname mediaDescrDir() const;
00128         
00134         const Pathname dataDir() const;
00135         
00142         void readContentFile(const Pathname &p);
00143          
00151         void checkMetadataChecksums(const Pathname &dir) const;
00152         
00157         void readMediaFile(const Pathname &p);
00158         
00159         TmpDir downloadMetadata();
00160         bool downloadNeeded(const Pathname &localdir);
00161         
00162         void provideProducts(Source_Ref source_r, ResStore& store);
00163         void providePackages(Source_Ref source_r, ResStore& store);
00164         void provideSelections(Source_Ref source_r, ResStore& store);
00165         void provideSelection(Source_Ref source_r, ResStore& store);
00166         void providePatterns(Source_Ref source_r, ResStore& store);
00167 
00171         bool verifyChecksumsMode() const;
00172 
00177         void verifyFile( const Pathname &path, const std::string &key) const;
00178 
00179         unsigned _media_count;
00180 
00181         // data dir we are using
00182         // depends if we are on media or
00183         // cache
00184         Pathname _data_dir;
00185 
00186         // descr dir on media.
00187         // we need it if we refresh
00188         // already running from cache
00189         Pathname _media_descr_dir;
00190 
00191         std::string _vendor;
00192         std::string _media_id;
00197         detail::ResImplTraits<SuseTagsProductImpl>::Ptr _prodImpl;
00198         Product::Ptr _product;
00199         public:
00200 
00201         // shared data between packages with same NVRA
00202         std::map<NVRA, SuseTagsPackageImplData> _package_data;
00203         // list of packages which depend on another package for its data
00204         std::map<NVRA, DefaultFalseBool> _is_shared;
00205         // list of packages which provide data to another package
00206         std::map<NVRA, DefaultFalseBool> _provides_shared_data;
00207 
00208         // list of translation files
00209         std::list<std::string> _pkg_translations;
00210       };
00212 
00214     } // namespace susetags
00216 
00217     using susetags::SuseTagsImpl;
00218 
00220   } // namespace source
00223 } // namespace zypp
00225 #endif // ZYPP_SOURCE_SUSETAGS_SUSETAGSIMPL_H

Generated on Thu Jul 6 00:07:24 2006 for zypp by  doxygen 1.4.6