1 /*---------------------------------------------------------------------\
3 | |__ / \ / / . \ . \ |
8 \---------------------------------------------------------------------*/
17 #include "zypp/base/NonCopyable.h"
18 #include "zypp/base/PtrTypes.h"
19 #include "zypp/APIConfig.h"
21 #include "zypp/ZConfig.h"
22 #include "zypp/ManagedFile.h"
24 #include "zypp/ZYppCommit.h"
25 #include "zypp/ResTraits.h"
27 #include "zypp/Target.h"
28 #include "zypp/Resolver.h"
29 #include "zypp/KeyRing.h"
30 #include "zypp/DiskUsageCounter.h"
32 ///////////////////////////////////////////////////////////////////
34 { /////////////////////////////////////////////////////////////////
46 ///////////////////////////////////////////////////////////////////
51 * \todo define Exceptions
52 * ZYpp API main interface
54 class ZYpp : private base::NonCopyable
56 friend std::ostream & operator<<( std::ostream & str, const ZYpp & obj );
59 // can't get swig working if shared_ptr is without namespace here
60 typedef ::boost::shared_ptr<ZYpp> Ptr;
61 typedef ::boost::shared_ptr<const ZYpp> constPtr;
66 * Access to the global resolvable pool.
67 * Same as \ref zypp::ResPool::instance
71 /** Pool of ui::Selectable.
72 * Based on the ResPool, ui::Selectable groups ResObjetcs of
75 ResPoolProxy poolProxy() const;
77 DiskUsageCounter::MountPointSet diskUsage();
79 void setPartitions(const DiskUsageCounter::MountPointSet &mp);
81 DiskUsageCounter::MountPointSet getPartitions() const;
87 Target_Ptr target() const;
89 /** Same as \ref target but returns NULL if target is not
90 * initialized, instead of throwing.
92 Target_Ptr getTarget() const;
96 * Just init the target, dont populate store or pool.
97 * If \c doRebuild_r is \c true, an already existing
98 * database is rebuilt (rpm --rebuilddb ).
100 void initializeTarget(const Pathname & root, bool doRebuild_r = false);
109 typedef ZYppCommitResult CommitResult;
111 /** Commit changes and transactions.
112 * \param \ref CommitPolicy
113 * \return \ref CommitResult
116 ZYppCommitResult commit( const ZYppCommitPolicy & policy_r );
118 /** Install a source package on the Target.
121 void installSrcPackage( const SrcPackage_constPtr & srcPackage_r );
123 /** Provides a source package on the Target.
126 ManagedFile provideSrcPackage( const SrcPackage_constPtr & srcPackage_r );
130 Resolver_Ptr resolver() const;
131 KeyRing_Ptr keyRing() const;
134 /** Get the path where zypp related plugins store persistent data and caches */
135 Pathname homePath() const;
137 /** Get the path where zypp related plugins store temp data */
138 Pathname tmpPath() const;
140 /** set the home, if you need to change it */
141 void setHomePath( const Pathname & path );
145 friend class ZYppFactory;
146 typedef zypp_detail::ZYppImpl Impl;
147 typedef shared_ptr<Impl> Impl_Ptr;
149 explicit ZYpp( const Impl_Ptr & impl_r );
151 /** Deleted via shared_ptr */
152 friend void ::boost::checked_delete<ZYpp>(ZYpp*); // template<class T> inline void checked_delete(T * x)
156 /** Pointer to implementation */
157 RW_pointer<Impl> _pimpl;
159 ///////////////////////////////////////////////////////////////////
161 /////////////////////////////////////////////////////////////////
163 ///////////////////////////////////////////////////////////////////
164 #endif // ZYPP_ZYPP_H