Author: mlandres
Date: Mon Jan 28 19:56:41 2008
New Revision: 8381
URL: http://svn.opensuse.org/viewcvs/zypp?rev=8381&view=rev
Log:
removed deprecated Resolvable methods
Modified:
branches/tmp/ma/jump_sat/libzypp/zypp/NVRAD.cc
branches/tmp/ma/jump_sat/libzypp/zypp/ResPool.h
branches/tmp/ma/jump_sat/libzypp/zypp/Resolvable.h
branches/tmp/ma/jump_sat/libzypp/zypp/solver/detail/InstallOrder.cc
branches/tmp/ma/jump_sat/libzypp/zypp/solver/detail/SolutionAction.cc
branches/tmp/ma/jump_sat/libzypp/zypp/solver/detail/Testcase.cc
branches/tmp/ma/jump_sat/libzypp/zypp/target/store/XMLFilesBackend.cc
branches/tmp/ma/jump_sat/libzypp/zypp/target/store/serialize.cc
Modified: branches/tmp/ma/jump_sat/libzypp/zypp/NVRAD.cc
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/ma/jump_sat/libzypp/zypp/NVRAD.cc?rev=8381&r1=8380&r2=8381&view=diff
==============================================================================
--- branches/tmp/ma/jump_sat/libzypp/zypp/NVRAD.cc (original)
+++ branches/tmp/ma/jump_sat/libzypp/zypp/NVRAD.cc Mon Jan 28 19:56:41 2008
@@ -17,20 +17,41 @@
namespace zypp
{ /////////////////////////////////////////////////////////////////
+ namespace
+ {
+ void copycaps( CapabilitySet & lhs, const Capabilities & rhs )
+ {
+ if ( rhs.empty() )
+ return;
+ CapabilitySet( rhs.begin(), rhs.end() ).swap( lhs );
+ }
+ }
+
NVRAD::NVRAD( Resolvable::constPtr res_r )
{
if ( res_r )
- {
- *this = NVRAD( res_r->name(), res_r->edition(), res_r->arch(),
- res_r->deps() );
- }
+ {
+ *this = NVRAD( res_r->name(), res_r->edition(), res_r->arch() );
+#define OUTS(X) copycaps( operator[](X), res_r->dep(X) )
+ OUTS( Dep::PROVIDES );
+ OUTS( Dep::PREREQUIRES );
+ OUTS( Dep::CONFLICTS );
+ OUTS( Dep::OBSOLETES );
+ OUTS( Dep::FRESHENS );
+ OUTS( Dep::REQUIRES );
+ OUTS( Dep::RECOMMENDS );
+ OUTS( Dep::ENHANCES );
+ OUTS( Dep::SUPPLEMENTS );
+ OUTS( Dep::SUGGESTS );
+#undef OUTS
+ }
}
std::ostream & operator<<( std::ostream & str, const NVRAD & obj )
{
return str << obj.name << '-' << obj.edition << '.' << obj.arch;
}
-
+
/////////////////////////////////////////////////////////////////
} // namespace zypp
///////////////////////////////////////////////////////////////////
Modified: branches/tmp/ma/jump_sat/libzypp/zypp/ResPool.h
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/ma/jump_sat/libzypp/zypp/ResPool.h?rev=8381&r1=8380&r2=8381&view=diff
==============================================================================
--- branches/tmp/ma/jump_sat/libzypp/zypp/ResPool.h (original)
+++ branches/tmp/ma/jump_sat/libzypp/zypp/ResPool.h Mon Jan 28 19:56:41 2008
@@ -14,6 +14,8 @@
#include <iosfwd>
+#include "zypp/base/Deprecated.h"
+
#include "zypp/pool/PoolTraits.h"
#include "zypp/base/Iterator.h"
#include "zypp/ResFilters.h"
@@ -58,6 +60,9 @@
typedef pool::PoolTraits::repository_iterator repository_iterator;
public:
+ /** Singleton ctor. */
+ //static ResPool instance();
+
/** Default ctor: empty pool */
ResPool();
/** Dtor */
@@ -217,7 +222,7 @@
///////////////////////////////////////////////////////////////////
/** \todo rename class and eliminate typedef. */
- typedef ResPool ResPool_Ref;
+ typedef ResPool ZYPP_DEPRECATED ResPool_Ref;
///////////////////////////////////////////////////////////////////
Modified: branches/tmp/ma/jump_sat/libzypp/zypp/Resolvable.h
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/ma/jump_sat/libzypp/zypp/Resolvable.h?rev=8381&r1=8380&r2=8381&view=diff
==============================================================================
--- branches/tmp/ma/jump_sat/libzypp/zypp/Resolvable.h (original)
+++ branches/tmp/ma/jump_sat/libzypp/zypp/Resolvable.h Mon Jan 28 19:56:41 2008
@@ -79,11 +79,6 @@
using sat::Solvable::prerequires;
//@}
- ZYPP_DEPRECATED const Dependencies & deps() const
- { static Dependencies _x; return _x; }
- ZYPP_DEPRECATED void injectProvides( const Capability & cap_r ) {}
- ZYPP_DEPRECATED void injectRequires( const Capability & cap_r ) {}
-
public:
const sat::Solvable & satSolvable() const { return *this; }
Modified: branches/tmp/ma/jump_sat/libzypp/zypp/solver/detail/InstallOrder.cc
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/ma/jump_sat/libzypp/zypp/solver/detail/InstallOrder.cc?rev=8381&r1=8380&r2=8381&view=diff
==============================================================================
--- branches/tmp/ma/jump_sat/libzypp/zypp/solver/detail/InstallOrder.cc (original)
+++ branches/tmp/ma/jump_sat/libzypp/zypp/solver/detail/InstallOrder.cc Mon Jan 28 19:56:41 2008
@@ -224,8 +224,7 @@
_rdfstime++;
// items prereq
- Dependencies dependencies = item->deps();
- CapabilitySet prq = dependencies[Dep::PREREQUIRES];
+ CapabilitySet prq( item->dep(Dep::PREREQUIRES).begin(), item->dep(Dep::PREREQUIRES).end() );
// an installed items prereq (in case they are reqired for uninstall scripts)
NameKindProxy nkp( _pool, item->name(), item->kind() );
if ( ! nkp.installedEmpty() )
Modified: branches/tmp/ma/jump_sat/libzypp/zypp/solver/detail/SolutionAction.cc
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/ma/jump_sat/libzypp/zypp/solver/detail/SolutionAction.cc?rev=8381&r1=8380&r2=8381&view=diff
==============================================================================
--- branches/tmp/ma/jump_sat/libzypp/zypp/solver/detail/SolutionAction.cc (original)
+++ branches/tmp/ma/jump_sat/libzypp/zypp/solver/detail/SolutionAction.cc Mon Jan 28 19:56:41 2008
@@ -110,11 +110,11 @@
case OBSOLETES: os << "Obsoletes"; break;
case INSTALLED: os << "Installed"; break;
case ARCHITECTURE: os << "Architecture"; break;
- case VENDOR: os << "Vendor"; break;
+ case VENDOR: os << "Vendor"; break;
default: os << "Wrong kind"; break;
}
os << " ";
- os << _item;
+ os << _item;
os << endl;
return os;
}
@@ -132,7 +132,7 @@
}
-bool
+bool
TransactionSolutionAction::execute(Resolver & resolver) const
{
bool ret = true;
@@ -149,11 +149,11 @@
case REMOVE:
if (_item.status().isToBeInstalled()) {
_item.status().setTransact (false,ResStatus::USER);
- _item.status().setLock (true,ResStatus::USER); // no other dependency can set it again
+ _item.status().setLock (true,ResStatus::USER); // no other dependency can set it again
} else if (_item.status().isInstalled())
_item.status().setToBeUninstalled (ResStatus::USER);
else
- _item.status().setLock (true,ResStatus::USER); // no other dependency can set it again
+ _item.status().setLock (true,ResStatus::USER); // no other dependency can set it again
break;
case UNLOCK:
ret = _item.status().setLock (false, ResStatus::USER);
@@ -169,47 +169,44 @@
bool
InjectSolutionAction::execute(Resolver & resolver) const
{
- Dependencies dependencies;
- CapabilitySet depList;
- if (_item != PoolItem_Ref()) {
- dependencies = _item.resolvable()->deps();
- depList = dependencies[Dep::CONFLICTS];
+ Capabilities depList;
+ if (_item != PoolItem_Ref()) {
+ depList = _item.resolvable()->dep(Dep::CONFLICTS);
}
switch (_kind) {
case CONFLICTS:
// removing conflict in both resolvables
- for (CapabilitySet::const_iterator iter = depList.begin(); iter != depList.end(); iter++) {
+ for (Capabilities::const_iterator iter = depList.begin(); iter != depList.end(); iter++) {
if (iter->matches (_capability) == CapMatch::yes )
{
resolver.addIgnoreConflict (_item, _capability);
}
}
// Obsoletes are conflicts too
- depList = dependencies[Dep::OBSOLETES];
- for (CapabilitySet::const_iterator iter = depList.begin(); iter != depList.end(); iter++) {
+ depList = _item.resolvable()->dep(Dep::OBSOLETES);
+ for (Capabilities::const_iterator iter = depList.begin(); iter != depList.end(); iter++) {
if (iter->matches (_capability) == CapMatch::yes )
{
resolver.addIgnoreConflict (_otherItem, _capability);
}
}
-
- dependencies = _otherItem.resolvable()->deps();
- depList = dependencies[Dep::CONFLICTS];
- for (CapabilitySet::const_iterator iter = depList.begin(); iter != depList.end(); iter++) {
+
+ depList = _otherItem.resolvable()->dep(Dep::CONFLICTS);
+ for (Capabilities::const_iterator iter = depList.begin(); iter != depList.end(); iter++) {
if (iter->matches (_capability) == CapMatch::yes )
{
resolver.addIgnoreConflict (_otherItem, _capability);
}
}
- // Obsoletes are conflicts too
- depList = dependencies[Dep::OBSOLETES];
- for (CapabilitySet::const_iterator iter = depList.begin(); iter != depList.end(); iter++) {
+ // Obsoletes are conflicts too
+ depList = _otherItem.resolvable()->dep(Dep::OBSOLETES);
+ for (Capabilities::const_iterator iter = depList.begin(); iter != depList.end(); iter++) {
if (iter->matches (_capability) == CapMatch::yes )
{
resolver.addIgnoreConflict (_otherItem, _capability);
}
}
-
+
break;
case REQUIRES:
// removing the requires dependency from the item
@@ -228,11 +225,11 @@
case VENDOR:
// This item is for ALL vendor available
resolver.addIgnoreVendorItem (_item);
- break;
+ break;
case OBSOLETES:
// removing the obsoletes dependency from the item
resolver.addIgnoreObsoletes (_otherItem, _capability);
- break;
+ break;
case INSTALLED:
// ignoring already installed items
resolver.addIgnoreInstalledItem (_item);
Modified: branches/tmp/ma/jump_sat/libzypp/zypp/solver/detail/Testcase.cc
URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/ma/jump_sat/libzypp/zypp/solver/detail/Testcase.cc?rev=8381&r1=8380&r2=8381&view=diff
==============================================================================
--- branches/tmp/ma/jump_sat/libzypp/zypp/solver/detail/Testcase.cc (original)
+++ branches/tmp/ma/jump_sat/libzypp/zypp/solver/detail/Testcase.cc Mon Jan 28 19:56:41 2008
@@ -43,14 +43,14 @@
/////////////////////////////////////////////////////////////////////
namespace detail
{ ///////////////////////////////////////////////////////////////////
-
+
#define TAB "\t"
#define TAB2 "\t\t"
-
+
using namespace std;
using namespace zypp::str;
-IMPL_PTR_TYPE(HelixResolvable);
+IMPL_PTR_TYPE(HelixResolvable);
static std::string xml_escape( const std::string &text )
{
@@ -72,11 +72,11 @@
return result;
}
-
+
template<class T>
std::string helixXML( const T &obj ); //undefined
-template<>
+template<>
std::string helixXML( const Edition &edition )
{
stringstream str;
@@ -84,28 +84,28 @@
if (!edition.release().empty())
str << xml_tag_enclose(edition.release(), "release");
if (edition.epoch() != Edition::noepoch)
- str << xml_tag_enclose(numstring(edition.epoch()), "epoch");
+ str << xml_tag_enclose(numstring(edition.epoch()), "epoch");
return str.str();
}
-template<>
+template<>
std::string helixXML( const Arch &arch )
{
stringstream str;
- str << xml_tag_enclose(arch.asString(), "arch");
- return str.str();
+ str << xml_tag_enclose(arch.asString(), "arch");
+ return str.str();
}
-template<>
+template<>
std::string helixXML( const Capability &cap )
{
stringstream str;
str << "<dep name='" << xml_escape(cap.asString()) << "' />" << endl;
-
- return str.str();
+
+ return str.str();
}
-template<>
+template<>
std::string helixXML( const Capabilities &caps )
{
stringstream str;
@@ -119,7 +119,7 @@
return str.str();
}
-template<>
+template<>
std::string helixXML( const CapabilitySet &caps )
{
stringstream str;
@@ -134,7 +134,7 @@
}
-template<>
+template<>
std::string helixXML( const Dependencies &dep )
{
stringstream str;
@@ -147,7 +147,7 @@
if ( dep[Dep::FRESHENS].size() > 0 )
str << TAB << xml_tag_enclose(helixXML(dep[Dep::FRESHENS]), "freshens") << endl;
if ( dep[Dep::REQUIRES].size() > 0 )
- str << TAB << xml_tag_enclose(helixXML(dep[Dep::REQUIRES]), "requires") << endl;
+ str << TAB << xml_tag_enclose(helixXML(dep[Dep::REQUIRES]), "requires") << endl;
if ( dep[Dep::RECOMMENDS].size() > 0 )
str << TAB << xml_tag_enclose(helixXML(dep[Dep::RECOMMENDS]), "recommends") << endl;
if ( dep[Dep::ENHANCES].size() > 0 )
@@ -156,7 +156,16 @@
str << TAB << xml_tag_enclose(helixXML(dep[Dep::SUPPLEMENTS]), "supplements") << endl;
if ( dep[Dep::SUGGESTS].size() > 0 )
str << TAB << xml_tag_enclose(helixXML(dep[Dep::SUGGESTS]), "suggests") << endl;
- return str.str();
+ return str.str();
+}
+
+inline string helixXML( const Resolvable::constPtr &obj, Dep deptag_r )
+{
+ stringstream out;
+ Capabilities caps( obj->dep(deptag_r) );
+ if ( ! caps.empty() )
+ out << " " << xml_tag_enclose(helixXML(caps), deptag_r.asString()) << endl;
+ return out.str();
}
std::string helixXML( const PoolItem_Ref &item )
@@ -167,29 +176,38 @@
// language dependencies will be written in another part
return str.str();
}
-
+
str << "<" << toLower (resolvable->kind().asString()) << ">" << endl;
str << TAB << xml_tag_enclose (resolvable->name(), "name", true) << endl;
- str << TAB << xml_tag_enclose (item->vendor(), "vendor", true) << endl;
+ str << TAB << xml_tag_enclose (item->vendor(), "vendor", true) << endl;
if ( isKind<Package>(resolvable) ) {
str << TAB << "<history>" << endl << TAB << "<update>" << endl;
str << TAB2 << helixXML (resolvable->arch()) << endl;
- str << TAB2 << helixXML (resolvable->edition()) << endl;
+ str << TAB2 << helixXML (resolvable->edition()) << endl;
str << TAB << "</update>" << endl << TAB << "</history>" << endl;
} else {
- str << TAB << helixXML (resolvable->arch()) << endl;
- str << TAB << helixXML (resolvable->edition()) << endl;
+ str << TAB << helixXML (resolvable->arch()) << endl;
+ str << TAB << helixXML (resolvable->edition()) << endl;
}
- str << helixXML (resolvable->deps());
+ str << helixXML( resolvable, Dep::PROVIDES);
+ str << helixXML( resolvable, Dep::PREREQUIRES);
+ str << helixXML( resolvable, Dep::CONFLICTS);
+ str << helixXML( resolvable, Dep::OBSOLETES);
+ str << helixXML( resolvable, Dep::FRESHENS);
+ str << helixXML( resolvable, Dep::REQUIRES);
+ str << helixXML( resolvable, Dep::RECOMMENDS);
+ str << helixXML( resolvable, Dep::ENHANCES);
+ str << helixXML( resolvable, Dep::SUPPLEMENTS);
+ str << helixXML( resolvable, Dep::SUGGESTS);
- str << "" << toLower (resolvable->kind().asString()) << ">" << endl;
+ str << "" << toLower (resolvable->kind().asString()) << ">" << endl;
return str.str();
}
//---------------------------------------------------------------------------
Testcase::Testcase()
- :dumpPath("/var/log/YaST2/solverTestcase")
+ :dumpPath("/var/log/YaST2/solverTestcase")
{
}
@@ -197,7 +215,7 @@
:dumpPath(path)
{
}
-
+
Testcase::~Testcase()
{
@@ -219,11 +237,11 @@
return false;
}
// remove old stuff if pool will be dump
- if (dumpPool)
+ if (dumpPool)
zypp::filesystem::clean_dir (dumpPath);
}
- if (runSolver) {
+ if (runSolver) {
zypp::base::LogControl::instance().logfile( dumpPath +"/y2log" );
zypp::base::LogControl::TmpExcessive excessive;
@@ -238,12 +256,12 @@
PoolItemList items_to_install;
PoolItemList items_to_remove;
PoolItemList items_locked;
- PoolItemList items_keep;
+ PoolItemList items_keep;
PoolItemList language;
HelixResolvable_Ptr system = NULL;
if (dumpPool)
- system = new HelixResolvable(dumpPath + "/solver-system.xml.gz");
+ system = new HelixResolvable(dumpPath + "/solver-system.xml.gz");
for ( ResPool::const_iterator it = pool.begin(); it != pool.end(); ++it )
{
@@ -252,7 +270,7 @@
if (isKind<Language>(res)) {
if ( it->status().isInstalled()
|| it->status().isToBeInstalled()) {
- language.push_back (*it);
+ language.push_back (*it);
}
} else {
if ( system && it->status().isInstalled() ) {
@@ -271,7 +289,7 @@
repoTable[repo]->addResolvable (*it);
}
}
-
+
if ( it->status().isToBeInstalled()
&& !(it->status().isBySolver())) {
items_to_install.push_back (*it);
@@ -279,7 +297,7 @@
if ( it->status().isKept()
&& !(it->status().isBySolver())) {
items_keep.push_back (*it);
- }
+ }
if ( it->status().isToBeUninstalled()
&& !(it->status().isBySolver())) {
items_to_remove.push_back (*it);
@@ -299,19 +317,19 @@
language);
for (PoolItemList::const_iterator iter = items_to_install.begin(); iter != items_to_install.end(); iter++) {
- control.installResolvable (iter->resolvable(), iter->status());
+ control.installResolvable (iter->resolvable(), iter->status());
}
for (PoolItemList::const_iterator iter = items_locked.begin(); iter != items_locked.end(); iter++) {
- control.lockResolvable (iter->resolvable(), iter->status());
+ control.lockResolvable (iter->resolvable(), iter->status());
}
-
+
for (PoolItemList::const_iterator iter = items_keep.begin(); iter != items_keep.end(); iter++) {
- control.keepResolvable (iter->resolvable(), iter->status());
+ control.keepResolvable (iter->resolvable(), iter->status());
}
for (PoolItemList::const_iterator iter = items_to_remove.begin(); iter != items_to_remove.end(); iter++) {
- control.deleteResolvable (iter->resolvable(), iter->status());
+ control.deleteResolvable (iter->resolvable(), iter->status());
}
control.addDependencies (resolver.extraRequires(), resolver.extraConflicts());
@@ -322,7 +340,7 @@
//---------------------------------------------------------------------------
HelixResolvable::HelixResolvable(const std::string & path)
- :dumpFile (path)
+ :dumpFile (path)
{
file = new ofgzstream(path.c_str());
if (!file) {
@@ -336,7 +354,7 @@
{
*file << "</subchannel></channel>" << endl;
}
-
+
void HelixResolvable::addResolvable(const PoolItem_Ref item)
{
@@ -350,7 +368,7 @@
const Arch & systemArchitecture,
const PoolItemList &languages,
const std::string & systemPath)
- :dumpFile (controlPath)
+ :dumpFile (controlPath)
{
file = new ofstream(controlPath.c_str());
if (!file) {
@@ -372,11 +390,11 @@
++itUrl )
{
*file << TAB << "- url : " << *itUrl << endl;
- }
+ }
*file << TAB << "- path : " << repo.info().path() << endl;
- *file << TAB << "- type : " << repo.info().type() << endl;
+ *file << TAB << "- type : " << repo.info().type() << endl;
*file << TAB << " -->" << endl;
-
+
*file << TAB << "