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,
|
// Set the update flag if the package is installed and out of date,
|
||||||
// or if the user has forced a rebuild.
|
// 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 ) ) {
|
if ( m_pkgDB->isInstalled( it->first, false ) ) {
|
||||||
VersionComparator::COMP_RESULT
|
VersionComparator::COMP_RESULT
|
||||||
rpDiff = VersionComparator::compareVersions(
|
rpDiff = VersionComparator::compareVersions(
|
||||||
@ -156,18 +157,21 @@ InstallTransaction::install( const ArgParser* parser )
|
|||||||
parser->pkgmkArgs().find(forceRebuild) == string::npos ) {
|
parser->pkgmkArgs().find(forceRebuild) == string::npos ) {
|
||||||
m_alreadyInstalledPackages.push_back( package->name() );
|
m_alreadyInstalledPackages.push_back( package->name() );
|
||||||
continue;
|
continue;
|
||||||
} else if ( (! m_config->preferHigher())
|
} else if ( (! m_config->preferHigher()) || parser->strictDiff()
|
||||||
|| parser->strictDiff()
|
|| rpDiff == VersionComparator::GREATER
|
||||||
|| rpDiff == VersionComparator::GREATER
|
|| ( parser->pkgmkArgs().find(forceRebuild)
|
||||||
|| ( parser->pkgmkArgs().find(forceRebuild) != string::npos &&
|
!= string::npos && find(parser->otherArgs().begin(),
|
||||||
find(parser->otherArgs().begin(), parser->otherArgs().end(),
|
parser->otherArgs().end(), it->first)
|
||||||
it->first) != parser->otherArgs().end() ) ) {
|
!= parser->otherArgs().end() ) ) {
|
||||||
update = true;
|
update = true;
|
||||||
} else {
|
} else {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
} else if ( m_pkgDB->isInstalled( it->first, true ) ) {
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
InstallTransaction::InstallResult result;
|
InstallTransaction::InstallResult result;
|
||||||
InstallInfo info( package->hasReadme() );
|
InstallInfo info( package->hasReadme() );
|
||||||
if ( parser->isTest() ) {
|
if ( parser->isTest() ) {
|
||||||
@ -336,11 +340,16 @@ const {
|
|||||||
time_t pkgMtime = statData.st_mtime;
|
time_t pkgMtime = statData.st_mtime;
|
||||||
time_t pfMtime = fstatData.st_mtime;
|
time_t pfMtime = fstatData.st_mtime;
|
||||||
if ( ( difftime(pkgMtime,pfMtime) > 0 ) and
|
if ( ( difftime(pkgMtime,pfMtime) > 0 ) and
|
||||||
(parser->pkgmkArgs().find("-fr") == string::npos) ) {
|
(parser->pkgmkArgs().find(" -f") == string::npos) ) {
|
||||||
cmd = "/bin/true"; }
|
cmd = "/bin/true"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
string args = "-d " + parser->pkgmkArgs();
|
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 );
|
Process makeProc( cmd, args, fdlog );
|
||||||
if ( makeProc.executeShell() ) {
|
if ( makeProc.executeShell() ) {
|
||||||
result = PKGMK_FAILURE;
|
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
|
Method to determine whether a soft dependency should be part of the transaction
|
||||||
*/
|
*/
|
||||||
bool InstallTransaction::isRequired(const string &pname) {
|
bool InstallTransaction::isRequired(const string &pname) {
|
||||||
|
if ( m_pkgDB->isInstalled(pname) ) { return true; }
|
||||||
list<pair<string, const Package*>>::iterator it = m_packages.begin();
|
list<pair<string, const Package*>>::iterator it = m_packages.begin();
|
||||||
for ( ; it != m_packages.end(); ++it ) {
|
for ( ; it != m_packages.end(); ++it ) {
|
||||||
if ( pname == it->first ) { return true; }
|
if ( pname == it->first ) { return true; }
|
||||||
@ -648,10 +658,15 @@ bool InstallTransaction::calcDependencies( )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( validPackages and (!calculateDependencies()) ) {
|
if (!validPackages) {
|
||||||
cout << "Could not resolve dependencies for this transaction" << endl;
|
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
|
const list<string>& InstallTransaction::ignoredPackages() const
|
||||||
|
@ -565,16 +565,19 @@ void PrtGet::install( bool dependencies ) {
|
|||||||
m_repo, m_pkgDB, m_config );
|
m_repo, m_pkgDB, m_config );
|
||||||
bool depck = depTransaction.calcDependencies();
|
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; }
|
if (!depck) { return; }
|
||||||
|
|
||||||
|
// we have valid targets, so arrange them in the correct order
|
||||||
list<string> deps = depTransaction.dependencies();
|
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();
|
const list< pair<string,string> >& depMissing = depTransaction.missing();
|
||||||
list< pair<string,string> >::const_iterator it = depMissing.begin();
|
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) {
|
for (; it != depMissing.end(); ++it) {
|
||||||
if (! m_pkgDB->isInstalled(it->first)) {
|
if (! m_pkgDB->isInstalled(it->first)) {
|
||||||
deps.push_back(it->first);
|
deps.push_back(it->first);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user