[zypp-commit] r10597 - in /trunk/libzypp: ./ zypp/ zypp/solver/detail/
Author: schubi2 Date: Wed Jul 16 15:46:33 2008 New Revision: 10597 URL: http://svn.opensuse.org/viewcvs/zypp?rev=10597&view=rev Log: allowing installation of packages with the same name; defined in zypp.conf Modified: trunk/libzypp/zypp.conf trunk/libzypp/zypp/ResObject.cc trunk/libzypp/zypp/Resolver.cc trunk/libzypp/zypp/Resolver.h trunk/libzypp/zypp/ZConfig.cc trunk/libzypp/zypp/ZConfig.h trunk/libzypp/zypp/solver/detail/Resolver.cc trunk/libzypp/zypp/solver/detail/Resolver.h trunk/libzypp/zypp/solver/detail/SATResolver.cc trunk/libzypp/zypp/solver/detail/SATResolver.h Modified: trunk/libzypp/zypp.conf URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp.conf?rev=10597&r1=10596&r2=10597&view=diff ============================================================================== --- trunk/libzypp/zypp.conf (original) +++ trunk/libzypp/zypp.conf Wed Jul 16 15:46:33 2008 @@ -194,6 +194,11 @@ # solver.checkSystemFile = /etc/zypp/systemCheck ## +## Packages which are parallel installable. +## +# parallelInstallable = kernel-default,kernel-smp + +## ## Path to locks file. If not exist then is create. ## In this file is saved also UI locks. ## Modified: trunk/libzypp/zypp/ResObject.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/ResObject.cc?rev=10597&r1=10596&r2=10597&view=diff ============================================================================== --- trunk/libzypp/zypp/ResObject.cc (original) +++ trunk/libzypp/zypp/ResObject.cc Wed Jul 16 15:46:33 2008 @@ -16,6 +16,8 @@ #include "zypp/sat/Solvable.h" #include "zypp/Repository.h" #include "zypp/RepoInfo.h" +#include "zypp/ZConfig.h" +#include "zypp/IdString.h" using namespace zypp; using namespace std; @@ -83,9 +85,13 @@ unsigned ResObject::mediaNr() const { return lookupNumAttribute( sat::SolvAttr::medianr ); } -#warning DUMMY installOnly bool ResObject::installOnly() const - { return false; } + { + std::set<IdString> parallel = ZConfig::instance().parallelInstallable(); + if (parallel.find(ident()) != parallel.end()) + return true; + return false; + } Date ResObject::buildtime() const { return Date( lookupNumAttribute( sat::SolvAttr::buildtime ) ); } Modified: trunk/libzypp/zypp/Resolver.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/Resolver.cc?rev=10597&r1=10596&r2=10597&view=diff ============================================================================== --- trunk/libzypp/zypp/Resolver.cc (original) +++ trunk/libzypp/zypp/Resolver.cc Wed Jul 16 15:46:33 2008 @@ -96,26 +96,7 @@ else return _pimpl->onlyRequires(); } - - void Resolver::addNoObsoletesCapability (const Capability & capability) - { _pimpl->addNoObsoletesCapability (capability); } - void Resolver::removeNoObsoletesCapability (const Capability & capability) - { _pimpl->removeNoObsoletesCapability (capability); } - CapabilitySet Resolver::noObsoletesCapability() - { return _pimpl->noObsoletesCapability(); } - void Resolver::addNoObsoletesItem (const PoolItem & item) - { _pimpl->addNoObsoletesItem (item); } - void Resolver::removeNoObsoletesItem (const PoolItem & item) - { _pimpl->removeNoObsoletesItem (item); } - solver::detail::PoolItemSet Resolver::noObsoletesItem() - { return _pimpl->noObsoletesItem(); } - void Resolver::addNoObsoletesName (const std::string & name) - { _pimpl->addNoObsoletesName (name); } - void Resolver::removeNoObsoletesName (const std::string & name) - { _pimpl->removeNoObsoletesName (name); } - solver::detail::ObsoleteStrings Resolver::noObsoletesString () - { return _pimpl->noObsoletesString (); } - + void Resolver::addRequire (const Capability & capability) { _pimpl->addExtraRequire( capability ); } void Resolver::addConflict (const Capability & capability) Modified: trunk/libzypp/zypp/Resolver.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/Resolver.h?rev=10597&r1=10596&r2=10597&view=diff ============================================================================== --- trunk/libzypp/zypp/Resolver.h (original) +++ trunk/libzypp/zypp/Resolver.h Wed Jul 16 15:46:33 2008 @@ -180,25 +180,6 @@ bool onlyRequires(); /** - * Ignore Obsoletes. This is used for installing more than - * one pacakges with the same name but different versions. - * Often needed by kernels. - **/ - /* via capability who provides it */ - void addNoObsoletesCapability (const Capability & capability); - void removeNoObsoletesCapability (const Capability & capability); - CapabilitySet noObsoletesCapability(); - /* via poolItem */ - void addNoObsoletesItem (const PoolItem & item); - void removeNoObsoletesItem (const PoolItem & item); - solver::detail::PoolItemSet noObsoletesItem(); - - // via package name - void addNoObsoletesName (const std::string & name); - void removeNoObsoletesName (const std::string & name); - solver::detail::ObsoleteStrings noObsoletesString (); - - /** * Adding additional requirement * */ Modified: trunk/libzypp/zypp/ZConfig.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/ZConfig.cc?rev=10597&r1=10596&r2=10597&view=diff ============================================================================== --- trunk/libzypp/zypp/ZConfig.cc (original) +++ trunk/libzypp/zypp/ZConfig.cc Wed Jul 16 15:46:33 2008 @@ -248,6 +248,15 @@ else if ( entry == "solver.checkSystemFile" ) { solver_checkSystemFile = Pathname(value); + } + else if ( entry == "parallelInstallable" ) + { + std::list<std::string> parallel; + str::split( value, back_inserter(parallel), ", \t" ); + for ( std::list<string>::const_iterator it = parallel.begin(); + it != parallel.end(); it++) { + parallelInstallable.insert (IdString(*it)); + } } else if ( entry == "locksfile.path" ) { @@ -324,7 +333,9 @@ bool download_use_deltarpm; bool solver_onlyRequires; - Pathname solver_checkSystemFile; + Pathname solver_checkSystemFile; + + std::set<IdString> parallelInstallable; bool apply_locks_file; @@ -506,7 +517,16 @@ Pathname ZConfig::solver_checkSystemFile() const { return _pimpl->solver_checkSystemFile; } + + + std::set<IdString> ZConfig::parallelInstallable() const + { return _pimpl->parallelInstallable; } + + void ZConfig::addParallelInstallable(std::string &name) + { _pimpl->parallelInstallable.insert(IdString(name)); } + bool ZConfig::removeParallelInstallable(std::string &name) + { return _pimpl->parallelInstallable.erase(IdString(name)); } bool ZConfig::apply_locks_file() const { Modified: trunk/libzypp/zypp/ZConfig.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/ZConfig.h?rev=10597&r1=10596&r2=10597&view=diff ============================================================================== --- trunk/libzypp/zypp/ZConfig.h (original) +++ trunk/libzypp/zypp/ZConfig.h Wed Jul 16 15:46:33 2008 @@ -13,6 +13,8 @@ #define ZYPP_ZCONFIG_H #include <iosfwd> +#include <set> +#include <string> #include "zypp/base/Deprecated.h" @@ -22,6 +24,7 @@ #include "zypp/Arch.h" #include "zypp/Locale.h" #include "zypp/Pathname.h" +#include "zypp/IdString.h" /////////////////////////////////////////////////////////////////// namespace zypp @@ -181,6 +184,14 @@ Pathname solver_checkSystemFile() const; /** + * Packages which can be installed parallel. + * Returning a set of package names (IdString) + */ + std::set<IdString> parallelInstallable() const; + void addParallelInstallable(std::string &name); + bool removeParallelInstallable(std::string &name); + + /** * Path where zypp can find or create lock file (configPath()/locks) * \ingroup g_ZC_CONFIGFILES */ Modified: trunk/libzypp/zypp/solver/detail/Resolver.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/solver/detail/Resolver.cc?rev=10597&r1=10596&r2=10597&view=diff ============================================================================== --- trunk/libzypp/zypp/solver/detail/Resolver.cc (original) +++ trunk/libzypp/zypp/solver/detail/Resolver.cc Wed Jul 16 15:46:33 2008 @@ -242,11 +242,6 @@ // Regard dependencies of the item weak onl _addWeak.clear(); - // Ignore Obsoletes - _noObsoletesCapability.clear(); - _noObsoletesItem.clear(); - _noObsoletesString.clear(); - // Additional QueueItems which has to be regarded by the solver _removed_queue_items.clear(); _added_queue_items.clear(); @@ -314,9 +309,7 @@ Resolver::resolvePool() { solverInit(); - return _satResolver->resolvePool(_extra_requires, _extra_conflicts, _addWeak, - _noObsoletesCapability, _noObsoletesItem, _noObsoletesString - ); + return _satResolver->resolvePool(_extra_requires, _extra_conflicts, _addWeak); } bool @@ -356,8 +349,7 @@ _removed_queue_items.clear(); _added_queue_items.clear(); - return _satResolver->resolveQueue(queue, _addWeak, - _noObsoletesCapability, _noObsoletesItem, _noObsoletesString); + return _satResolver->resolveQueue(queue, _addWeak); } Modified: trunk/libzypp/zypp/solver/detail/Resolver.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/solver/detail/Resolver.h?rev=10597&r1=10596&r2=10597&view=diff ============================================================================== --- trunk/libzypp/zypp/solver/detail/Resolver.h (original) +++ trunk/libzypp/zypp/solver/detail/Resolver.h Wed Jul 16 15:46:33 2008 @@ -88,8 +88,6 @@ // // CLASS NAME : Resolver -typedef std::set<std::string> ObsoleteStrings; - class Resolver : public base::ReferenceCounted, private base::NonCopyable { private: @@ -131,15 +129,8 @@ ItemCapKindMap _installs; ItemCapKindMap _satifiedByInstalled; ItemCapKindMap _installedSatisfied; - - - // Ignore Obsoletes - CapabilitySet _noObsoletesCapability; - PoolItemSet _noObsoletesItem; - ObsoleteStrings _noObsoletesString; // helpers - bool doesObsoleteCapability (PoolItem candidate, const Capability & cap); bool doesObsoleteItem (PoolItem candidate, PoolItem installed); void collectResolverInfo (void); @@ -166,32 +157,6 @@ ResPool pool (void) const; void setPool (const ResPool & pool) { _pool = pool; } - - // Ignore Obsoletes. This is used for installing more than - // one pacakges with the same name but different versions. - // Often needed by kernels. - - // via capability who provides it - void addNoObsoletesCapability (const Capability & capability) - { _noObsoletesCapability.insert (capability); } - void removeNoObsoletesCapability (const Capability & capability) - { _noObsoletesCapability.erase (capability); } - CapabilitySet noObsoletesCapability() { return _noObsoletesCapability;} - - // via poolItem - void addNoObsoletesItem (const PoolItem & item) - { _noObsoletesItem.insert (item); } - void removeNoObsoletesItem (const PoolItem & item) - { _noObsoletesItem.erase (item); } - PoolItemSet noObsoletesItem() { return _noObsoletesItem; } - - // via package name - void addNoObsoletesName (const std::string & name) - { _noObsoletesString.insert (name); } - void removeNoObsoletesName (const std::string & name) - { _noObsoletesString.erase (name); } - ObsoleteStrings noObsoletesString () { return _noObsoletesString; } - void addExtraRequire (const Capability & capability); void removeExtraRequire (const Capability & capability); void addExtraConflict (const Capability & capability); Modified: trunk/libzypp/zypp/solver/detail/SATResolver.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/solver/detail/SATResolver.cc?rev=10597&r1=10596&r2=10597&view=diff ============================================================================== --- trunk/libzypp/zypp/solver/detail/SATResolver.cc (original) +++ trunk/libzypp/zypp/solver/detail/SATResolver.cc Wed Jul 16 15:46:33 2008 @@ -251,6 +251,13 @@ } void +SATResolver::addPoolItemParallelInstall(PoolItem item) +{ + _items_parallel_install.push_back (item); + _items_parallel_install.unique (); +} + +void SATResolver::addPoolItemToKeep (PoolItem item) { resetItemTransaction (item); @@ -347,6 +354,10 @@ bool operator()( PoolItem item ) // only transacts() items go here { + if (item->installOnly()) { + resolver. addPoolItemParallelInstall(item); + } + ResStatus status = item.status(); bool by_solver = (status.isBySolver() || status.isByApplLow()); @@ -369,7 +380,7 @@ else if (status.isKept() && !by_solver) { resolver.addPoolItemToKeep (item); - } + } return true; } @@ -579,10 +590,7 @@ void -SATResolver::solverInit(const PoolItemList & weakItems, - const CapabilitySet & noObsoletesCapability, - const PoolItemSet & noObsoletesItem, - const ObsoleteStrings & noObsoletesString) +SATResolver::solverInit(const PoolItemList & weakItems) { SATCollectTransact info (*this); @@ -599,7 +607,8 @@ _items_to_install.clear(); _items_to_remove.clear(); _items_to_lock.clear(); - _items_to_keep.clear(); + _items_to_keep.clear(); + _items_parallel_install.clear(); invokeOnEach ( _pool.begin(), _pool.end(), functor::functorRef<bool,PoolItem>(info) ); @@ -614,13 +623,7 @@ queue_push( &(_jobQueue), id ); } - for (CapabilitySet::const_iterator iter = noObsoletesCapability.begin(); iter != noObsoletesCapability.end(); iter++) { - queue_push( &(_jobQueue), SOLVER_NOOBSOLETES_SOLVABLE_PROVIDES ); - queue_push( &(_jobQueue), iter->id() ); - MIL << "Ignore Obsoletes of provided capability: " << *iter << endl; - } - - for (PoolItemSet::iterator it = noObsoletesItem.begin(); it != noObsoletesItem.end(); ++it) { + for (PoolItemList::iterator it = _items_parallel_install.begin(); it != _items_parallel_install.end(); ++it) { Id id = (*it)->satSolvable().id(); if (id == ID_NULL) { ERR << "Item " << *it << " not found" << endl; @@ -630,13 +633,6 @@ queue_push( &(_jobQueue), id ); } } - - for (ObsoleteStrings::iterator it = noObsoletesString.begin(); it != noObsoletesString.end(); ++it) { - MIL << "Ignore Obsoletes of name: " << *it << endl; - ::Id id = IdString(*it).id(); - queue_push( &(_jobQueue), SOLVER_NOOBSOLETES_SOLVABLE_NAME ); - queue_push( &(_jobQueue), id ); - } } void @@ -652,18 +648,12 @@ bool SATResolver::resolvePool(const CapabilitySet & requires_caps, const CapabilitySet & conflict_caps, - const PoolItemList & weakItems, - const CapabilitySet & noObsoletesCapability, - const PoolItemSet & noObsoletesItem, - const ObsoleteStrings & noObsoletesString) + const PoolItemList & weakItems) { MIL << "SATResolver::resolvePool()" << endl; // initialize - solverInit(weakItems, - noObsoletesCapability, - noObsoletesItem, - noObsoletesString); + solverInit(weakItems); for (PoolItemList::const_iterator iter = _items_to_install.begin(); iter != _items_to_install.end(); iter++) { Id id = (*iter)->satSolvable().id(); @@ -714,18 +704,12 @@ bool SATResolver::resolveQueue(const SolverQueueItemList &requestQueue, - const PoolItemList & weakItems, - const CapabilitySet & noObsoletesCapability, - const PoolItemSet & noObsoletesItem, - const ObsoleteStrings & noObsoletesString) + const PoolItemList & weakItems) { MIL << "SATResolver::resolvQueue()" << endl; // initialize - solverInit(weakItems, - noObsoletesCapability, - noObsoletesItem, - noObsoletesString); + solverInit(weakItems); // generate solver queue for (SolverQueueItemList::const_iterator iter = requestQueue.begin(); iter != requestQueue.end(); iter++) { @@ -773,10 +757,7 @@ MIL << "SATResolver::doUpdate()" << endl; // initialize - solverInit(PoolItemList(), - CapabilitySet(), - PoolItemSet(), - ObsoleteStrings()); + solverInit(PoolItemList()); // set requirements for a running system setSystemRequirements(); Modified: trunk/libzypp/zypp/solver/detail/SATResolver.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/solver/detail/SATResolver.h?rev=10597&r1=10596&r2=10597&view=diff ============================================================================== --- trunk/libzypp/zypp/solver/detail/SATResolver.h (original) +++ trunk/libzypp/zypp/solver/detail/SATResolver.h Wed Jul 16 15:46:33 2008 @@ -70,6 +70,7 @@ PoolItemList _items_to_remove; PoolItemList _items_to_lock; PoolItemList _items_to_keep; + PoolItemList _items_parallel_install; // solve results PoolItemList _result_items_to_install; @@ -92,10 +93,7 @@ void resetItemTransaction (PoolItem item); // Create a SAT solver and reset solver selection in the pool (Collecting - void solverInit(const PoolItemList & weakItems, - const CapabilitySet & noObsoletesCapability, - const PoolItemSet & noObsoletesItem, - const ObsoleteStrings & noObsoletesString); + void solverInit(const PoolItemList & weakItems); // common solver run with the _jobQueue; Save results back to pool bool solving(); // cleanup solver @@ -122,17 +120,11 @@ // solver run with pool selected items bool resolvePool(const CapabilitySet & requires_caps, const CapabilitySet & conflict_caps, - const PoolItemList & weakItems, - const CapabilitySet & noObsoletesCapability, - const PoolItemSet & noObsoletesItem, - const ObsoleteStrings & noObsoletesString + const PoolItemList & weakItems ); // solver run with the given request queue bool resolveQueue(const SolverQueueItemList &requestQueue, - const PoolItemList & weakItems, - const CapabilitySet & noObsoletesCapability, - const PoolItemSet & noObsoletesItem, - const ObsoleteStrings & noObsoletesString + const PoolItemList & weakItems ); // searching for new packages void doUpdate(); @@ -144,7 +136,9 @@ void addPoolItemsToInstallFromList (PoolItemList & rl); void addPoolItemToLock (PoolItem item); - void addPoolItemToKeep (PoolItem item); + void addPoolItemToKeep (PoolItem item); + + void addPoolItemParallelInstall (PoolItem item); void addPoolItemToRemove (PoolItem item); void addPoolItemsToRemoveFromList (PoolItemList & rl); -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org
participants (1)
-
schubi2@svn.opensuse.org