Make packages rpovide relevant files
[platform/upstream/libzypp.git] / zypp / target / rpm / RpmHeader.h
1 /*---------------------------------------------------------------------\
2 |                          ____ _   __ __ ___                          |
3 |                         |__  / \ / / . \ . \                         |
4 |                           / / \ V /|  _/  _/                         |
5 |                          / /__ | | | | | |                           |
6 |                         /_____||_| |_| |_|                           |
7 |                                                                      |
8 \---------------------------------------------------------------------*/
9 /** \file zypp/target/rpm/RpmHeader.h
10  *
11 */
12 #ifndef ZYPP_TARGET_RPM_RPMHEADER_H
13 #define ZYPP_TARGET_RPM_RPMHEADER_H
14
15 #include <iosfwd>
16 #include <list>
17
18 #include "zypp/target/rpm/BinHeader.h"
19
20 #include "zypp/Package.h"
21 #include "zypp/Changelog.h"
22 #include "zypp/CapSetFwd.h"
23 #include "zypp/Pathname.h"
24
25 namespace zypp {
26   namespace target {
27     namespace rpm {
28
29 #if 0
30       class PkgDu;
31 #endif
32       
33       ///////////////////////////////////////////////////////////////////
34       //
35       //        CLASS NAME : RpmHeader
36       /**
37        * @short Wrapper class for rpm header struct.
38        *
39        * <code>RpmHeader</code> provides methods to query the content
40        * of a rpm header struct retrieved from the RPM database or by reading
41        * the rpm header of a package on disk.
42        *
43        * The rpm header contains all data associated with a package. So you
44        * probabely do not want to permanently store too many of them.
45        *
46        * <B>NEVER create <code>RpmHeader</code> from a NULL <code>Header</code>! </B>
47        **/
48       class RpmHeader : public BinHeader {
49         public:
50           typedef intrusive_ptr<RpmHeader> Ptr;
51           typedef intrusive_ptr<const RpmHeader> constPtr;
52
53         private:
54       
55           CapSet PkgRelList_val( tag tag_r, bool pre, std::set<std::string> * freq_r = 0 ) const;
56       
57         public:
58       
59           /**
60            *
61            **/
62           RpmHeader( Header h_r = 0 );
63       
64           /**
65            * <B>Dangerous!<\B> This one takes the header out of rhs
66            * and leaves rhs empty.
67            **/
68           RpmHeader( BinHeader::Ptr & rhs );
69       
70           virtual ~RpmHeader();
71       
72           bool isSrc() const;
73       
74         public:
75       
76           std::string    tag_name()        const;
77           Edition tag_edition()     const;
78           Arch    tag_arch()        const;
79       
80           Date       tag_installtime() const;
81           Date       tag_buildtime()   const;
82       
83           /**
84            * If <code>freq_r</code> is not NULL, file dependencies found are inserted.
85            **/
86           CapSet tag_provides ( std::set<std::string> * freq_r = 0 ) const;
87           /**
88            * @see #tag_provides
89            **/
90           CapSet tag_requires ( std::set<std::string> * freq_r = 0 ) const;
91           /**
92            * @see #tag_provides
93            **/
94           CapSet tag_prerequires ( std::set<std::string> * freq_r = 0 ) const;
95           /**
96            * @see #tag_provides
97            **/
98           CapSet tag_conflicts( std::set<std::string> * freq_r = 0 ) const;
99           /**
100            * @see #tag_provides
101            **/
102           CapSet tag_obsoletes( std::set<std::string> * freq_r = 0 ) const;
103       
104           ByteCount tag_size()        const;
105           ByteCount tag_archivesize() const;
106       
107           std::string tag_summary()      const;
108           std::string tag_description()  const;
109           std::string tag_group()        const;
110           std::string tag_vendor()       const;
111           std::string tag_distribution() const;
112           std::string tag_license()      const;
113           std::string tag_buildhost()    const;
114           std::string tag_packager()     const;
115           std::string tag_url()          const;
116           std::string tag_os()           const;
117           std::string tag_prein()        const;
118           std::string tag_postin()       const;
119           std::string tag_preun()        const;
120           std::string tag_postun()       const;
121           std::string tag_sourcerpm()    const;
122       
123           std::list<std::string> tag_filenames() const;
124       
125           Changelog tag_changelog() const;
126      
127 #warning FIXME disk usage data
128 #if 0 
129           /**
130            * Returns reference to arg <code>dudata_r</code>.
131            **/
132           PkgDu & tag_du( PkgDu & dudata_r ) const;
133 #endif
134       
135         public:
136       
137           virtual std::ostream & dumpOn( std::ostream & str ) const;
138       
139         public:
140       
141           /**
142            * Digest and signature verification flags
143            **/
144           enum VERIFICATION {
145             VERIFY       = 0x0000,
146             NODIGEST     = (1<<0),
147             NOSIGNATURE  = (1<<1),
148             NOVERIFY     = 0xffff
149           };
150       
151           /**
152            * Get an accessible packages data from disk.
153            * Returns NULL on any error.
154            **/
155           static RpmHeader::constPtr readPackage( const Pathname & path,
156                                           VERIFICATION verification = VERIFY );
157       };
158
159 ///////////////////////////////////////////////////////////////////
160     } // namespace rpm
161   } // namespace target
162 } // namespace zypp
163
164 #endif // ZYPP_TARGET_RPM_RPMHEADER_H
165