Mailinglist Archive: zypp-commit (258 mails)

< Previous Next >
[zypp-commit] r8350 - in /branches/tmp/ma/jump_sat/libzypp/zypp/solver/detail: Testcase.cc Testcase.h
  • From: schubi2@xxxxxxxxxxxxxxxx
  • Date: Wed, 23 Jan 2008 17:10:03 -0000
  • Message-id: <20080123171004.1017A26330@xxxxxxxxxxxxxxxx>
Author: schubi2
Date: Wed Jan 23 18:10:03 2008
New Revision: 8350

URL: http://svn.opensuse.org/viewcvs/zypp?rev=8350&view=rev
Log:
create testcase without solving

Modified:
branches/tmp/ma/jump_sat/libzypp/zypp/solver/detail/Testcase.cc
branches/tmp/ma/jump_sat/libzypp/zypp/solver/detail/Testcase.h

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=8350&r1=8349&r2=8350&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 Wed Jan 23
18:10:03 2008
@@ -203,7 +203,7 @@
{
}

-bool Testcase::createTestcase(Resolver & resolver)
+bool Testcase::createTestcasePool(const ResPool &pool)
{
PathInfo path (dumpPath);

@@ -221,13 +221,60 @@
zypp::filesystem::clean_dir (dumpPath);
}

- zypp::base::LogControl::instance().logfile( dumpPath +"/y2log" );
- zypp::base::LogControl::TmpExcessive excessive;
+ RepositoryTable repoTable;
+ HelixResolvable system (dumpPath + "/solver-system.xml");
+
+ for ( ResPool::const_iterator it = pool.begin(); it != pool.end(); ++it )
+ {
+ Resolvable::constPtr res = it->resolvable();
+
+ if ( it->status().isInstalled() ) {
+ // system channel
+ system.addResolvable (*it);
+ } else {
+ // repo channels
+ ResObject::constPtr repoItem = it->resolvable();
+ Repository repo = repoItem->repository();
+ if (repoTable.find (repo) == repoTable.end()) {
+ repoTable[repo] = new HelixResolvable(dumpPath + "/"
+ +
numstring(repo.numericId())
+ + "-package.xml");
+ }
+ repoTable[repo]->addResolvable (*it);
+ }
+ }
+ return true;
+}
+
+
+bool Testcase::createTestcase(Resolver & resolver, bool dumpPool, bool
runSolver)
+{
+ PathInfo path (dumpPath);

- resolver.reset(true); // true = resetting all valid solverresults
- resolver.resolvePool();
+ if ( !path.isExist() ) {
+ if (zypp::filesystem::mkdir (dumpPath)!=0) {
+ ERR << "Cannot create directory " << dumpPath << endl;
+ return false;
+ }
+ } else {
+ if (!path.isDir()) {
+ ERR << dumpPath << " is not a directory." << endl;
+ return false;
+ }
+ // remove old stuff if pool will be dump
+ if (dumpPool)
+ zypp::filesystem::clean_dir (dumpPath);
+ }
+
+ if (runSolver) {
+ zypp::base::LogControl::instance().logfile( dumpPath +"/y2log" );
+ zypp::base::LogControl::TmpExcessive excessive;

- zypp::base::LogControl::instance().logfile( "/var/log/YaST2/y2log" );
+ resolver.reset(true); // true = resetting all valid solverresults
+ resolver.resolvePool();
+
+ zypp::base::LogControl::instance().logfile( "/var/log/YaST2/y2log" );
+ }

ResPool pool = resolver.pool();
RepositoryTable repoTable;
@@ -236,7 +283,10 @@
PoolItemList items_locked;
PoolItemList items_keep;
PoolItemList language;
- HelixResolvable system (dumpPath + "/solver-system.xml");
+ HelixResolvable_Ptr system = NULL;
+
+ if (dumpPool)
+ system = new HelixResolvable(dumpPath + "/solver-system.xml");

for ( ResPool::const_iterator it = pool.begin(); it != pool.end(); ++it )
{
@@ -248,19 +298,21 @@
language.push_back (*it);
}
} else {
- if ( it->status().isInstalled() ) {
+ if ( system && it->status().isInstalled() ) {
// system channel
- system.addResolvable (*it);
+ system->addResolvable (*it);
} else {
// repo channels
ResObject::constPtr repoItem = it->resolvable();
Repository repo = repoItem->repository();
- if (repoTable.find (repo) == repoTable.end()) {
- repoTable[repo] = new HelixResolvable(dumpPath + "/"
- +
numstring(repo.numericId())
- + "-package.xml");
+ if (dumpPool) {
+ if (repoTable.find (repo) == repoTable.end()) {
+ repoTable[repo] = new HelixResolvable(dumpPath + "/"
+ +
numstring(repo.numericId())
+ + "-package.xml");
+ }
+ repoTable[repo]->addResolvable (*it);
}
- repoTable[repo]->addResolvable (*it);
}

if ( it->status().isToBeInstalled()
@@ -279,7 +331,6 @@
&& !(it->status().isBySolver())) {
items_locked.push_back (*it);
}
-
}
}


Modified: branches/tmp/ma/jump_sat/libzypp/zypp/solver/detail/Testcase.h
URL:
http://svn.opensuse.org/viewcvs/zypp/branches/tmp/ma/jump_sat/libzypp/zypp/solver/detail/Testcase.h?rev=8350&r1=8349&r2=8350&view=diff
==============================================================================
--- branches/tmp/ma/jump_sat/libzypp/zypp/solver/detail/Testcase.h (original)
+++ branches/tmp/ma/jump_sat/libzypp/zypp/solver/detail/Testcase.h Wed Jan 23
18:10:03 2008
@@ -131,7 +131,8 @@
Testcase ();
~Testcase ();

- bool createTestcase (Resolver & resolver);
+ bool createTestcase (Resolver & resolver, bool dumpPool = true, bool
runSolver = true);
+ bool createTestcasePool(const ResPool &pool);

};


--
To unsubscribe, e-mail: zypp-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: zypp-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages