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;
132 /** Set the preferred locale for translated labels, descriptions,
133 * etc. passed to the UI.
134 * \deprecated Use ZConfig diretcly.
136 ZYPP_DEPRECATED void setTextLocale( const Locale & textLocale_r )
137 { ZConfig::instance().setTextLocale( textLocale_r ); }
138 /** \deprecated Use ZConfig diretcly. */
139 ZYPP_DEPRECATED Locale getTextLocale() const
140 { return ZConfig::instance().textLocale(); }
143 /** \name move to pool
144 * \deprecated Use ResPool diretcly.
147 /** Set the requested locales.
148 * Languages to be supported by the system, e.g. language specific
149 * packages to be installed. This function operates on the pool,
150 * so only the locales that are available as resolvables
151 * are marked as requested. The rest is ignored.
152 * \deprecated Use ResPool diretcly.
154 void setRequestedLocales( const LocaleSet & locales_r ) ZYPP_DEPRECATED;
156 /** \deprecated Use ResPool diretcly. */
157 const LocaleSet & getRequestedLocales() const ZYPP_DEPRECATED;
160 * Get the set of available locales.
161 * This is computed from the package data so it actually
162 * represents all locales packages claim to support.
163 * \deprecated Use ResPool diretcly.
165 const LocaleSet & getAvailableLocales() const ZYPP_DEPRECATED;
169 /** Get the path where zypp related plugins store persistent data and caches */
170 Pathname homePath() const;
172 /** Get the path where zypp related plugins store temp data */
173 Pathname tmpPath() const;
175 /** set the home, if you need to change it */
176 void setHomePath( const Pathname & path );
178 /** Get the system architecture.
179 * \deprecated Use ZConfig diretcly.
181 ZYPP_DEPRECATED Arch architecture() const
182 { return ZConfig::instance().systemArchitecture(); }
183 /** Set the system architecture.
184 * This should be used for testing/debugging only since the Target backend
185 * won't be able to install incompatible packages ;-)
186 * \deprecated Use ZConfig diretcly.
188 ZYPP_DEPRECATED void setArchitecture( const Arch & arch )
189 { ZConfig::instance().setSystemArchitecture( arch ); }
194 * \deprecated Persistent locks are automatically maintained, kept in the pool, loaded and saved together with the Target.
195 * \ref ZConfig::apply_locks_file tells whether locks are applied or not.
197 ZYPP_DEPRECATED int applyLocks()
204 virtual std::ostream & dumpOn( std::ostream & str ) const;
207 friend class ZYppFactory;
210 typedef zypp_detail::ZYppImpl Impl;
211 typedef shared_ptr<Impl> Impl_Ptr;
214 ZYpp( const Impl_Ptr & impl_r );
216 /** Pointer to implementation */
217 RW_pointer<Impl> _pimpl;
219 ///////////////////////////////////////////////////////////////////
221 /////////////////////////////////////////////////////////////////
223 ///////////////////////////////////////////////////////////////////
224 #endif // ZYPP_ZYPP_H