#define ZYPP_SAT_DETAIL_POOLIMPL_H
extern "C"
{
-#include <satsolver/pool.h>
-#include <satsolver/repo.h>
-#include <satsolver/solvable.h>
-#include <satsolver/poolarch.h>
-#include <satsolver/repo_solv.h>
+#include <solv/pool.h>
+#include <solv/repo.h>
+#include <solv/solvable.h>
+#include <solv/poolarch.h>
+#include <solv/repo_solv.h>
}
#include <iosfwd>
-#include <tr1/unordered_set>
+#include "zypp/base/Tr1hash.h"
#include "zypp/base/NonCopyable.h"
#include "zypp/base/SerialNumber.h"
#include "zypp/sat/detail/PoolMember.h"
+#include "zypp/sat/Queue.h"
#include "zypp/RepoInfo.h"
#include "zypp/Locale.h"
#include "zypp/Capability.h"
* \todo actually requires a watcher.
*/
void prepare() const;
+ /** \ref prepare plus some expensive checks done before solving only. */
+ void prepareForSolving() const;
private:
/** Invalidate housekeeping data (e.g. whatprovides) if the
*/
void depSetDirty( const char * a1 = 0, const char * a2 = 0, const char * a3 = 0 );
+ /** Callback to resolve namespace dependencies (language, modalias, filesystem, etc.). */
static detail::IdType nsCallback( ::_Pool *, void * data, detail::IdType lhs, detail::IdType rhs );
public:
+ /** Reserved system repository alias \c @System. */
+ static const std::string & systemRepoAlias();
+
+ bool isSystemRepo( ::_Repo * repo_r ) const
+ { return repo_r && _pool->installed == repo_r; }
+
+ ::_Repo * systemRepo() const
+ { return _pool->installed; }
+
+ /** Get rootdir (for file conflicts check) */
+ Pathname rootDir() const
+ {
+ const char * rd = ::pool_get_rootdir( _pool );
+ return( rd ? rd : "/" );
+ }
+
+ /** Set rootdir (for file conflicts check) */
+ void rootDir( const Pathname & root_r )
+ {
+ if ( root_r.empty() || root_r == "/" )
+ ::pool_set_rootdir( _pool, nullptr );
+ else
+ ::pool_set_rootdir( _pool, root_r.c_str() );
+ }
+
+ public:
/** \name Actions invalidating housekeeping data.
*
* All methods expect valid arguments being passed.
*/
//@{
/** Creating a new repo named \a name_r. */
- RepoIdType _createRepo( const std::string & name_r )
- {
- setDirty(__FUNCTION__, name_r.c_str() );
- return ::repo_create( _pool, name_r.c_str() );
- }
+ ::_Repo * _createRepo( const std::string & name_r );
/** Creating a new repo named \a name_r. */
- void _deleteRepo( ::_Repo * repo_r )
- {
- setDirty(__FUNCTION__, repo_r->name );
- ::repo_free( repo_r, /*reuseids*/false );
- eraseRepoInfo( repo_r );
- }
+ void _deleteRepo( ::_Repo * repo_r );
/** Adding solv file to a repo.
* Except for \c isSystemRepo_r, solvables of incompatible architecture
* are filtered out.
*/
- int _addSolv( ::_Repo * repo_r, FILE * file_r, bool isSystemRepo_r = false );
+ int _addSolv( ::_Repo * repo_r, FILE * file_r );
+
+ /** Adding helix file to a repo.
+ * Except for \c isSystemRepo_r, solvables of incompatible architecture
+ * are filtered out.
+ */
+ int _addHelix( ::_Repo * repo_r, FILE * file_r );
/** Adding Solvables to a repo. */
- detail::SolvableIdType _addSolvables( ::_Repo * repo_r, unsigned count_r )
- {
- setDirty(__FUNCTION__, repo_r->name );
- return ::repo_add_solvable_block( repo_r, count_r );
- }
+ detail::SolvableIdType _addSolvables( ::_Repo * repo_r, unsigned count_r );
//@}
+ /** Helper postprocessing the repo after adding solv or helix files. */
+ void _postRepoAdd( ::_Repo * repo_r );
+
public:
/** a \c valid \ref Solvable has a non NULL repo pointer. */
bool validSolvable( const ::_Solvable & slv_r ) const
/** */
const RepoInfo & repoInfo( RepoIdType id_r )
{ return _repoinfos[id_r]; }
- /** */
- void setRepoInfo( RepoIdType id_r, const RepoInfo & info_r )
- { _repoinfos[id_r] = info_r; }
+ /** Also adjust repo priority and subpriority accordingly. */
+ void setRepoInfo( RepoIdType id_r, const RepoInfo & info_r );
/** */
void eraseRepoInfo( RepoIdType id_r )
{ _repoinfos.erase( id_r ); }
public:
- const sat::detail::IdType * whatProvides( Capability cap_r )
+ /** Returns the id stored at \c offset_r in the internal
+ * whatprovidesdata array.
+ */
+ const sat::detail::IdType whatProvidesData( unsigned offset_r )
+ { return _pool->whatprovidesdata[offset_r]; }
+
+ /** Returns offset into the internal whatprovidesdata array.
+ * Use \ref whatProvidesData to get the stored Id.
+ */
+ unsigned whatProvides( Capability cap_r )
{ prepare(); return ::pool_whatprovides( _pool, cap_r.id() ); }
public:
/** \name Requested locales. */
//@{
+ void setTextLocale( const Locale & locale_r );
void setRequestedLocales( const LocaleSet & locales_r );
bool addRequestedLocale( const Locale & locale_r );
bool eraseRequestedLocale( const Locale & locale_r );
}
//@}
+ public:
+ /** \name Multiversion install. */
+ //@{
+ typedef IdStringSet MultiversionList;
+
+ const MultiversionList & multiversionList() const
+ {
+ if ( ! _multiversionListPtr )
+ multiversionListInit();
+ return *_multiversionListPtr;
+ }
+
+ bool isMultiversion( IdString ident_r ) const
+ {
+ const MultiversionList & l( multiversionList() );
+ return l.find( ident_r ) != l.end();
+ }
+ //@}
+
+ public:
+ /** \name Installed on behalf of a user request hint. */
+ //@{
+ /** Get ident list of all autoinstalled solvables. */
+ StringQueue autoInstalled() const
+ { return _autoinstalled; }
+
+ /** Set ident list of all autoinstalled solvables. */
+ void setAutoInstalled( const StringQueue & autoInstalled_r )
+ { _autoinstalled = autoInstalled_r; }
+
+ bool isOnSystemByUser( IdString ident_r ) const
+ { return !_autoinstalled.contains( ident_r.id() ); }
+ //@}
+
+ public:
+ /** accessor for etc/sysconfig/storage reading file on demand */
+ const std::set<std::string> & requiredFilesystems() const;
+
private:
/** sat-pool. */
::_Pool * _pool;
LocaleSet _requestedLocales;
mutable scoped_ptr<LocaleSet> _availableLocalesPtr;
mutable std::tr1::unordered_set<IdString> _locale2Solver;
+
+ /** */
+ void multiversionListInit() const;
+ mutable scoped_ptr<MultiversionList> _multiversionListPtr;
+
+ /** */
+ sat::StringQueue _autoinstalled;
+
+ /** filesystems mentioned in /etc/sysconfig/storage */
+ mutable scoped_ptr<std::set<std::string> > _requiredFilesystemsPtr;
};
///////////////////////////////////////////////////////////////////