be more selective when applying forceRebuild

This commit is contained in:
John McQuah 2023-09-14 21:11:45 -04:00
parent d2951b0897
commit a0da5f6f7b
2 changed files with 15 additions and 6 deletions

View File

@ -336,11 +336,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;
@ -648,8 +653,9 @@ bool InstallTransaction::calcDependencies( )
}
}
if ( validPackages and (!calculateDependencies()) ) {
if ( (!validPackages) or !calculateDependencies() ) {
cout << "Could not resolve dependencies for this transaction" << endl;
cout << " (dependency cycle or no valid packages)" << endl;
}
return validPackages;
}

View File

@ -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);