ref: refs/heads/master
commit be252c70dfe9f9a2793cc1d1d067f8d53a85d1ad
Author: Michael Andres
Date: Wed Jul 15 17:59:56 2009 +0200
Don't write a solver testcase when solving for dist upgrade, but when actually committing.
---
VERSION.cmake | 2 +-
package/libzypp.changes | 7 +++++++
zypp/Resolver.cc | 6 ++++--
zypp/Resolver.h | 7 ++++++-
zypp/solver/detail/ResolverUpgrade.cc | 8 +-------
zypp/solver/detail/Testcase.cc | 2 +-
zypp/solver/detail/Testcase.h | 32 ++++++++++++++++----------------
zypp/target/TargetImpl.cc | 28 ++++++++++++++++++++++++++++
8 files changed, 64 insertions(+), 28 deletions(-)
diff --git a/VERSION.cmake b/VERSION.cmake
index 8da4290..24d156e 100644
--- a/VERSION.cmake
+++ b/VERSION.cmake
@@ -63,6 +63,6 @@ SET(LIBZYPP_COMPATMINOR "10")
SET(LIBZYPP_MINOR "10")
SET(LIBZYPP_PATCH "3")
#
-# LAST RELEASED: 6.10.2 (10)
+# LAST RELEASED: 6.10.3 (10)
# (The number in parenthesis is LIBZYPP_COMPATMINOR)
#=======
diff --git a/package/libzypp.changes b/package/libzypp.changes
index 5c1eebe..a61d1f2 100644
--- a/package/libzypp.changes
+++ b/package/libzypp.changes
@@ -1,4 +1,11 @@
-------------------------------------------------------------------
+Wed Jul 15 17:53:43 CEST 2009 - ma@suse.de
+
+- Don't write a solver testcase when solving for dist upgrade,
+ but when actually committing.
+- version 6.10.3 (10)
+
+-------------------------------------------------------------------
Wed Jul 15 16:45:39 CEST 2009 - ma@suse.de
- Add new string Match::Mode STRINGSTART and STRINGEND.
diff --git a/zypp/Resolver.cc b/zypp/Resolver.cc
index 2cdb175..d974694 100644
--- a/zypp/Resolver.cc
+++ b/zypp/Resolver.cc
@@ -84,6 +84,8 @@ namespace zypp
void Resolver::resetOnlyRequires() { _pimpl->setOnlyRequires( indeterminate ); }
bool Resolver::onlyRequires() { return _pimpl->onlyRequires(); }
+ bool Resolver::upgradeMode() const { return _pimpl->isUpgradeMode(); }
+
void Resolver::setAllowVendorChange( bool yesno_r ) { _pimpl->setAllowVendorChange( yesno_r ); }
void Resolver::setDefaultAllowVendorChange() { _pimpl->setAllowVendorChange( indeterminate ); }
bool Resolver::allowVendorChange() const { return _pimpl->allowVendorChange(); }
@@ -108,10 +110,10 @@ namespace zypp
std::list<PoolItem> Resolver::problematicUpdateItems() const
{ return _pimpl->problematicUpdateItems(); }
- bool Resolver::createSolverTestcase( const std::string & dumpPath )
+ bool Resolver::createSolverTestcase( const std::string & dumpPath, bool runSolver )
{
solver::detail::Testcase testcase (dumpPath);
- return testcase.createTestcase(*_pimpl);
+ return testcase.createTestcase(*_pimpl, true, runSolver);
}
solver::detail::ItemCapKindList Resolver::isInstalledBy( const PoolItem & item )
diff --git a/zypp/Resolver.h b/zypp/Resolver.h
index 4ebbdd4..d00e5a9 100644
--- a/zypp/Resolver.h
+++ b/zypp/Resolver.h
@@ -179,6 +179,11 @@ namespace zypp
bool onlyRequires();
/**
+ * Whether the \ref Resolver is in upgrade mode.
+ */
+ bool upgradeMode() const;
+
+ /**
* Setting whether the solver should allow or disallow vendor changes.
*
* If OFF (the default) the solver will replace packages with packages
@@ -254,7 +259,7 @@ namespace zypp
* \parame dumpPath destination directory of the created directory
* \return true if it was successful
*/
- bool createSolverTestcase( const std::string & dumpPath = "/var/log/YaST2/solverTestcase" );
+ bool createSolverTestcase( const std::string & dumpPath = "/var/log/YaST2/solverTestcase", bool runSolver = true );
/**
* Gives information about WHO has pused an installation of an given item.
diff --git a/zypp/solver/detail/ResolverUpgrade.cc b/zypp/solver/detail/ResolverUpgrade.cc
index db0f251..ae079b8 100644
--- a/zypp/solver/detail/ResolverUpgrade.cc
+++ b/zypp/solver/detail/ResolverUpgrade.cc
@@ -69,13 +69,7 @@ Resolver::doUpgrade()
{
ERR << "Huh, no target ?" << endl;
return false; // can't continue without target
- }
-
- // create a testcase for the updating system
- std::string now( Date::now().form( "-%Y-%m-%d-%H-%M-%S" ) );
- Pathname path ( target->assertRootPrefix("/var/log/updateTestcase"+now) );
- Testcase testcase( path.asString() );
- testcase.createTestcase (*this, true, false); // create pool, do not solve
+ }
// Setting Resolver to upgrade mode. SAT solver will do the update
_upgradeMode = true;
diff --git a/zypp/solver/detail/Testcase.cc b/zypp/solver/detail/Testcase.cc
index ab2607a..41299dc 100644
--- a/zypp/solver/detail/Testcase.cc
+++ b/zypp/solver/detail/Testcase.cc
@@ -273,7 +273,7 @@ bool Testcase::createTestcase(Resolver & resolver, bool dumpPool, bool runSolver
PathInfo path (dumpPath);
if ( !path.isExist() ) {
- if (zypp::filesystem::mkdir (dumpPath)!=0) {
+ if (zypp::filesystem::assert_dir (dumpPath)!=0) {
ERR << "Cannot create directory " << dumpPath << endl;
return false;
}
diff --git a/zypp/solver/detail/Testcase.h b/zypp/solver/detail/Testcase.h
index eca8dae..dc012c0 100644
--- a/zypp/solver/detail/Testcase.h
+++ b/zypp/solver/detail/Testcase.h
@@ -39,22 +39,22 @@ namespace zypp
template<class T>
std::string helixXML( const T &obj ); //undefined
-template<>
+template<>
std::string helixXML( const Edition &edition );
-template<>
+template<>
std::string helixXML( const Arch &arch );
-template<>
+template<>
std::string helixXML( const Capability &cap );
-template<>
+template<>
std::string helixXML( const Capabilities &caps );
-template<>
+template<>
std::string helixXML( const CapabilitySet &caps );
-template<>
+template<>
std::string helixXML( const PoolItem &item );
@@ -69,7 +69,7 @@ class HelixResolvable : public base::ReferenceCounted, private base::NonCopyabl
private:
std::string dumpFile; // Path of the generated testcase
- ofgzstream *file;
+ ofgzstream *file;
public:
HelixResolvable (const std::string & path);
@@ -99,12 +99,12 @@ class HelixControl {
HelixControl (const std::string & controlPath,
const RepositoryTable & sourceTable,
const Arch & systemArchitecture,
- const LocaleSet &languages,
+ const LocaleSet &languages,
const std::string & systemPath = "solver-system.xml.gz",
const bool forceResolve = false,
const bool onlyRequires = false,
const bool ignorealreadyrecommended = false);
- HelixControl ();
+ HelixControl ();
~HelixControl ();
void installResolvable (const ResObject::constPtr &resObject,
@@ -112,21 +112,21 @@ class HelixControl {
void lockResolvable (const ResObject::constPtr &resObject,
const ResStatus &status);
void keepResolvable (const ResObject::constPtr &resObject,
- const ResStatus &status);
+ const ResStatus &status);
void deleteResolvable (const ResObject::constPtr &resObject,
const ResStatus &status);
void addDependencies (const CapabilitySet &capRequire, const CapabilitySet &capConflict);
-
+
void distupgrade ();
void verifySystem ();
void update ();
-
+
std::string filename () { return dumpFile; }
};
-
-
+
+
///////////////////////////////////////////////////////////////////
//
// CLASS NAME : Testcase
@@ -140,11 +140,11 @@ class Testcase {
public:
Testcase (const std::string & path);
- Testcase ();
+ Testcase ();
~Testcase ();
bool createTestcase (Resolver & resolver, bool dumpPool = true, bool runSolver = true);
- bool createTestcasePool(const ResPool &pool);
+ bool createTestcasePool(const ResPool &pool);
};
diff --git a/zypp/target/TargetImpl.cc b/zypp/target/TargetImpl.cc
index 2837564..6b0ddbb 100644
--- a/zypp/target/TargetImpl.cc
+++ b/zypp/target/TargetImpl.cc
@@ -49,6 +49,7 @@
#include "zypp/pool/GetResolvablesToInsDel.h"
#include "zypp/solver/detail/Helper.h"
+#include "zypp/solver/detail/Testcase.h"
#include "zypp/repo/DeltaCandidates.h"
#include "zypp/repo/PackageProvider.h"
@@ -58,6 +59,7 @@
using namespace std;
+
///////////////////////////////////////////////////////////////////
namespace zypp
{ /////////////////////////////////////////////////////////////////
@@ -65,6 +67,24 @@ namespace zypp
namespace target
{ /////////////////////////////////////////////////////////////////
+ /** \internal Manage writing a new testcase when doing an upgrade. */
+ void writeOutUpgradeTestcase()
+ {
+ Target_Ptr target( getZYpp()->getTarget() );
+ if ( ! target )
+ {
+ WAR << "No Target no Testcase!" << endl;
+ return;
+ }
+
+ std::string stem( "updateTestcase" );
+ Pathname dir( target->assertRootPrefix("/var/log/") );
+ Pathname next( dir / Date::now().form( stem+"-%Y-%m-%d-%H-%M-%S" ) );
+
+ MIL << "Write new testcase " << next << endl;
+ getZYpp()->resolver()->createSolverTestcase( next.asString(), false/*no solving*/ );
+ }
+
///////////////////////////////////////////////////////////////////
namespace
{ /////////////////////////////////////////////////////////////////
@@ -673,6 +693,14 @@ namespace zypp
MIL << "TargetImpl::commit(<pool>, " << policy_r << ")" << endl;
///////////////////////////////////////////////////////////////////
+ // Write out a testcase if we're in dist upgrade mode.
+ ///////////////////////////////////////////////////////////////////
+ if ( getZYpp()->resolver()->upgradeMode() )
+ {
+ writeOutUpgradeTestcase();
+ }
+
+ ///////////////////////////////////////////////////////////////////
// Store non-package data:
///////////////////////////////////////////////////////////////////
filesystem::assert_dir( home() );
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org
For additional commands, e-mail: zypp-commit+help@opensuse.org