#include "zypp/sat/SATResolver.h"
#include "zypp/sat/Pool.h"
#include "zypp/solver/detail/ProblemSolutionCombi.h"
-#include "zypp/solver/detail/Testcase.h"
extern "C" {
#include "satsolver/repo_solv.h"
, _architecture( zypp_detail::defaultArchitecture() )
{
- Testcase testcase("/var/log/YaST2/autotestcase");
- testcase.createTestcasePool (pool); // dump pool to testcase
}
#include "zypp/solver/detail/Resolver.h"
#include "zypp/solver/detail/Helper.h"
+#include "zypp/solver/detail/Testcase.h"
#include "zypp/Capabilities.h"
#include "zypp/base/Logger.h"
if ( !_satResolver ) {
sat::Pool satPool( sat::Pool::instance() );
_satResolver = new SATResolver(_pool, satPool.get());
+ Testcase testcase("/var/log/YaST/autoTestcase");
+ testcase.createTestcase (*this, true, false); // create pool, do not solver
}
#if 0
MIL << "------SAT-Pool------" << endl;
#include "zypp/solver/detail/Types.h"
#include "zypp/solver/detail/Helper.h"
#include "zypp/solver/detail/Resolver.h"
+#include "zypp/solver/detail/Testcase.h"
#include "zypp/Target.h"
/////////////////////////////////////////////////////////////////////////
<< "(keep_installed_patches:" << (opt_stats_r.keep_installed_patches?"yes":"no") << ")"
<< endl;
+ // create a testcase for the updating system
+ Testcase testcase("/var/log/updateTestcase");
+ testcase.createTestcase (*this, true, false); // create pool, do not solver
+
_update_items.clear();
{
UpgradeOptions opts( opt_stats_r );
{
}
-bool Testcase::createTestcasePool(const ResPool &pool)
-{
- PathInfo path (dumpPath);
-
- 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
- zypp::filesystem::clean_dir (dumpPath);
- }
-
- 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)
{
HelixResolvable::HelixResolvable(const std::string & path)
:dumpFile (path)
{
- file = new ofstream(path.c_str());
+ file = new ofgzstream(path.c_str());
if (!file) {
ZYPP_THROW (Exception( "Can't open " + path ) );
}
#include "zypp/solver/detail/Resolver.h"
#include "zypp/Capabilities.h"
#include "zypp/ResPool.h"
+#include "zypp/base/GzStream.h"
/////////////////////////////////////////////////////////////////////////
namespace zypp
private:
std::string dumpFile; // Path of the generated testcase
- std::ofstream *file;
+ ofgzstream *file;
public:
HelixResolvable (const std::string & path);
~Testcase ();
bool createTestcase (Resolver & resolver, bool dumpPool = true, bool runSolver = true);
- bool createTestcasePool(const ResPool &pool);
-
};