consolidate the tests in calcDependencies()

This commit is contained in:
John McQuah 2023-08-21 07:52:08 -04:00
parent 507afd9766
commit e67aa2cbd3
2 changed files with 7 additions and 12 deletions

View File

@ -656,12 +656,8 @@ bool InstallTransaction::calcDependencies( )
m_missingPackages.push_back( make_pair( it->first, string("") ) );
}
}
if ( !validPackages ) {
cout << "No valid packages in this transaction" << endl;
return false;
}
if ( !calculateDependencies() ) {
if ( validPackages and (!calculateDependencies()) ) {
cout << "Could not resolve dependencies for this transaction" << endl;
return false;
}

View File

@ -519,17 +519,16 @@ void PrtGet::listInstalled() {
l.erase(mit);
InstallTransaction trans( name, m_repo, m_pkgDB, m_config );
if ( trans.calcDependencies() ) {
const list<string>& depRef = trans.dependencies();
list<string>::const_iterator it = depRef.begin();
for (; it != depRef.end(); ++it) {
trans.calcDependencies();
const list<string>& depRef = trans.dependencies();
list<string>::const_iterator it = depRef.begin();
for (; it != depRef.end(); ++it) {
if (l.find(*it) != l.end()) {
cout << *it << endl;
l.erase(*it);
}
}
cout << name << endl;
} else { break; }
}
cout << name << endl;
}
} else {