1 /*---------------------------------------------------------------------\
3 | |__ / \ / / . \ . \ |
8 \---------------------------------------------------------------------*/
17 #include "zypp/base/ReferenceCounted.h"
18 #include "zypp/base/NonCopyable.h"
19 #include "zypp/base/PtrTypes.h"
20 #include "zypp/Target.h"
21 #include "zypp/Resolver.h"
22 #include "zypp/DiskUsageCounter.h"
24 ///////////////////////////////////////////////////////////////////
26 { /////////////////////////////////////////////////////////////////
41 ///////////////////////////////////////////////////////////////////
46 * \todo define Exceptions
48 class ZYpp : public base::ReferenceCounted, private base::NonCopyable
52 typedef intrusive_ptr<ZYpp> Ptr;
53 typedef intrusive_ptr<const ZYpp> constPtr;
57 /** Pool of ResStatus for individual ResObjetcs. */
60 /** Pool of ui::Selectable.
61 * Based on the ResPool, ui::Selectable groups ResObjetcs of
64 ResPoolProxy poolProxy() const;
67 //SourceFeed_Ref sourceFeed() const;
69 void addResolvables (const ResStore& store, bool installed = false);
71 void removeResolvables (const ResStore& store);
73 DiskUsageCounter::MountPointSet diskUsage();
75 void setPartitions(const DiskUsageCounter::MountPointSet &mp);
79 * Tries to reset the ZYpp instance. It discards the current
80 * status without too much house keeping. Might be dangerous to use.
90 Target_Ptr target() const;
94 * if commit_only == true, just init, don't populate store or pool
96 void initTarget(const Pathname & root, bool commit_only = false);
105 /** Result returned from ZYpp::commit. */
108 /** Commit changes and transactions.
109 * \param medianr 0 = all/any media
110 * > 0 means only the given media number
111 * \return \ref CommitResult
114 CommitResult commit( int medianr_r, bool dry_run = false );
118 Resolver_Ptr resolver() const;
119 KeyRing* keyRing() const;
121 /** Set the preferd locale for translated labels, descriptions,
122 * etc. passed to the UI.
124 void setTextLocale( const Locale & textLocale_r );
126 Locale getTextLocale() const;
129 typedef std::set<Locale> LocaleSet;
130 /** Set the requested locales.
131 * Languages to be supported by the system, e.g. language specific
132 * packages to be installed.
134 void setRequestedLocales( const LocaleSet & locales_r );
136 LocaleSet getRequestedLocales() const;
139 * Get the set of available locales.
140 * This is computed from the package data so it actually
141 * represents all locales packages claim to support.
143 LocaleSet getAvailableLocales() const;
148 void availableLocale( const Locale & locale_r );
151 /** Get the path where zypp related plugins store persistent data and caches */
152 Pathname homePath() const;
153 /** set the home, if you need to change it */
154 void setHomePath( const Pathname & path );
156 /** Get the system architecture. */
157 Arch architecture() const;
158 /** Set the system architecture.
159 This should be used for testing/debugging only since the Target backend
160 won't be able to install incompatible packages ;-) */
161 void setArchitecture( const Arch & arch );
167 virtual std::ostream & dumpOn( std::ostream & str ) const;
170 friend class ZYppFactory;
173 typedef zypp_detail::ZYppImpl Impl;
174 typedef shared_ptr<Impl> Impl_Ptr;
177 ZYpp( const Impl_Ptr & impl_r );
179 /** Pointer to implementation */
180 RW_pointer<Impl> _pimpl;
182 ///////////////////////////////////////////////////////////////////
184 /////////////////////////////////////////////////////////////////
186 ///////////////////////////////////////////////////////////////////
187 #endif // ZYPP_ZYPP_H