diff --git a/src/configuration.cpp b/src/configuration.cpp index 00e1be2..6cd1e7a 100644 --- a/src/configuration.cpp +++ b/src/configuration.cpp @@ -252,6 +252,6 @@ bool Configuration::useRegex() const bool Configuration::followSoftdeps() const { - return m_followSoftdeps; + return ( m_followSoftdeps || m_parser->followSoftdeps() ); } diff --git a/src/installtransaction.cpp b/src/installtransaction.cpp index f51daa3..26b0c96 100644 --- a/src/installtransaction.cpp +++ b/src/installtransaction.cpp @@ -481,7 +481,6 @@ bool InstallTransaction::calculateDependencies() return false; } - vector treeWalk; list< pair >::const_iterator it = m_packages.begin(); for ( ; it != m_packages.end(); ++it ) { @@ -527,8 +526,8 @@ void InstallTransaction::checkDependencies( bool greedy, if ( index == -1 ) { index = m_depList.size(); - if (( not greedy ) or ( m_pkgDB->isInstalled(package->name(),false) )) { - m_depList.push_back( package->name() ); + if ( (!greedy) or isRequired( package->name() ) ) { + m_depList.push_back( package->name() ); } } @@ -556,41 +555,31 @@ void InstallTransaction::checkDependencies( bool greedy, list::iterator it = deps.begin(); for ( ; it != deps.end(); ++it ) { string dep = *it; - if ( !dep.empty() ) { - string::size_type pos = dep.find_last_of( '/' ); - if ( pos != string::npos && (pos+1) < dep.length() ) { - dep = dep.substr( pos + 1 ); - } - const Package* p = m_repo->getPackage( dep ); - if ( p ) { - checkDependencies( greedy, p, index ); - } else { - m_missingPackages. - push_back( make_pair( dep, package->name() ) ); - } + if ( dep.empty() ) { continue; } + const Package* p = m_repo->getPackage( dep ); + if ( p ) { + checkDependencies( greedy, p, index ); + } else { + m_missingPackages. + push_back( make_pair( dep, package->name() ) ); } } } if ( (m_config->followSoftdeps()) and (!package->optionals().empty()) ) { - list softDeps; - split( package->optionals(), ',', softDeps ); - list::iterator it = softDeps.begin(); - for ( ; it != softDeps.end(); ++it ) { + list optionals; + split( package->optionals(), ',', optionals ); + list::iterator it = optionals.begin(); + for ( ; it != optionals.end(); ++it ) { string softdep = *it; - if ( !softdep.empty() ) { - string::size_type pos = softdep.find_last_of( '/' ); - if ( pos != string::npos && (pos+1) < softdep.length() ) { - softdep = softdep.substr( pos + 1 ); + if ( softdep.empty() ) { continue; } + if ( isRequired(softdep) ) { + const Package* p = m_repo->getPackage( softdep ); + if ( p ) { + checkDependencies( true, p, index ); + } else { + m_missingPackages. + push_back( make_pair( softdep, package->name() ) ); } - if ( m_pkgDB->isInstalled(softdep, false) or isRequested(softdep) ) { - const Package* p = m_repo->getPackage( softdep ); - if ( p ) { - checkDependencies( true, p, index ); - } else { - m_missingPackages. - push_back( make_pair( softdep, package->name() ) ); - } - } } } } @@ -601,12 +590,13 @@ void InstallTransaction::checkDependencies( bool greedy, } /*! - Method to determine whether a package was passed on the command line + Method to determine whether a soft dependency should be part of the transaction */ -bool InstallTransaction::isRequested(const string pname) { +bool InstallTransaction::isRequired(const string &pname) { + if ( m_pkgDB->isInstalled(pname,false) ) { return true; } list< pair >::iterator it = m_packages.begin(); for ( ; it != m_packages.end(); ++it ) { - if ( it->first == pname ) { return true; } + if ( pname == it->first ) { return true; } } return false; } diff --git a/src/installtransaction.h b/src/installtransaction.h index bc246c7..c848578 100644 --- a/src/installtransaction.h +++ b/src/installtransaction.h @@ -109,7 +109,7 @@ private: const ArgParser* parser, bool update, InstallInfo& info ) const; - bool isRequested(const string pname); + bool isRequired(const string &pname); static string getPkgmkSetting(const string& setting); static string getPkgmkSettingFromFile(const string& setting,