13 #include <solv/pool.h>
14 #include <solv/repo.h>
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>
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
int IdType
Generic Id type.
#define ZYPP_THROW(EXCPT)
Drops a logline and throws the Exception.
Result returned from ZYpp::commit.
::_Pool CPool
Wrapped libsolv C data type exposed as backdoor.
#define N_(MSG)
Just tag text for translation.
void commitFindFileConflicts(const ZYppCommitPolicy &policy_r, ZYppCommitResult &result_r)
Commit helper checking for file conflicts after download.
Libsolv queue representing file conflicts.
void remember(const Exception &old_r)
Store an other Exception as history.
int installedResult(Queue &result_r) const
Return all packages that would be installed after the transaction is run.
static Pool instance()
Singleton ctor.
Options and policies for ZYpp::commit.
Maintain [min,max] and counter (value) for progress counting.
Libsolv Id queue wrapper.
const sat::Transaction & transaction() const
The full transaction list.
AutoDispose< void * > _state