15#include <solv/solvable.h> 
   16#include <solv/poolarch.h> 
   17#include <solv/repo_solv.h> 
   18#include <solv/repo_rpmdb.h> 
   19#include <solv/pool_fileconflicts.h> 
   22#include <unordered_set> 
   28#include <zypp-core/base/UserRequestException> 
   51      struct FileConflictsCB
 
   54        : _progress( progress_r )
 
   55        , _state( ::rpm_state_create( pool_r, ::pool_get_rootdir(pool_r) ), ::rpm_state_free )
 
   60          void * ret = lookup( id_r );
 
   64          if ( _visited.find( id_r ) == _visited.end() )
 
   67            _visited.insert( id_r );
 
   69              _noFilelist.push( id_r );
 
   79        const sat::Queue & noFilelist()
 const 
   80        { 
return _noFilelist; }
 
   83        { 
return (*
reinterpret_cast<FileConflictsCB*
>(cbdata_r))( pool_r, id_r ); }
 
   88          sat::Solvable solv( id_r );
 
   89          if ( solv.isSystem() )
 
   91            Solvable * s = solv.get();
 
   92            if ( ! s->repo->rpmdbid )
 
   97            return ::rpm_byrpmdbid( _state, rpmdbid );
 
  104            Pathname localfile( pkg->cachedLocation() );
 
  105            if ( localfile.empty() )
 
  107            AutoDispose<FILE*> fp( ::fopen( localfile.c_str(), 
"re" ), ::fclose );
 
  108            return ::rpm_byfp( _state, fp, localfile.c_str() );
 
  113        ProgressData & _progress;
 
  114        AutoDispose<void*> _state;
 
  115        std::unordered_set<sat::detail::IdType> _visited;
 
  116        sat::Queue _noFilelist;
 
  127      MIL << 
"Checking for file conflicts in " << newpkgs << 
" new packages..." << endl;
 
  134        if ( ! report->start( progress ) )
 
  139        auto sendProgress = [&]( 
const ProgressData & progress_r )->
bool {
 
  140          if ( ! report->progress( progress_r, cb.noFilelist() ) )
 
  147        progress.
sendTo( sendProgress );
 
  154                                    FINDFILECONFLICTS_USE_SOLVABLEFILELIST | FINDFILECONFLICTS_CHECK_DIRALIASING | FINDFILECONFLICTS_USE_ROOTDIR,
 
  155                                    &FileConflictsCB::invoke,
 
  160        (count?
WAR:
MIL) << 
"Found " << count << 
" file conflicts." << endl;
 
  161        if ( ! report->result( progress, cb.noFilelist(), conflicts ) )
 
  164      catch ( 
const AbortRequestException & e )
 
 
bool operator()(const zypp::Arch &lhs, const zypp::Arch &rhs) const
Default order for std::container based Arch::compare.
void remember(const Exception &old_r)
Store an other Exception as history.
Maintain [min,max] and counter (value) for progress counting.
void sendTo(const ReceiverFnc &fnc_r)
Set ReceiverFnc.
bool toMax()
Set counter value to current max value (unless no range).
void noSend()
Set no ReceiverFnc.
Options and policies for ZYpp::commit.
Result returned from ZYpp::commit.
const sat::Transaction & transaction() const
The full transaction list.
Libsolv queue representing file conflicts.
static Pool instance()
Singleton ctor.
Libsolv Id queue wrapper.
int installedResult(Queue &result_r) const
Return all packages that would be installed after the transaction is run.
void commitFindFileConflicts(const ZYppCommitPolicy &policy_r, ZYppCommitResult &result_r)
Commit helper checking for file conflicts after download.
std::enable_if< std::is_member_pointer< typenamestd::decay< Functor >::type >::value, typenamestd::result_of< Functor &&(Args &&...)>::type >::type invoke(Functor &&f, Args &&... args)
int IdType
Generic Id type.
::s_Pool CPool
Wrapped libsolv C data type exposed as backdoor.
Easy-to use interface to the ZYPP dependency resolver.
ResTraits< TRes >::PtrType make(const sat::Solvable &solvable_r)
Directly create a certain kind of ResObject from sat::Solvable.
bool isKind(const ResKind &val_r)
Convenient test for ResKinds.
#define ZYPP_THROW(EXCPT)
Drops a logline and throws the Exception.