libzypp  13.10.6
RpmHeader.h
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | ____ _ __ __ ___ |
3 | |__ / \ / / . \ . \ |
4 | / / \ V /| _/ _/ |
5 | / /__ | | | | | | |
6 | /_____||_| |_| |_| |
7 | |
8 \---------------------------------------------------------------------*/
12 #ifndef ZYPP_TARGET_RPM_RPMHEADER_H
13 #define ZYPP_TARGET_RPM_RPMHEADER_H
14 
15 #include <iosfwd>
16 #include <list>
17 
19 
20 #include "zypp/Package.h"
21 #include "zypp/Changelog.h"
22 #include "zypp/Pathname.h"
23 #include "zypp/DiskUsage.h"
24 
25 
26 namespace zypp
27 {
28 namespace target
29 {
30 namespace rpm
31 {
32 
33 struct FileInfo
34 {
35  Pathname filename;
37  std::string md5sum;
38  uid_t uid;
39  gid_t gid;
40  mode_t mode;
41  time_t mtime;
42  bool ghost;
43  Pathname link_target;
44 };
45 
47 //
48 // CLASS NAME : RpmHeader
61 class RpmHeader : public BinHeader
62 {
63 public:
64  typedef intrusive_ptr<RpmHeader> Ptr;
65  typedef intrusive_ptr<const RpmHeader> constPtr;
66 
67 private:
68 
69  CapabilitySet PkgRelList_val( tag tag_r, bool pre, std::set<std::string> * freq_r = 0 ) const;
70 
71 public:
72 
76  RpmHeader( Header h_r = 0 );
77 
82  RpmHeader( BinHeader::Ptr & rhs );
83 
84  virtual ~RpmHeader();
85 
86  bool isSrc() const; //< Either 'src' or 'nosrc'
87  bool isNosrc() const; //< Only 'nosrc'
88 
89 public:
90 
91  std::string tag_name() const;
93  std::string tag_version() const;
94  std::string tag_release() const;
95  Edition tag_edition() const;
96  Arch tag_arch() const;
97 
98  Date tag_installtime() const;
99  Date tag_buildtime() const;
100 
104  CapabilitySet tag_provides ( std::set<std::string> * freq_r = 0 ) const;
108  CapabilitySet tag_requires ( std::set<std::string> * freq_r = 0 ) const;
112  CapabilitySet tag_prerequires ( std::set<std::string> * freq_r = 0 ) const;
116  CapabilitySet tag_conflicts( std::set<std::string> * freq_r = 0 ) const;
120  CapabilitySet tag_obsoletes( std::set<std::string> * freq_r = 0 ) const;
124  CapabilitySet tag_enhances( std::set<std::string> * freq_r = 0 ) const;
128  CapabilitySet tag_suggests( std::set<std::string> * freq_r = 0 ) const;
132  CapabilitySet tag_supplements( std::set<std::string> * freq_r = 0 ) const
133  { return CapabilitySet(); }
134 
135  ByteCount tag_size() const;
136  ByteCount tag_archivesize() const;
137 
138  std::string tag_summary() const;
139  std::string tag_description() const;
140  std::string tag_group() const;
141  std::string tag_vendor() const;
142  std::string tag_distribution() const;
143  std::string tag_license() const;
144  std::string tag_buildhost() const;
145  std::string tag_packager() const;
146  std::string tag_url() const;
147  std::string tag_os() const;
148  std::string tag_prein() const;
149  std::string tag_postin() const;
150  std::string tag_preun() const;
151  std::string tag_postun() const;
152  std::string tag_sourcerpm() const;
153 
155  std::list<std::string> tag_filenames() const;
156 
161  std::list<FileInfo> tag_fileinfos() const;
162 
163  Changelog tag_changelog() const;
164 
168  DiskUsage & tag_du( DiskUsage & dudata_r ) const;
169 
170 public:
171 
172  virtual std::ostream & dumpOn( std::ostream & str ) const;
173 
174 public:
175 
180  {
181  VERIFY = 0x0000,
182  NODIGEST = (1<<0),
183  NOSIGNATURE = (1<<1),
184  NOVERIFY = 0xffff
185  };
186 
191  static RpmHeader::constPtr readPackage( const Pathname & path,
192  VERIFICATION verification = VERIFY );
193 };
194 
196 } // namespace rpm
197 } // namespace target
198 } // namespace zypp
199 
200 #endif // ZYPP_TARGET_RPM_RPMHEADER_H
201 
std::string tag_buildhost() const
Definition: RpmHeader.cc:717
std::string tag_license() const
Definition: RpmHeader.cc:704
std::string tag_packager() const
Definition: RpmHeader.cc:730
std::string tag_release() const
Definition: RpmHeader.cc:340
intrusive_ptr< const RpmHeader > constPtr
Definition: RpmHeader.h:65
CapabilitySet tag_requires(std::set< std::string > *freq_r=0) const
Definition: RpmHeader.cc:535
ByteCount tag_size() const
Definition: RpmHeader.cc:613
DiskUsage & tag_du(DiskUsage &dudata_r) const
Returns reference to arg dudata_r.
Definition: RpmHeader.cc:971
Architecture.
Definition: Arch.h:36
intrusive_ptr< RpmHeader > Ptr
Definition: RpmHeader.h:64
Store and operate with byte count.
Definition: ByteCount.h:30
VERIFICATION
Digest and signature verification flags.
Definition: RpmHeader.h:179
std::list< ChangelogEntry > Changelog
List of ChangelogEntry.
Definition: Changelog.h:53
std::string tag_url() const
Definition: RpmHeader.cc:743
CapabilitySet tag_conflicts(std::set< std::string > *freq_r=0) const
Definition: RpmHeader.cc:561
std::string tag_prein() const
Definition: RpmHeader.cc:769
Edition tag_edition() const
Definition: RpmHeader.cc:353
CapabilitySet tag_provides(std::set< std::string > *freq_r=0) const
If freq_r is not NULL, file dependencies found are inserted.
Definition: RpmHeader.cc:522
std::string tag_preun() const
Definition: RpmHeader.cc:795
Changelog tag_changelog() const
Definition: RpmHeader.cc:943
intrusive_ptr< BinHeader > Ptr
Definition: BinHeader.h:47
Edition represents [epoch:]version[-release]
Definition: Edition.h:60
CapabilitySet tag_suggests(std::set< std::string > *freq_r=0) const
Definition: RpmHeader.cc:600
Edition::epoch_t tag_epoch() const
Definition: RpmHeader.cc:314
unsigned epoch_t
Type of an epoch.
Definition: Edition.h:64
std::list< FileInfo > tag_fileinfos() const
complete information about the files (extended version of tag_filenames())
Definition: RpmHeader.cc:862
std::tr1::unordered_set< Capability > CapabilitySet
Definition: Capability.h:33
CapabilitySet tag_enhances(std::set< std::string > *freq_r=0) const
Definition: RpmHeader.cc:587
std::string tag_os() const
Definition: RpmHeader.cc:756
std::string tag_version() const
Definition: RpmHeader.cc:327
std::string tag_postun() const
Definition: RpmHeader.cc:808
std::list< std::string > tag_filenames() const
just the list of names
Definition: RpmHeader.cc:834
Store and operate on date (time_t).
Definition: Date.h:31
std::string tag_group() const
Definition: RpmHeader.cc:665
std::string tag_description() const
Definition: RpmHeader.cc:652
CapabilitySet tag_obsoletes(std::set< std::string > *freq_r=0) const
Definition: RpmHeader.cc:574
virtual std::ostream & dumpOn(std::ostream &str) const
Overload to realize std::ostream &amp; operator&lt;&lt;.
Definition: RpmHeader.cc:267
std::string tag_postin() const
Definition: RpmHeader.cc:782
static RpmHeader::constPtr readPackage(const Pathname &path, VERIFICATION verification=VERIFY)
Get an accessible packages data from disk.
Definition: RpmHeader.cc:211
ByteCount tag_archivesize() const
Definition: RpmHeader.cc:626
std::string tag_vendor() const
Definition: RpmHeader.cc:678
Date tag_installtime() const
Definition: RpmHeader.cc:379
std::string tag_distribution() const
Definition: RpmHeader.cc:691
Wrapper class for rpm header struct.
Definition: RpmHeader.h:61
std::string tag_sourcerpm() const
Definition: RpmHeader.cc:821
std::string tag_summary() const
Definition: RpmHeader.cc:639
CapabilitySet tag_supplements(std::set< std::string > *freq_r=0) const
Unsupported by rpm.
Definition: RpmHeader.h:132
std::string tag_name() const
Definition: RpmHeader.cc:301
CapabilitySet PkgRelList_val(tag tag_r, bool pre, std::set< std::string > *freq_r=0) const
Definition: RpmHeader.cc:405
CapabilitySet tag_prerequires(std::set< std::string > *freq_r=0) const
Definition: RpmHeader.cc:548