libzypp  17.25.0
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 
24 
25 namespace zypp
26 {
27 namespace target
28 {
29 namespace rpm
30 {
31 
32 struct FileInfo
33 {
36  std::string md5sum;
37  uid_t uid;
38  gid_t gid;
39  mode_t mode;
40  time_t mtime;
41  bool ghost;
43 };
44 
46 //
47 // CLASS NAME : RpmHeader
60 class RpmHeader : public BinHeader
61 {
62 public:
63  typedef intrusive_ptr<RpmHeader> Ptr;
64  typedef intrusive_ptr<const RpmHeader> constPtr;
65 
66 private:
67 
68  CapabilitySet PkgRelList_val( tag tag_r, bool pre, std::set<std::string> * freq_r = 0 ) const;
69 
70 public:
71 
75  RpmHeader( Header h_r = 0 );
76 
81  RpmHeader( BinHeader::Ptr & rhs );
82 
83  virtual ~RpmHeader();
84 
85  bool isSrc() const; //< Either 'src' or 'nosrc'
86  bool isNosrc() const; //< Only 'nosrc'
87 
88 public:
89 
90  std::string tag_name() const;
92  std::string tag_version() const;
93  std::string tag_release() const;
94  Edition tag_edition() const;
95  Arch tag_arch() const;
96 
97  Date tag_installtime() const;
98  Date tag_buildtime() const;
99 
103  CapabilitySet tag_provides ( std::set<std::string> * freq_r = 0 ) const;
107  CapabilitySet tag_requires ( std::set<std::string> * freq_r = 0 ) const;
111  CapabilitySet tag_prerequires ( std::set<std::string> * freq_r = 0 ) const;
115  CapabilitySet tag_conflicts( std::set<std::string> * freq_r = 0 ) const;
119  CapabilitySet tag_obsoletes( std::set<std::string> * freq_r = 0 ) const;
123  CapabilitySet tag_enhances( std::set<std::string> * freq_r = 0 ) const;
127  CapabilitySet tag_suggests( std::set<std::string> * freq_r = 0 ) const;
131  CapabilitySet tag_supplements( std::set<std::string> * freq_r = 0 ) const;
135  CapabilitySet tag_recommends( std::set<std::string> * freq_r = 0 ) const;
136 
137  ByteCount tag_size() const;
138  ByteCount tag_archivesize() const;
139 
140  std::string tag_summary() const;
141  std::string tag_description() const;
142  std::string tag_group() const;
143  std::string tag_vendor() const;
144  std::string tag_distribution() const;
145  std::string tag_license() const;
146  std::string tag_buildhost() const;
147  std::string tag_packager() const;
148  std::string tag_url() const;
149  std::string tag_os() const;
150  std::string tag_prein() const;
151  std::string tag_preinprog() const;
152  std::string tag_postin() const;
153  std::string tag_postinprog() const;
154  std::string tag_preun() const;
155  std::string tag_preunprog() const;
156  std::string tag_postun() const;
157  std::string tag_postunprog() const;
158  std::string tag_pretrans() const;
159  std::string tag_pretransprog() const;
160  std::string tag_posttrans() const;
161  std::string tag_posttransprog()const;
162  std::string tag_sourcerpm() const;
163 
168  std::string signatureKeyID() const;
169 
171  std::list<std::string> tag_filenames() const;
172 
177  std::list<FileInfo> tag_fileinfos() const;
178 
179  Changelog tag_changelog() const;
180 
181 public:
182 
183  virtual std::ostream & dumpOn( std::ostream & str ) const;
184 
185 public:
186 
191  {
192  VERIFY = 0x0000,
193  NODIGEST = (1<<0),
194  NOSIGNATURE = (1<<1),
195  NOVERIFY = 0xffff
196  };
197 
202  static RpmHeader::constPtr readPackage( const Pathname & path,
203  VERIFICATION verification = VERIFY );
204 };
205 
207 } // namespace rpm
208 } // namespace target
209 } // namespace zypp
210 
211 #endif // ZYPP_TARGET_RPM_RPMHEADER_H
212 
zypp::target::rpm::RpmHeader::VERIFICATION
VERIFICATION
Digest and signature verification flags.
Definition: RpmHeader.h:190
zypp::target::rpm::FileInfo::mode
mode_t mode
Definition: RpmHeader.h:39
zypp::target::rpm::RpmHeader::tag_version
std::string tag_version() const
Definition: RpmHeader.cc:326
BinHeader.h
zypp::Changelog
std::list< ChangelogEntry > Changelog
List of ChangelogEntry.
Definition: Changelog.h:53
zypp::target::rpm::FileInfo
Definition: RpmHeader.h:32
zypp::target::rpm::RpmHeader::tag_preun
std::string tag_preun() const
Definition: RpmHeader.cc:842
Changelog.h
zypp::target::rpm::RpmHeader::tag_prerequires
CapabilitySet tag_prerequires(std::set< std::string > *freq_r=0) const
Definition: RpmHeader.cc:574
zypp::target::rpm::RpmHeader::tag_buildtime
Date tag_buildtime() const
Definition: RpmHeader.cc:391
zypp::target::rpm::RpmHeader::tag_preinprog
std::string tag_preinprog() const
Definition: RpmHeader.cc:833
zypp::target::rpm::FileInfo::ghost
bool ghost
Definition: RpmHeader.h:41
zypp::target::rpm::RpmHeader::tag_size
ByteCount tag_size() const
Definition: RpmHeader.cc:681
zypp::target::rpm::BinHeader
Definition: BinHeader.h:42
zypp::target::rpm::RpmHeader::tag_release
std::string tag_release() const
Definition: RpmHeader.cc:339
zypp::target::rpm::FileInfo::filename
Pathname filename
Definition: RpmHeader.h:34
zypp::target::rpm::FileInfo::link_target
Pathname link_target
Definition: RpmHeader.h:42
zypp::target::rpm::FileInfo::md5sum
std::string md5sum
Definition: RpmHeader.h:36
zypp::target::rpm::RpmHeader::constPtr
intrusive_ptr< const RpmHeader > constPtr
Definition: RpmHeader.h:64
zypp::target::rpm::RpmHeader::tag_postunprog
std::string tag_postunprog() const
Definition: RpmHeader.cc:851
zypp::Edition
Edition represents [epoch:]version[-release]
Definition: Edition.h:60
zypp::Edition::epoch_t
unsigned epoch_t
Type of an epoch.
Definition: Edition.h:64
zypp::target::rpm::RpmHeader::tag_preunprog
std::string tag_preunprog() const
Definition: RpmHeader.cc:845
zypp::target::rpm::RpmHeader::tag_postin
std::string tag_postin() const
Definition: RpmHeader.cc:836
zypp::target::rpm::FileInfo::mtime
time_t mtime
Definition: RpmHeader.h:40
zypp::target::rpm::RpmHeader::tag_name
std::string tag_name() const
Definition: RpmHeader.cc:300
Pathname.h
zypp::target::rpm::RpmHeader::tag_provides
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:548
zypp::Arch
Architecture.
Definition: Arch.h:36
zypp::target::rpm::RpmHeader::tag_os
std::string tag_os() const
Definition: RpmHeader.cc:824
zypp::target::rpm::RpmHeader::tag_pretransprog
std::string tag_pretransprog() const
Definition: RpmHeader.cc:857
zypp::target::rpm::RpmHeader::tag_buildhost
std::string tag_buildhost() const
Definition: RpmHeader.cc:785
zypp::target::rpm::RpmHeader::tag_sourcerpm
std::string tag_sourcerpm() const
Definition: RpmHeader.cc:874
zypp::target::rpm::RpmHeader::tag_packager
std::string tag_packager() const
Definition: RpmHeader.cc:798
zypp::target::rpm::FileInfo::size
ByteCount size
Definition: RpmHeader.h:35
zypp::target::rpm::RpmHeader::tag_url
std::string tag_url() const
Definition: RpmHeader.cc:811
zypp::target::rpm::RpmHeader::isNosrc
bool isNosrc() const
Definition: RpmHeader.cc:287
zypp::ByteCount
Store and operate with byte count.
Definition: ByteCount.h:30
zypp::target::rpm::RpmHeader::tag_license
std::string tag_license() const
Definition: RpmHeader.cc:772
zypp::target::rpm::RpmHeader::tag_fileinfos
std::list< FileInfo > tag_fileinfos() const
complete information about the files (extended version of tag_filenames())
Definition: RpmHeader.cc:935
zypp::CapabilitySet
std::unordered_set< Capability > CapabilitySet
Definition: Capability.h:33
zypp::target::rpm::RpmHeader::tag_recommends
CapabilitySet tag_recommends(std::set< std::string > *freq_r=0) const
Definition: RpmHeader.cc:664
Package.h
zypp::target::rpm::RpmHeader::tag_distribution
std::string tag_distribution() const
Definition: RpmHeader.cc:759
zypp::target::rpm::RpmHeader::tag_group
std::string tag_group() const
Definition: RpmHeader.cc:733
zypp::target::rpm::RpmHeader::tag_pretrans
std::string tag_pretrans() const
Definition: RpmHeader.cc:854
zypp::target::rpm::RpmHeader::tag_postun
std::string tag_postun() const
Definition: RpmHeader.cc:848
zypp::target::rpm::RpmHeader::tag_summary
std::string tag_summary() const
Definition: RpmHeader.cc:707
zypp::target::rpm::RpmHeader::tag_epoch
Edition::epoch_t tag_epoch() const
Definition: RpmHeader.cc:313
zypp::target::rpm::RpmHeader::tag_obsoletes
CapabilitySet tag_obsoletes(std::set< std::string > *freq_r=0) const
Definition: RpmHeader.cc:600
zypp::target::rpm::RpmHeader::tag_suggests
CapabilitySet tag_suggests(std::set< std::string > *freq_r=0) const
Definition: RpmHeader.cc:630
zypp::target::rpm::RpmHeader::tag_prein
std::string tag_prein() const
Definition: RpmHeader.cc:830
zypp::target::rpm::RpmHeader::RpmHeader
RpmHeader(Header h_r=0)
Definition: RpmHeader.cc:177
zypp
Easy-to use interface to the ZYPP dependency resolver.
Definition: CodePitfalls.doc:1
zypp::target::rpm::RpmHeader::tag_archivesize
ByteCount tag_archivesize() const
Definition: RpmHeader.cc:694
zypp::target::rpm::RpmHeader::~RpmHeader
virtual ~RpmHeader()
Definition: RpmHeader.cc:199
zypp::target::rpm::RpmHeader::tag_edition
Edition tag_edition() const
Definition: RpmHeader.cc:352
zypp::target::rpm::RpmHeader::NODIGEST
Definition: RpmHeader.h:193
zypp::target::rpm::FileInfo::gid
gid_t gid
Definition: RpmHeader.h:38
zypp::target::rpm::RpmHeader::tag_installtime
Date tag_installtime() const
Definition: RpmHeader.cc:378
zypp::target::rpm::RpmHeader::NOSIGNATURE
Definition: RpmHeader.h:194
zypp::target::rpm::RpmHeader::tag_supplements
CapabilitySet tag_supplements(std::set< std::string > *freq_r=0) const
Definition: RpmHeader.cc:647
zypp::target::rpm::RpmHeader::dumpOn
virtual std::ostream & dumpOn(std::ostream &str) const
Overload to realize std::ostream & operator<<.
Definition: RpmHeader.cc:264
zypp::target::rpm::RpmHeader::isSrc
bool isSrc() const
Definition: RpmHeader.cc:282
zypp::target::rpm::RpmHeader::tag_changelog
Changelog tag_changelog() const
Definition: RpmHeader.cc:1016
zypp::target::rpm::RpmHeader::tag_enhances
CapabilitySet tag_enhances(std::set< std::string > *freq_r=0) const
Definition: RpmHeader.cc:613
zypp::target::rpm::RpmHeader::VERIFY
Definition: RpmHeader.h:192
zypp::Date
Store and operate on date (time_t).
Definition: Date.h:32
zypp::target::rpm::RpmHeader::readPackage
static RpmHeader::constPtr readPackage(const Pathname &path, VERIFICATION verification=VERIFY)
Get an accessible packages data from disk.
Definition: RpmHeader.cc:208
zypp::target::rpm::RpmHeader::tag_description
std::string tag_description() const
Definition: RpmHeader.cc:720
zypp::target::rpm::RpmHeader::tag_posttrans
std::string tag_posttrans() const
Definition: RpmHeader.cc:860
zypp::target::rpm::RpmHeader::tag_arch
Arch tag_arch() const
Definition: RpmHeader.cc:365
zypp::filesystem::Pathname
Pathname.
Definition: Pathname.h:44
zypp::target::rpm::BinHeader::Ptr
intrusive_ptr< BinHeader > Ptr
Definition: BinHeader.h:47
zypp::target::rpm::RpmHeader::tag_posttransprog
std::string tag_posttransprog() const
Definition: RpmHeader.cc:863
zypp::target::rpm::RpmHeader::tag_vendor
std::string tag_vendor() const
Definition: RpmHeader.cc:746
zypp::target::rpm::RpmHeader::NOVERIFY
Definition: RpmHeader.h:195
str
String related utilities and Regular expression matching.
zypp::target::rpm::RpmHeader::tag_requires
CapabilitySet tag_requires(std::set< std::string > *freq_r=0) const
Definition: RpmHeader.cc:561
zypp::target::rpm::RpmHeader
Wrapper class for rpm header struct.
Definition: RpmHeader.h:60
zypp::target::rpm::RpmHeader::PkgRelList_val
CapabilitySet PkgRelList_val(tag tag_r, bool pre, std::set< std::string > *freq_r=0) const
Definition: RpmHeader.cc:404
zypp::target::rpm::BinHeader::tag
rpmTag tag
Definition: BinHeader.h:51
zypp::target::rpm::RpmHeader::signatureKeyID
std::string signatureKeyID() const
Uses headerFormat to query the signature info from the header.
Definition: RpmHeader.cc:879
zypp::target::rpm::RpmHeader::tag_conflicts
CapabilitySet tag_conflicts(std::set< std::string > *freq_r=0) const
Definition: RpmHeader.cc:587
zypp::target::rpm::RpmHeader::tag_postinprog
std::string tag_postinprog() const
Definition: RpmHeader.cc:839
zypp::target::rpm::RpmHeader::tag_filenames
std::list< std::string > tag_filenames() const
just the list of names
Definition: RpmHeader.cc:907
zypp::target::rpm::FileInfo::uid
uid_t uid
Definition: RpmHeader.h:37
zypp::target::rpm::RpmHeader::Ptr
intrusive_ptr< RpmHeader > Ptr
Definition: RpmHeader.h:63