1 /*---------------------------------------------------------------------\
3 | |__ / \ / / . \ . \ |
8 \---------------------------------------------------------------------*/
17 #include "zypp/base/ReferenceCounted.h"
18 #include "zypp/base/NonCopyable.h"
19 #include "zypp/base/PtrTypes.h"
20 #include "zypp/APIConfig.h"
22 #include "zypp/ZConfig.h"
23 #include "zypp/ManagedFile.h"
25 #include "zypp/ZYppCommit.h"
26 #include "zypp/ResTraits.h"
28 #include "zypp/Target.h"
29 #include "zypp/Resolver.h"
30 #include "zypp/KeyRing.h"
31 #include "zypp/DiskUsageCounter.h"
33 ///////////////////////////////////////////////////////////////////
35 { /////////////////////////////////////////////////////////////////
47 ///////////////////////////////////////////////////////////////////
52 * \todo define Exceptions
53 * ZYpp API main interface
55 class ZYpp : public base::ReferenceCounted, private base::NonCopyable
59 typedef intrusive_ptr<ZYpp> Ptr;
60 typedef intrusive_ptr<const ZYpp> constPtr;
65 * Access to the global resolvable pool.
66 * Same as \ref zypp::ResPool::instance
70 /** Pool of ui::Selectable.
71 * Based on the ResPool, ui::Selectable groups ResObjetcs of
74 ResPoolProxy poolProxy() const;
76 DiskUsageCounter::MountPointSet diskUsage();
78 void setPartitions(const DiskUsageCounter::MountPointSet &mp);
80 DiskUsageCounter::MountPointSet getPartitions() const;
86 Target_Ptr target() const;
88 /** Same as \ref target but returns NULL if target is not
89 * initialized, instead of throwing.
91 Target_Ptr getTarget() const;
95 * Just init the target, dont populate store or pool.
96 * If \c doRebuild_r is \c true, an already existing
97 * database is rebuilt (rpm --rebuilddb ).
99 void initializeTarget(const Pathname & root, bool doRebuild_r = false);
108 typedef ZYppCommitResult CommitResult;
110 /** Commit changes and transactions.
111 * \param \ref CommitPolicy
112 * \return \ref CommitResult
115 ZYppCommitResult commit( const ZYppCommitPolicy & policy_r );
117 /** Install a source package on the Target.
120 void installSrcPackage( const SrcPackage_constPtr & srcPackage_r );
122 /** Provides a source package on the Target.
125 ManagedFile provideSrcPackage( const SrcPackage_constPtr & srcPackage_r );
129 Resolver_Ptr resolver() const;
130 KeyRing_Ptr keyRing() const;
133 /** Get the path where zypp related plugins store persistent data and caches */
134 Pathname homePath() const;
136 /** Get the path where zypp related plugins store temp data */
137 Pathname tmpPath() const;
139 /** set the home, if you need to change it */
140 void setHomePath( const Pathname & path );
146 virtual std::ostream & dumpOn( std::ostream & str ) const;
149 friend class ZYppFactory;
152 typedef zypp_detail::ZYppImpl Impl;
153 typedef shared_ptr<Impl> Impl_Ptr;
156 ZYpp( const Impl_Ptr & impl_r );
158 /** Pointer to implementation */
159 RW_pointer<Impl> _pimpl;
161 ///////////////////////////////////////////////////////////////////
163 /////////////////////////////////////////////////////////////////
165 ///////////////////////////////////////////////////////////////////
166 #endif // ZYPP_ZYPP_H