libzypp  17.28.8
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 #include <utility>
18 
20 
21 #include <zypp/Package.h>
22 #include <zypp/Changelog.h>
23 #include <zypp/Pathname.h>
24 
25 
26 namespace zypp
27 {
28 namespace target
29 {
30 namespace rpm
31 {
32 
33 struct FileInfo
34 {
37  std::string md5sum;
38  uid_t uid;
39  gid_t gid;
40  mode_t mode;
41  time_t mtime;
42  bool ghost;
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;
136  CapabilitySet tag_recommends( std::set<std::string> * freq_r = 0 ) const;
137 
138  ByteCount tag_size() const;
139  ByteCount tag_archivesize() const;
140 
141  std::string tag_summary() const;
142  std::string tag_description() const;
143  std::string tag_group() const;
144  std::string tag_vendor() const;
145  std::string tag_distribution() const;
146  std::string tag_license() const;
147  std::string tag_buildhost() const;
148  std::string tag_packager() const;
149  std::string tag_url() const;
150  std::string tag_os() const;
151  std::string tag_prein() const;
152  std::string tag_preinprog() const;
153  std::string tag_postin() const;
154  std::string tag_postinprog() const;
155  std::string tag_preun() const;
156  std::string tag_preunprog() const;
157  std::string tag_postun() const;
158  std::string tag_postunprog() const;
159  std::string tag_pretrans() const;
160  std::string tag_pretransprog() const;
161  std::string tag_posttrans() const;
162  std::string tag_posttransprog()const;
163  std::string tag_sourcerpm() const;
164 
169  std::string signatureKeyID() const;
170 
172  std::list<std::string> tag_filenames() const;
173 
178  std::list<FileInfo> tag_fileinfos() const;
179 
180  Changelog tag_changelog() const;
181 
182 public:
183 
184  virtual std::ostream & dumpOn( std::ostream & str ) const;
185 
186 public:
187 
192  {
193  VERIFY = 0x0000,
194  NODIGEST = (1<<0),
195  NOSIGNATURE = (1<<1),
196  NOVERIFY = 0xffff
197  };
198 
203  static RpmHeader::constPtr readPackage( const Pathname & path,
204  VERIFICATION verification = VERIFY );
205 
210  static std::pair<RpmHeader::Ptr, int> readPackage( rpmts ts_r, const Pathname & path_r );
211 };
212 
214 } // namespace rpm
215 } // namespace target
216 } // namespace zypp
217 
218 #endif // ZYPP_TARGET_RPM_RPMHEADER_H
219 
Architecture.
Definition: Arch.h:37
Store and operate with byte count.
Definition: ByteCount.h:31
Store and operate on date (time_t).
Definition: Date.h:33
Edition represents [epoch:]version[-release]
Definition: Edition.h:61
unsigned epoch_t
Type of an epoch.
Definition: Edition.h:64
intrusive_ptr< BinHeader > Ptr
Definition: BinHeader.h:48
Wrapper class for rpm header struct.
Definition: RpmHeader.h:62
CapabilitySet tag_requires(std::set< std::string > *freq_r=0) const
Definition: RpmHeader.cc:566
std::string tag_vendor() const
Definition: RpmHeader.cc:751
CapabilitySet tag_recommends(std::set< std::string > *freq_r=0) const
Definition: RpmHeader.cc:669
std::string tag_prein() const
Definition: RpmHeader.cc:835
Edition::epoch_t tag_epoch() const
Definition: RpmHeader.cc:318
std::string tag_pretrans() const
Definition: RpmHeader.cc:859
CapabilitySet tag_supplements(std::set< std::string > *freq_r=0) const
Definition: RpmHeader.cc:652
static RpmHeader::constPtr readPackage(const Pathname &path, VERIFICATION verification=VERIFY)
Get an accessible packages data from disk.
Definition: RpmHeader.cc:210
virtual std::ostream & dumpOn(std::ostream &str) const
Overload to realize std::ostream & operator<<.
Definition: RpmHeader.cc:269
ByteCount tag_archivesize() const
Definition: RpmHeader.cc:699
CapabilitySet tag_obsoletes(std::set< std::string > *freq_r=0) const
Definition: RpmHeader.cc:605
intrusive_ptr< const RpmHeader > constPtr
Definition: RpmHeader.h:65
std::string tag_summary() const
Definition: RpmHeader.cc:712
std::string tag_preunprog() const
Definition: RpmHeader.cc:850
std::string tag_os() const
Definition: RpmHeader.cc:829
std::string tag_version() const
Definition: RpmHeader.cc:331
std::string tag_postun() const
Definition: RpmHeader.cc:853
CapabilitySet tag_prerequires(std::set< std::string > *freq_r=0) const
Definition: RpmHeader.cc:579
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:553
std::string tag_description() const
Definition: RpmHeader.cc:725
std::string tag_name() const
Definition: RpmHeader.cc:305
std::string tag_pretransprog() const
Definition: RpmHeader.cc:862
std::string tag_buildhost() const
Definition: RpmHeader.cc:790
Edition tag_edition() const
Definition: RpmHeader.cc:357
std::string tag_preinprog() const
Definition: RpmHeader.cc:838
std::string tag_url() const
Definition: RpmHeader.cc:816
Changelog tag_changelog() const
Definition: RpmHeader.cc:1021
std::string tag_posttransprog() const
Definition: RpmHeader.cc:868
CapabilitySet PkgRelList_val(tag tag_r, bool pre, std::set< std::string > *freq_r=0) const
Definition: RpmHeader.cc:409
std::string signatureKeyID() const
Uses headerFormat to query the signature info from the header.
Definition: RpmHeader.cc:884
std::string tag_postunprog() const
Definition: RpmHeader.cc:856
std::string tag_distribution() const
Definition: RpmHeader.cc:764
std::string tag_postinprog() const
Definition: RpmHeader.cc:844
std::string tag_group() const
Definition: RpmHeader.cc:738
std::string tag_license() const
Definition: RpmHeader.cc:777
std::string tag_sourcerpm() const
Definition: RpmHeader.cc:879
CapabilitySet tag_conflicts(std::set< std::string > *freq_r=0) const
Definition: RpmHeader.cc:592
ByteCount tag_size() const
Definition: RpmHeader.cc:686
std::string tag_packager() const
Definition: RpmHeader.cc:803
std::string tag_release() const
Definition: RpmHeader.cc:344
std::string tag_preun() const
Definition: RpmHeader.cc:847
CapabilitySet tag_suggests(std::set< std::string > *freq_r=0) const
Definition: RpmHeader.cc:635
std::string tag_postin() const
Definition: RpmHeader.cc:841
intrusive_ptr< RpmHeader > Ptr
Definition: RpmHeader.h:64
std::list< FileInfo > tag_fileinfos() const
complete information about the files (extended version of tag_filenames())
Definition: RpmHeader.cc:940
std::string tag_posttrans() const
Definition: RpmHeader.cc:865
VERIFICATION
Digest and signature verification flags.
Definition: RpmHeader.h:192
CapabilitySet tag_enhances(std::set< std::string > *freq_r=0) const
Definition: RpmHeader.cc:618
std::list< std::string > tag_filenames() const
just the list of names
Definition: RpmHeader.cc:912
String related utilities and Regular expression matching.
Easy-to use interface to the ZYPP dependency resolver.
Definition: CodePitfalls.doc:2
std::unordered_set< Capability > CapabilitySet
Definition: Capability.h:33
std::list< ChangelogEntry > Changelog
List of ChangelogEntry.
Definition: Changelog.h:53