Pool::MultiversionIterator Pool::multiversionEnd() const { return myPool().multiversionList().end(); }
bool Pool::isMultiversion( IdString ident_r ) const { return myPool().isMultiversion( ident_r ); }
- bool Pool::onSystemByUserEmpty() const { return myPool().onSystemByUserList().empty(); }
- size_t Pool::onSystemByUserSize() const { return myPool().onSystemByUserList().size(); }
- Pool::OnSystemByUserIterator Pool::onSystemByUserBegin() const { return myPool().onSystemByUserList().begin(); }
- Pool::OnSystemByUserIterator Pool::onSystemByUserEnd() const { return myPool().onSystemByUserList().end(); }
- bool Pool::isOnSystemByUser( IdString ident_r ) const { return myPool().isOnSystemByUser( ident_r ); }
+ Queue Pool::autoInstalled() const { return myPool().autoInstalled(); }
+ void Pool::setAutoInstalled( const Queue & autoInstalled_r ){ myPool().setAutoInstalled( autoInstalled_r ); }
/******************************************************************
**
#include "zypp/sat/detail/PoolMember.h"
#include "zypp/Repository.h"
#include "zypp/sat/WhatProvides.h"
+#include "zypp/sat/Queue.h"
///////////////////////////////////////////////////////////////////
namespace zypp
//@}
public:
- /** \name Installed on behalf of a user request hint.
- * This is a hint guessed by evaluating an available install history.
- */
+ /** \name Autoinstalled */
//@{
- typedef IdStringSet::const_iterator OnSystemByUserIterator;
-
- bool onSystemByUserEmpty() const;
- size_t onSystemByUserSize() const;
- OnSystemByUserIterator onSystemByUserBegin() const;
- OnSystemByUserIterator onSystemByUserEnd() const;
-
- bool isOnSystemByUser( IdString ident_r ) const;
+ /** Get ident list of all autoinstalled solvables. */
+ Queue autoInstalled() const;
+ /** Set ident list of all autoinstalled solvables. */
+ void setAutoInstalled( const Queue & autoInstalled_r );
//@}
public:
void PoolImpl::_deleteRepo( ::_Repo * repo_r )
{
setDirty(__FUNCTION__, repo_r->name );
- ::repo_free( repo_r, /*reuseids*/false );
- eraseRepoInfo( repo_r );
if ( isSystemRepo( repo_r ) )
- {
- // systemRepo added
- _onSystemByUserListPtr.reset(); // re-evaluate
- }
+ _autoinstalled.clear();
+ eraseRepoInfo( repo_r );
+ ::repo_free( repo_r, /*reuseids*/false );
}
int PoolImpl::_addSolv( ::_Repo * repo_r, FILE * file_r )
blockBegin = blockSize = 0;
}
}
- else
- {
- // systemRepo added
- _onSystemByUserListPtr.reset(); // re-evaluate
- }
}
detail::SolvableIdType PoolImpl::_addSolvables( ::_Repo * repo_r, unsigned count_r )
}
}
- void PoolImpl::onSystemByUserListInit() const
- {
- _onSystemByUserListPtr.reset( new OnSystemByUserList );
- OnSystemByUserList & onSystemByUserList( *_onSystemByUserListPtr );
-
- Pathname root( ZConfig::instance().systemRoot() );
- if ( root.empty() )
- {
- MIL << "Target not initialized." << endl;
- return;
- }
- PathInfo pi( root / ZConfig::instance().historyLogFile() );
- MIL << "onSystemByUserList from history: " << pi << endl;
- if ( ! pi.isFile() )
- return;
-
- // go and parse it: 'who' must constain an '@', then it was installed by user request.
- // 2009-09-29 07:25:19|install|lirc-remotes|0.8.5-3.2|x86_64|root@opensuse|InstallationImage|a204211eb0...
- std::ifstream infile( pi.path().c_str() );
- for( iostr::EachLine in( infile ); in; in.next() )
- {
- const char * ch( (*in).c_str() );
- // start with year
- if ( *ch < '1' || '9' < *ch )
- continue;
- const char * sep1 = ::strchr( ch, '|' ); // | after date
- if ( !sep1 )
- continue;
- ++sep1;
- // if logs an install or delete
- bool installs = true;
- if ( ::strncmp( sep1, "install|", 8 ) )
- {
- if ( ::strncmp( sep1, "remove |", 8 ) )
- continue; // no install and no remove
- else
- installs = false; // remove
- }
- sep1 += 8; // | after what
- // get the package name
- const char * sep2 = ::strchr( sep1, '|' ); // | after name
- if ( !sep2 || sep1 == sep2 )
- continue;
- (*in)[sep2-ch] = '\0';
- IdString pkg( sep1 );
- // we're done, if a delete
- if ( !installs )
- {
- onSystemByUserList.erase( pkg );
- continue;
- }
- // now guess whether user installed or not (3rd next field contains 'user@host')
- if ( (sep1 = ::strchr( sep2+1, '|' )) // | after version
- && (sep1 = ::strchr( sep1+1, '|' )) // | after arch
- && (sep2 = ::strchr( sep1+1, '|' )) ) // | after who
- {
- (*in)[sep2-ch] = '\0';
- if ( ::strchr( sep1+1, '@' ) )
- {
- // by user
- onSystemByUserList.insert( pkg );
- continue;
- }
- }
- }
- MIL << "onSystemByUserList found: " << onSystemByUserList.size() << endl;
- }
-
const std::set<std::string> & PoolImpl::requiredFilesystems() const
{
if ( ! _requiredFilesystemsPtr )
#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"
public:
/** \name Installed on behalf of a user request hint. */
//@{
- typedef IdStringSet OnSystemByUserList;
+ /** Get ident list of all autoinstalled solvables. */
+ StringQueue autoInstalled() const
+ { return _autoinstalled; }
- const OnSystemByUserList & onSystemByUserList() const
- {
- if ( ! _onSystemByUserListPtr )
- onSystemByUserListInit();
- return *_onSystemByUserListPtr;
- }
+ /** Set ident list of all autoinstalled solvables. */
+ void setAutoInstalled( const StringQueue & autoInstalled_r )
+ { _autoinstalled = autoInstalled_r; }
bool isOnSystemByUser( IdString ident_r ) const
- {
- const OnSystemByUserList & l( onSystemByUserList() );
- return l.find( ident_r ) != l.end();
- }
+ { return !_autoinstalled.contains( ident_r.id() ); }
//@}
public:
mutable scoped_ptr<MultiversionList> _multiversionListPtr;
/** */
- void onSystemByUserListInit() const;
- mutable scoped_ptr<OnSystemByUserList> _onSystemByUserListPtr;
+ sat::StringQueue _autoinstalled;
/** filesystems mentioned in /etc/sysconfig/storage */
mutable scoped_ptr<std::set<std::string> > _requiredFilesystemsPtr;