Mailinglist Archive: zypp-commit (38 mails)

< Previous Next >
[zypp-commit] <libzypp> master : New Resolver::addUpgradeRepo to perform a dist upgrade restricted to certain repositories.
  • From: Michael Andres <ma@xxxxxxx>
  • Date: Mon, 3 Aug 2009 18:45:39 +0200
  • Message-id: <E1MY0hj-0006rL-4g@xxxxxxxxxxxxxxxx>
ref: refs/heads/master
commit ad99202b37204a43c6163fa6e9cfc0ddf96ab7a7
Author: Michael Andres <ma@xxxxxxx>
Date: Mon Aug 3 18:45:39 2009 +0200

New Resolver::addUpgradeRepo to perform a dist upgrade restricted to
certain repositories.
---
zypp/Resolver.cc | 3 +++
zypp/Resolver.h | 20 +++++++++++++++++++-
zypp/solver/detail/Resolver.cc | 2 +-
zypp/solver/detail/Resolver.h | 6 ++++++
zypp/solver/detail/SATResolver.cc | 10 +++++++++-
zypp/solver/detail/SATResolver.h | 3 ++-
zypp/solver/detail/Testcase.cc | 9 +++++++++
zypp/solver/detail/Testcase.h | 1 +
8 files changed, 50 insertions(+), 4 deletions(-)

diff --git a/zypp/Resolver.cc b/zypp/Resolver.cc
index d974694..6e3b9cf 100644
--- a/zypp/Resolver.cc
+++ b/zypp/Resolver.cc
@@ -98,6 +98,9 @@ namespace zypp
void Resolver::setDefaultSolveSrcPackages() {
_pimpl->setSolveSrcPackages( indeterminate ); }
bool Resolver::solveSrcPackages() const { return
_pimpl->solveSrcPackages(); }

+ void Resolver::addUpgradeRepo( Repository repo_r ) {
_pimpl->addUpgradeRepo( repo_r ); }
+ void Resolver::removeUpgradeRepo( Repository repo_r ) {
_pimpl->removeUpgradeRepo( repo_r ); }
+ void Resolver::removeUpgradeRepos() {
_pimpl->removeUpgradeRepos(); }

void Resolver::addRequire( const Capability & capability ) {
_pimpl->addExtraRequire( capability ); }
void Resolver::addConflict( const Capability & capability ) {
_pimpl->addExtraConflict( capability ); }
diff --git a/zypp/Resolver.h b/zypp/Resolver.h
index d00e5a9..b6b748b 100644
--- a/zypp/Resolver.h
+++ b/zypp/Resolver.h
@@ -115,6 +115,8 @@ namespace zypp
* all packages with a special resolver algorithm which takes
* care of package splits, pattern and product updates,
* etc.
+ *
+ * \see \ref addUpgradeRepo
**/
bool doUpgrade();

@@ -129,7 +131,6 @@ namespace zypp
**/
void doUpdate( );

-
/**
* Unmaintained packages which does not fit to
* the updated system (broken dependencies) will be
@@ -218,6 +219,23 @@ namespace zypp
bool solveSrcPackages() const;

/**
+ * Adding request to perform a dist upgrade restricted to this repository.
+ * This is what e.g. <tt>zypper dup --repo myrepo</tt> should perform.
+ * \see \ref doUpgrade
+ */
+ void addUpgradeRepo( Repository repo_r );
+
+ /**
+ * Remove the upgrade request for this repo.
+ */
+ void removeUpgradeRepo( Repository repo_r );
+
+ /**
+ * Remove all upgrade repo requests.
+ */
+ void removeUpgradeRepos();
+
+ /**
* Adding additional requirement
*
*/
diff --git a/zypp/solver/detail/Resolver.cc b/zypp/solver/detail/Resolver.cc
index 90a6388..2e38463 100644
--- a/zypp/solver/detail/Resolver.cc
+++ b/zypp/solver/detail/Resolver.cc
@@ -294,7 +294,7 @@ void Resolver::solverInit()
bool Resolver::resolvePool()
{
solverInit();
- return _satResolver->resolvePool(_extra_requires, _extra_conflicts,
_addWeak);
+ return _satResolver->resolvePool(_extra_requires, _extra_conflicts,
_addWeak, _upgradeRepos );
}

bool Resolver::resolveQueue( solver::detail::SolverQueueItemList & queue )
diff --git a/zypp/solver/detail/Resolver.h b/zypp/solver/detail/Resolver.h
index bbc8395..8f65722 100644
--- a/zypp/solver/detail/Resolver.h
+++ b/zypp/solver/detail/Resolver.h
@@ -95,6 +95,7 @@ class Resolver : public base::ReferenceCounted, private
base::NonCopyable {

CapabilitySet _extra_requires;
CapabilitySet _extra_conflicts;
+ std::set<Repository> _upgradeRepos;

// Regard dependencies of the item weak onl
PoolItemList _addWeak;
@@ -153,6 +154,11 @@ class Resolver : public base::ReferenceCounted, private
base::NonCopyable {
ResPool pool() const;
void setPool( const ResPool & pool ) { _pool = pool; }

+ void addUpgradeRepo( Repository repo_r ) { if ( repo_r )
_upgradeRepos.insert( repo_r ); }
+ void removeUpgradeRepo( Repository repo_r ) {
_upgradeRepos.erase( repo_r ); }
+ void removeUpgradeRepos() {
_upgradeRepos.clear(); }
+ const std::set<Repository> & upgradeRepos() const { return _upgradeRepos;
}
+
void addExtraRequire( const Capability & capability );
void removeExtraRequire( const Capability & capability );
void addExtraConflict( const Capability & capability );
diff --git a/zypp/solver/detail/SATResolver.cc
b/zypp/solver/detail/SATResolver.cc
index e336d22..e492530 100644
--- a/zypp/solver/detail/SATResolver.cc
+++ b/zypp/solver/detail/SATResolver.cc
@@ -656,7 +656,8 @@ SATResolver::solverEnd()
bool
SATResolver::resolvePool(const CapabilitySet & requires_caps,
const CapabilitySet & conflict_caps,
- const PoolItemList & weakItems)
+ const PoolItemList & weakItems,
+ const std::set<Repository> & upgradeRepos)
{
MIL << "SATResolver::resolvePool()" << endl;

@@ -685,6 +686,13 @@ SATResolver::resolvePool(const CapabilitySet &
requires_caps,
}
}

+ for_( iter, upgradeRepos.begin(), upgradeRepos.end() )
+ {
+ queue_push( &(_jobQueue), SOLVER_DISTUPGRADE );
+ queue_push( &(_jobQueue), iter->get()->repoid );
+ MIL << "Upgrade repo " << *iter << endl;
+ }
+
for (CapabilitySet::const_iterator iter = requires_caps.begin(); iter !=
requires_caps.end(); iter++) {
queue_push( &(_jobQueue), SOLVER_INSTALL_SOLVABLE_PROVIDES );
queue_push( &(_jobQueue), iter->id() );
diff --git a/zypp/solver/detail/SATResolver.h b/zypp/solver/detail/SATResolver.h
index 750731d..5ac68b3 100644
--- a/zypp/solver/detail/SATResolver.h
+++ b/zypp/solver/detail/SATResolver.h
@@ -140,7 +140,8 @@ class SATResolver : public base::ReferenceCounted, private
base::NonCopyable {
// solver run with pool selected items
bool resolvePool(const CapabilitySet & requires_caps,
const CapabilitySet & conflict_caps,
- const PoolItemList & weakItems
+ const PoolItemList & weakItems,
+ const std::set<Repository> & upgradeRepos
);
// solver run with the given request queue
bool resolveQueue(const SolverQueueItemList &requestQueue,
diff --git a/zypp/solver/detail/Testcase.cc b/zypp/solver/detail/Testcase.cc
index 41299dc..0ce55fe 100644
--- a/zypp/solver/detail/Testcase.cc
+++ b/zypp/solver/detail/Testcase.cc
@@ -373,6 +373,7 @@ bool Testcase::createTestcase(Resolver & resolver, bool
dumpPool, bool runSolver
control.addDependencies (resolver.extraRequires(),
resolver.extraConflicts());
control.addDependencies (SystemCheck::instance().requiredSystemCap(),
SystemCheck::instance().conflictSystemCap());
+ control.addUpgradeRepos( resolver.upgradeRepos() );

if (resolver.isUpgradeMode())
control.distupgrade ();
@@ -532,6 +533,14 @@ void HelixControl::addDependencies (const CapabilitySet &
capRequire, const Capa
}
}

+void HelixControl::addUpgradeRepos( const std::set<Repository> &
upgradeRepos_r )
+{
+ for_( it, upgradeRepos_r.begin(), upgradeRepos_r.end() )
+ {
+ *file << "<upgradeRepo name=\"" << it->alias() << "\"/>" << endl;
+ }
+}
+
void HelixControl::distupgrade()
{
*file << "<distupgrade/>" << endl;
diff --git a/zypp/solver/detail/Testcase.h b/zypp/solver/detail/Testcase.h
index dc012c0..d7854b8 100644
--- a/zypp/solver/detail/Testcase.h
+++ b/zypp/solver/detail/Testcase.h
@@ -116,6 +116,7 @@ class HelixControl {
void deleteResolvable (const ResObject::constPtr &resObject,
const ResStatus &status);
void addDependencies (const CapabilitySet &capRequire, const CapabilitySet
&capConflict);
+ void addUpgradeRepos( const std::set<Repository> & upgradeRepos_r );

void distupgrade ();
void verifySystem ();
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: zypp-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages