libzypp  10.5.0
RpmHeader.h
Go to the documentation of this file.
00001 /*---------------------------------------------------------------------\
00002 |                          ____ _   __ __ ___                          |
00003 |                         |__  / \ / / . \ . \                         |
00004 |                           / / \ V /|  _/  _/                         |
00005 |                          / /__ | | | | | |                           |
00006 |                         /_____||_| |_| |_|                           |
00007 |                                                                      |
00008 \---------------------------------------------------------------------*/
00012 #ifndef ZYPP_TARGET_RPM_RPMHEADER_H
00013 #define ZYPP_TARGET_RPM_RPMHEADER_H
00014 
00015 #include <iosfwd>
00016 #include <list>
00017 
00018 #include "zypp/target/rpm/BinHeader.h"
00019 
00020 #include "zypp/Package.h"
00021 #include "zypp/Changelog.h"
00022 #include "zypp/Pathname.h"
00023 #include "zypp/DiskUsage.h"
00024 
00025 
00026 namespace zypp
00027 {
00028 namespace target
00029 {
00030 namespace rpm
00031 {
00032 
00033 struct FileInfo
00034 {
00035   Pathname    filename;
00036   ByteCount   size;
00037   std::string md5sum;
00038   uid_t       uid;
00039   gid_t       gid;
00040   mode_t      mode;
00041   time_t      mtime;
00042   bool        ghost;
00043   Pathname link_target;
00044 };
00045 
00047 //
00048 //      CLASS NAME : RpmHeader
00061 class RpmHeader : public BinHeader
00062 {
00063 public:
00064   typedef intrusive_ptr<RpmHeader> Ptr;
00065   typedef intrusive_ptr<const RpmHeader> constPtr;
00066 
00067 private:
00068 
00069   CapabilitySet PkgRelList_val( tag tag_r, bool pre, std::set<std::string> * freq_r = 0 ) const;
00070 
00071 public:
00072 
00076   RpmHeader( Header h_r = 0 );
00077 
00082   RpmHeader( BinHeader::Ptr & rhs );
00083 
00084   virtual ~RpmHeader();
00085 
00086   bool isSrc() const;
00087 
00088 public:
00089 
00090   std::string      tag_name()    const;
00091   Edition::epoch_t tag_epoch()   const;
00092   std::string      tag_version() const;
00093   std::string      tag_release() const;
00094   Edition          tag_edition() const;
00095   Arch             tag_arch()    const;
00096 
00097   Date tag_installtime() const;
00098   Date tag_buildtime()   const;
00099 
00103   CapabilitySet tag_provides ( std::set<std::string> * freq_r = 0 ) const;
00107   CapabilitySet tag_requires ( std::set<std::string> * freq_r = 0 ) const;
00111   CapabilitySet tag_prerequires ( std::set<std::string> * freq_r = 0 ) const;
00115   CapabilitySet tag_conflicts( std::set<std::string> * freq_r = 0 ) const;
00119   CapabilitySet tag_obsoletes( std::set<std::string> * freq_r = 0 ) const;
00123   CapabilitySet tag_enhances( std::set<std::string> * freq_r = 0 ) const;
00127   CapabilitySet tag_suggests( std::set<std::string> * freq_r = 0 ) const;
00131   CapabilitySet tag_supplements( std::set<std::string> * freq_r = 0 ) const
00132   { return CapabilitySet(); }
00133 
00134   ByteCount tag_size()        const;
00135   ByteCount tag_archivesize() const;
00136 
00137   std::string tag_summary()      const;
00138   std::string tag_description()  const;
00139   std::string tag_group()        const;
00140   std::string tag_vendor()       const;
00141   std::string tag_distribution() const;
00142   std::string tag_license()      const;
00143   std::string tag_buildhost()    const;
00144   std::string tag_packager()     const;
00145   std::string tag_url()          const;
00146   std::string tag_os()           const;
00147   std::string tag_prein()        const;
00148   std::string tag_postin()       const;
00149   std::string tag_preun()        const;
00150   std::string tag_postun()       const;
00151   std::string tag_sourcerpm()    const;
00152 
00154   std::list<std::string> tag_filenames() const;
00155 
00160   std::list<FileInfo> tag_fileinfos() const;
00161 
00162   Changelog tag_changelog() const;
00163 
00167   DiskUsage & tag_du( DiskUsage & dudata_r ) const;
00168 
00169 public:
00170 
00171   virtual std::ostream & dumpOn( std::ostream & str ) const;
00172 
00173 public:
00174 
00178   enum VERIFICATION
00179   {
00180     VERIFY       = 0x0000,
00181     NODIGEST     = (1<<0),
00182     NOSIGNATURE  = (1<<1),
00183     NOVERIFY     = 0xffff
00184   };
00185 
00190   static RpmHeader::constPtr readPackage( const Pathname & path,
00191                                           VERIFICATION verification = VERIFY );
00192 };
00193 
00195 } // namespace rpm
00196 } // namespace target
00197 } // namespace zypp
00198 
00199 #endif // ZYPP_TARGET_RPM_RPMHEADER_H
00200