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>
25#include <zypp/base/LogTools.h>
26#include <zypp/base/Gettext.h>
27#include <zypp/base/Exception.h>
28#include <zypp-core/base/UserRequestException>
51 struct FileConflictsCB
55 ,
_state( ::rpm_state_create( pool_r, ::pool_get_rootdir(pool_r) ), ::rpm_state_free )
60 void * ret = lookup( id_r );
68 if ( ! ret && sat::Solvable( id_r ).isKind<Package>() )
79 const sat::Queue & noFilelist()
const
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() );
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 )
std::unordered_set< sat::detail::IdType > _visited
AutoDispose< void * > _state
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.
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.
#define ZYPP_THROW(EXCPT)
Drops a logline and throws the Exception.