1 /*---------------------------------------------------------------------\
3 | |__ / \ / / . \ . \ |
8 \---------------------------------------------------------------------*/
9 /** \file zypp/target/TargetImpl.h
12 #ifndef ZYPP_TARGET_TARGETIMPL_H
13 #define ZYPP_TARGET_TARGETIMPL_H
17 #include "zypp/base/ReferenceCounted.h"
18 #include "zypp/base/NonCopyable.h"
19 #include "zypp/base/PtrTypes.h"
20 #include "zypp/ResStore.h"
22 #include "zypp/Pathname.h"
23 #include "zypp/media/MediaAccess.h"
24 #include "zypp/Target.h"
25 #include "zypp/target/rpm/RpmDb.h"
26 #include "zypp/target/store/PersistentStorage.h"
27 #include "zypp/solver/detail/Types.h"
29 #define STORAGE_DISABLED
31 ///////////////////////////////////////////////////////////////////
33 { /////////////////////////////////////////////////////////////////
34 ///////////////////////////////////////////////////////////////////
36 { /////////////////////////////////////////////////////////////////
38 DEFINE_PTR_TYPE(TargetImpl);
40 ///////////////////////////////////////////////////////////////////
42 // CLASS NAME : TargetImpl
44 /** Base class for concrete Target implementations.
46 * Constructed by \ref TargetFactory. Public access via \ref Target
49 class TargetImpl : public base::ReferenceCounted, private base::NonCopyable
51 friend std::ostream & operator<<( std::ostream & str, const TargetImpl & obj );
54 /** Sort according to prereqs and media numbers */
55 void getResolvablesToInsDel ( const ResPool pool_r,
56 PoolItemList & dellist_r,
57 PoolItemList & instlist_r,
58 PoolItemList & srclist_r );
63 TargetImpl(const Pathname & root_r = "/");
65 virtual ~TargetImpl();
67 /** Null implementation */
68 static TargetImpl_Ptr nullimpl();
72 /** All resolvables in the target. */
73 const ResStore & resolvables();
75 /** Commit changes in the pool
76 media = 0 means any/all medias
77 media > 0 means limit commits to this media */
78 void commit( ResPool pool_r, unsigned int medianr, PoolItemList & errors_r, PoolItemList & remaining_r, PoolItemList & srcremaining_r );
80 /** Commit ordered changes
81 return uncommitted ones (due to error) */
82 PoolItemList commit( const PoolItemList & items_r );
84 /** Overload to realize stream output. */
85 virtual std::ostream & dumpOn( std::ostream & str ) const
86 { return str << "TargetImpl"; }
88 /** The RPM database */
91 /** If the package is installed and provides the file
92 Needed to evaluate split provides during Resolver::Upgrade() */
93 bool providesFile (const std::string & path_str, const std::string & name_str) const;
95 /** Return the resolvable which provides path_str (rpm -qf)
96 return NULL if no resolvable provides this file */
97 ResObject::constPtr whoOwnsFile (const std::string & path_str) const;
100 /** All resolvables provided by the target. */
102 /** Path to the target */
106 #ifndef STORAGE_DISABLED
107 zypp::storage::PersistentStorage _storage;
110 /** Null implementation */
111 static TargetImpl_Ptr _nullimpl;
113 /** wrapper with callback around getPlainRpm */
114 Pathname getRpmFile(Package::constPtr package);
116 ///////////////////////////////////////////////////////////////////
118 /** \relates TargetImpl Stream output */
119 inline std::ostream & operator<<( std::ostream & str, const TargetImpl & obj )
120 { return obj.dumpOn( str ); }
122 /////////////////////////////////////////////////////////////////
123 } // namespace target
124 ///////////////////////////////////////////////////////////////////
125 /////////////////////////////////////////////////////////////////
127 ///////////////////////////////////////////////////////////////////
128 #endif // ZYPP_TARGET_TARGETIMPL_H