be more selective when applying forceRebuild
This commit is contained in:
parent
d2951b0897
commit
bfb5cde112
@ -146,7 +146,8 @@ InstallTransaction::install( const ArgParser* parser )
|
||||
|
||||
// Set the update flag if the package is installed and out of date,
|
||||
// or if the user has forced a rebuild.
|
||||
// Proceed to the next target if package is installed and up to date.
|
||||
// Proceed to the next target if package is installed and up to date,
|
||||
// or is provided by an alias.
|
||||
if ( m_pkgDB->isInstalled( it->first, false ) ) {
|
||||
VersionComparator::COMP_RESULT
|
||||
rpDiff = VersionComparator::compareVersions(
|
||||
@ -156,18 +157,21 @@ InstallTransaction::install( const ArgParser* parser )
|
||||
parser->pkgmkArgs().find(forceRebuild) == string::npos ) {
|
||||
m_alreadyInstalledPackages.push_back( package->name() );
|
||||
continue;
|
||||
} else if ( (! m_config->preferHigher())
|
||||
|| parser->strictDiff()
|
||||
} else if ( (! m_config->preferHigher()) || parser->strictDiff()
|
||||
|| rpDiff == VersionComparator::GREATER
|
||||
|| ( parser->pkgmkArgs().find(forceRebuild) != string::npos &&
|
||||
find(parser->otherArgs().begin(), parser->otherArgs().end(),
|
||||
it->first) != parser->otherArgs().end() ) ) {
|
||||
|| ( parser->pkgmkArgs().find(forceRebuild)
|
||||
!= string::npos && find(parser->otherArgs().begin(),
|
||||
parser->otherArgs().end(), it->first)
|
||||
!= parser->otherArgs().end() ) ) {
|
||||
update = true;
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
} else if ( m_pkgDB->isInstalled( it->first, true ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
InstallTransaction::InstallResult result;
|
||||
InstallInfo info( package->hasReadme() );
|
||||
if ( parser->isTest() ) {
|
||||
@ -336,11 +340,16 @@ const {
|
||||
time_t pkgMtime = statData.st_mtime;
|
||||
time_t pfMtime = fstatData.st_mtime;
|
||||
if ( ( difftime(pkgMtime,pfMtime) > 0 ) and
|
||||
(parser->pkgmkArgs().find("-fr") == string::npos) ) {
|
||||
(parser->pkgmkArgs().find(" -f") == string::npos) ) {
|
||||
cmd = "/bin/true"; }
|
||||
}
|
||||
|
||||
string args = "-d " + parser->pkgmkArgs();
|
||||
if ( parser->pkgmkArgs().find(" -f") != string::npos &&
|
||||
find( parser->otherArgs().begin(), parser->otherArgs().end(),
|
||||
package->name() ) == parser->otherArgs().end() ) {
|
||||
StringHelper::replaceAll(args," -f","");
|
||||
}
|
||||
Process makeProc( cmd, args, fdlog );
|
||||
if ( makeProc.executeShell() ) {
|
||||
result = PKGMK_FAILURE;
|
||||
@ -572,6 +581,7 @@ void InstallTransaction::checkDependencies( bool greedy,
|
||||
Method to determine whether a soft dependency should be part of the transaction
|
||||
*/
|
||||
bool InstallTransaction::isRequired(const string &pname) {
|
||||
if ( m_pkgDB->isInstalled(pname) ) { return true; }
|
||||
list<pair<string, const Package*>>::iterator it = m_packages.begin();
|
||||
for ( ; it != m_packages.end(); ++it ) {
|
||||
if ( pname == it->first ) { return true; }
|
||||
@ -648,10 +658,15 @@ bool InstallTransaction::calcDependencies( )
|
||||
}
|
||||
}
|
||||
|
||||
if ( validPackages and (!calculateDependencies()) ) {
|
||||
cout << "Could not resolve dependencies for this transaction" << endl;
|
||||
if (!validPackages) {
|
||||
cout << "No valid packages for this transaction" << endl;
|
||||
return false;
|
||||
}
|
||||
return validPackages;
|
||||
if ( !calculateDependencies() ) {
|
||||
cout << "Cyclic dependencies detected" << endl;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
const list<string>& InstallTransaction::ignoredPackages() const
|
||||
|
@ -565,16 +565,19 @@ void PrtGet::install( bool dependencies ) {
|
||||
m_repo, m_pkgDB, m_config );
|
||||
bool depck = depTransaction.calcDependencies();
|
||||
|
||||
// early exit when dependencies cannot be satisfied
|
||||
// early exit if no valid targets,
|
||||
// or if a dependency cycle was created
|
||||
if (!depck) { return; }
|
||||
|
||||
// we have valid targets, so arrange them in the correct order
|
||||
list<string> deps = depTransaction.dependencies();
|
||||
|
||||
// append all missing ports at the end of the queue, for the
|
||||
// post-transaction summary (FS#1843). Exempt any ports that were
|
||||
// installed manually or from repos that have since been deactivated.
|
||||
const list< pair<string,string> >& depMissing = depTransaction.missing();
|
||||
list< pair<string,string> >::const_iterator it = depMissing.begin();
|
||||
|
||||
// ensure that missing ports are retained for the
|
||||
// post-transaction summary (FS#1843). Exempt any ports that were
|
||||
// installed manually or from repos that have since been deactivated.
|
||||
for (; it != depMissing.end(); ++it) {
|
||||
if (! m_pkgDB->isInstalled(it->first)) {
|
||||
deps.push_back(it->first);
|
||||
|
Loading…
Reference in New Issue
Block a user