1 /*---------------------------------------------------------------------\
3 | |__ / \ / / . \ . \ |
8 \---------------------------------------------------------------------*/
17 #include "zypp/base/ReferenceCounted.h"
18 #include "zypp/base/NonCopyable.h"
19 #include "zypp/base/PtrTypes.h"
20 #include "zypp/base/Deprecated.h"
22 #include "zypp/ZConfig.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 : public base::ReferenceCounted, private base::NonCopyable
58 typedef intrusive_ptr<ZYpp> Ptr;
59 typedef intrusive_ptr<const ZYpp> constPtr;
64 * Access to the global resolvable pool.
65 * Same as \ref zypp::ResPool::instance
69 /** Pool of ui::Selectable.
70 * Based on the ResPool, ui::Selectable groups ResObjetcs of
73 ResPoolProxy poolProxy() const;
75 DiskUsageCounter::MountPointSet diskUsage();
77 void setPartitions(const DiskUsageCounter::MountPointSet &mp);
79 DiskUsageCounter::MountPointSet getPartitions() const;
85 Target_Ptr target() const;
87 /** Same as \ref target but returns NULL if target is not
88 * initialized, instead of throwing.
90 Target_Ptr getTarget() const;
94 * Just init the target, dont populate store or pool.
95 * If \c doRebuild_r is \c true, an already existing
96 * database is rebuilt (rpm --rebuilddb ).
98 void initializeTarget(const Pathname & root, bool doRebuild_r = false);
107 typedef ZYppCommitResult CommitResult;
109 /** Commit changes and transactions.
110 * \param \ref CommitPolicy
111 * \return \ref CommitResult
114 ZYppCommitResult commit( const ZYppCommitPolicy & policy_r );
116 /** Install a source package on the Target.
119 void installSrcPackage( const SrcPackage_constPtr & srcPackage_r );
123 Resolver_Ptr resolver() const;
124 KeyRing_Ptr keyRing() const;
126 /** Set the preferred locale for translated labels, descriptions,
127 * etc. passed to the UI.
128 * \deprecated Use ZConfig diretcly.
130 ZYPP_DEPRECATED void setTextLocale( const Locale & textLocale_r )
131 { ZConfig::instance().setTextLocale( textLocale_r ); }
132 /** \deprecated Use ZConfig diretcly. */
133 ZYPP_DEPRECATED Locale getTextLocale() const
134 { return ZConfig::instance().textLocale(); }
137 /** \name move to pool
138 * \deprecated Use ResPool diretcly.
141 /** Set the requested locales.
142 * Languages to be supported by the system, e.g. language specific
143 * packages to be installed. This function operates on the pool,
144 * so only the locales that are available as resolvables
145 * are marked as requested. The rest is ignored.
146 * \deprecated Use ResPool diretcly.
148 void setRequestedLocales( const LocaleSet & locales_r ) ZYPP_DEPRECATED;
150 /** \deprecated Use ResPool diretcly. */
151 const LocaleSet & getRequestedLocales() const ZYPP_DEPRECATED;
154 * Get the set of available locales.
155 * This is computed from the package data so it actually
156 * represents all locales packages claim to support.
157 * \deprecated Use ResPool diretcly.
159 const LocaleSet & getAvailableLocales() const ZYPP_DEPRECATED;
163 /** Get the path where zypp related plugins store persistent data and caches */
164 Pathname homePath() const;
166 /** Get the path where zypp related plugins store temp data */
167 Pathname tmpPath() const;
169 /** set the home, if you need to change it */
170 void setHomePath( const Pathname & path );
172 /** Get the system architecture.
173 * \deprecated Use ZConfig diretcly.
175 ZYPP_DEPRECATED Arch architecture() const
176 { return ZConfig::instance().systemArchitecture(); }
177 /** Set the system architecture.
178 * This should be used for testing/debugging only since the Target backend
179 * won't be able to install incompatible packages ;-)
180 * \deprecated Use ZConfig diretcly.
182 ZYPP_DEPRECATED void setArchitecture( const Arch & arch )
183 { ZConfig::instance().setSystemArchitecture( arch ); }
188 * \deprecated Persistent locks are automatically maintained, kept in the pool, loaded and saved together with the Target.
189 * \ref ZConfig::apply_locks_file tells whether locks are applied or not.
191 ZYPP_DEPRECATED int applyLocks()
198 virtual std::ostream & dumpOn( std::ostream & str ) const;
201 friend class ZYppFactory;
204 typedef zypp_detail::ZYppImpl Impl;
205 typedef shared_ptr<Impl> Impl_Ptr;
208 ZYpp( const Impl_Ptr & impl_r );
210 /** Pointer to implementation */
211 RW_pointer<Impl> _pimpl;
213 ///////////////////////////////////////////////////////////////////
215 /////////////////////////////////////////////////////////////////
217 ///////////////////////////////////////////////////////////////////
218 #endif // ZYPP_ZYPP_H