1 /*---------------------------------------------------------------------\
3 | |__ / \ / / . \ . \ |
8 \---------------------------------------------------------------------*/
9 /** \file zypp/Target.h
17 #include "zypp/base/PtrTypes.h"
18 #include "zypp/base/Deprecated.h"
20 #include "zypp/ResStore.h"
21 #include "zypp/Pathname.h"
22 #include "zypp/ResPool.h"
24 ///////////////////////////////////////////////////////////////////
26 { /////////////////////////////////////////////////////////////////
35 DEFINE_PTR_TYPE(Target);
37 ///////////////////////////////////////////////////////////////////
39 // CLASS NAME : Target
43 class Target : public base::ReferenceCounted, public base::NonCopyable
46 typedef target::TargetImpl Impl;
47 typedef intrusive_ptr<Impl> Impl_Ptr;
48 typedef std::list<PoolItem_Ref> PoolItemList;
52 /** All resolvables provided by the target. */
53 const ResStore & resolvables();
54 /** Null implementation */
55 static Target_Ptr nullimpl();
56 /** Refference to the RPM database */
57 target::rpm::RpmDb & rpmDb();
58 /** Commit changes in the pool
59 * \param medianr 0 = all/any media
60 * > 0 means only the given media number
61 * return number of successfully committed resolvables
63 * \todo Interface to commit should be ZYpp::commit( medianr ). This call
64 * should be removed from the targets public interface, as soon as ZYpp::Impl
65 * is able to call Target::I,pl.
67 int commit( ResPool pool_r, int medianr, PoolItemList & errors_r
68 , PoolItemList & remaining_r, PoolItemList & srcremaining_r ) ZYPP_DEPRECATED;
70 /** If the package is installed and provides the file
71 Needed to evaluate split provides during Resolver::Upgrade() */
72 bool providesFile (const std::string & name_str, const std::string & path_str) const;
74 ResObject::constPtr whoOwnsFile (const std::string & path_str) const;
76 /** JUST FOR TESTSUITE */
77 /** Sort according to prereqs and media numbers */
78 void getResolvablesToInsDel ( const ResPool pool_r,
79 PoolItemList & dellist_r,
80 PoolItemList & instlist_r,
81 PoolItemList & srclist_r ) const;
83 #ifndef STORAGE_DISABLED
84 /** enables the storage target */
85 bool isStorageEnabled() const;
86 void enableStorage(const Pathname &root_r);
89 /** Set the log file for target */
90 bool setInstallationLogfile(const Pathname & path_r);
95 Target( const Pathname & root = "/" );
98 Target( const Impl_Ptr & impl_r );
101 friend std::ostream & operator<<( std::ostream & str, const Target & obj );
102 /** Stream output. */
103 std::ostream & dumpOn( std::ostream & str ) const;
106 /** Pointer to implementation */
107 RW_pointer<Impl,rw_pointer::Intrusive<Impl> > _pimpl;
109 static Target_Ptr _nullimpl;
113 ///////////////////////////////////////////////////////////////////
115 /** \relates Target Stream output. */
116 inline std::ostream & operator<<( std::ostream & str, const Target & obj )
117 { return obj.dumpOn( str ); }
120 /////////////////////////////////////////////////////////////////
122 ///////////////////////////////////////////////////////////////////
123 #endif // ZYPP_TARGET_H