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 
00041       class SuseTagsProber : public SourceProber
00042       {
00043       public:
00044         SuseTagsProber( media::MediaAccessId media_id, const Pathname &path ) : SourceProber( media_id, path )
00045         {}
00046 
00047         virtual ~SuseTagsProber()
00048         {}
00049 
00050         virtual bool operator()();
00051       };
00052 
00053       struct SuseTagsPackageImplData
00054       {
00055         SuseTagsPackageImplData()
00056         {}
00057 
00058         TranslatedText _summary;
00059         TranslatedText _description;
00060         TranslatedText _insnotify;
00061         TranslatedText _delnotify;
00062         TranslatedText _license_to_confirm;
00063         std::list<std::string> _authors;
00064       };
00065 
00067       //
00068       //        CLASS NAME : SuseTagsImpl
00069       //
00071       class SuseTagsImpl : public SourceImpl
00072       {
00073       public:
00074         typedef source::susetags::SuseTagsProber Prober;
00075         typedef intrusive_ptr<SuseTagsImpl>       Ptr;
00076         typedef intrusive_ptr<const SuseTagsImpl> constPtr;
00077 
00078       public:
00083         SuseTagsImpl();
00085         ~SuseTagsImpl();
00086 
00087       public:
00088         virtual std::string type(void) const
00089         {
00090           return typeString();
00091         }
00092 
00097         static std::string typeString(void)
00098         {
00099           return "YaST";
00100         }
00101         virtual Date timestamp() const;
00102         virtual unsigned numberOfMedia(void) const;
00103         virtual std::string vendor (void) const;
00104         virtual const std::list<Pathname> publicKeys();
00105         virtual std::string unique_id (void) const;
00106 
00107         Pathname sourceDir( const std::string & dir );
00108         virtual void storeMetadata(const Pathname & cache_dir_r);
00109         virtual std::set<zypp::Resolvable::Kind> resolvableKinds() const;
00113         virtual media::MediaVerifierRef verifier(media::MediaNr media_nr);
00114 
00115       protected:
00117         virtual std::ostream & dumpOn( std::ostream & str ) const;
00118         void initCacheDir(const Pathname & cache_dir_r);
00119         bool cacheExists() const;
00120       private:
00125         virtual void factoryInit();
00126         virtual void createResolvables(Source_Ref source_r);
00127 
00129         virtual ResStore createResolvablesByKind(Source_Ref source_r, zypp::Resolvable::Kind kind);
00130 
00131 
00132         const Pathname metadataRoot() const;
00133         const Pathname contentFile() const;
00134         const Pathname contentFileKey() const;
00135         const Pathname contentFileSignature() const;
00136         const Pathname descrDir() const;
00137         const Pathname mediaFile() const;
00138 
00139         void saveMetadataTo(const Pathname & dir_r);
00140 
00146         const Pathname mediaDescrDir() const;
00147 
00153         const Pathname dataDir() const;
00154 
00161         void readContentFile(const Pathname &p);
00162 
00167         void readMediaFile(const Pathname &p);
00168 
00169         TmpDir downloadMetadata();
00170         bool downloadNeeded(const Pathname &localdir);
00171 
00172         void provideProducts(Source_Ref source_r, ResStore& store);
00173         void providePackages(Source_Ref source_r, ResStore& store);
00174         void provideSelections(Source_Ref source_r, ResStore& store);
00175         void provideSelection(Source_Ref source_r, ResStore& store);
00176         void providePatterns(Source_Ref source_r, ResStore& store);
00177 
00178         unsigned _media_count;
00179 
00180         // data dir we are using
00181         // depends if we are on media or
00182         // cache
00183         Pathname _data_dir;
00184 
00185         // descr dir on media.
00186         // we need it if we refresh
00187         // already running from cache
00188         Pathname _media_descr_dir;
00189 
00190         std::string _media_vendor;
00191         std::string _media_id;
00196         detail::ResImplTraits<SuseTagsProductImpl>::Ptr _prodImpl;
00197         Product::Ptr _product;
00198       public:
00199 
00200         // shared data between packages with same NVRA
00201         std::map<NVRA, SuseTagsPackageImplData> _package_data;
00202         // list of packages which depend on another package for its data
00203         std::map<NVRA, DefaultFalseBool> _is_shared;
00204         // list of packages which provide data to another package
00205         std::map<NVRA, DefaultFalseBool> _provides_shared_data;
00206 
00207         // list of translation files
00208         std::list<std::string> _pkg_translations;
00209       };
00211 
00213     } // namespace susetags
00215 
00216     using susetags::SuseTagsImpl;
00217 
00219   } // namespace source
00222 } // namespace zypp
00224 #endif // ZYPP_SOURCE_SUSETAGS_SUSETAGSIMPL_H

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