Mailinglist Archive: zypp-commit (171 mails)

< Previous Next >
[zypp-commit] <zypper> master : Using ui::Selectable to install patches.
  • From: Ján Kupec <jkupec@xxxxxxx>
  • Date: Sun, 28 Jun 2009 21:36:24 +0200
  • Message-id: <E1MLGlf-0001g1-6B@xxxxxxxxxxxxxxxx>
ref: refs/heads/master
commit 50290f31197dfcd286b3c3bd3399cca76c80dc80
Author: Ján Kupec <jkupec@xxxxxxx>
Date: Sun Jun 28 21:36:24 2009 +0200

Using ui::Selectable to install patches.

- using Selectable::isBroken() to decide whether to install a patch
- using Selectable::setToInstall() to install them (bnc #498814)
---
src/update.cc | 27 ++++++++++++++++-----------
src/update.h | 2 ++
2 files changed, 18 insertions(+), 11 deletions(-)

diff --git a/src/update.cc b/src/update.cc
index d37ed25..985e977 100755
--- a/src/update.cc
+++ b/src/update.cc
@@ -629,12 +629,13 @@ void xml_list_updates(const ResKindSet & kinds)
// ----------------------------------------------------------------------------

static bool
-mark_patch_update(const PoolItem & pi, bool skip_interactive, bool
ignore_affects_pm)
+mark_patch_update(ui::Selectable & s,
+ bool skip_interactive, bool ignore_affects_pm)
{
- Patch::constPtr patch = asKind<Patch>(pi.resolvable());
- if (pi.isRelevant() && !pi.isSatisfied())
+ Patch::constPtr patch = asKind<Patch>(s.candidateObj());
+ if (s.isBroken())
{
- DBG << "patch " << patch->name() << " " << ignore_affects_pm << ", "
+ DBG << "candidate patch " << patch->name() << " " << ignore_affects_pm <<
", "
<< patch->restartSuggested() << endl;
if (ignore_affects_pm || patch->restartSuggested())
{
@@ -646,15 +647,20 @@ mark_patch_update(const PoolItem & pi, bool
skip_interactive, bool ignore_affect
// license to confirm and --skip-interactive is requested.
Zypper::instance()->out().warning(str::form(
// translators: %s is the name of a patch
- _("'%s' is interactive, skipping."), patch->name().c_str()));
+ _("'%s' is interactive, skipping."),
+ string(patch->name() + string("-") +
patch->edition().asString()).c_str()));
return false;
}
else
{
- mark_item_install(pi);
- return true;
+ bool result = s.setToInstall();
+ if (!result)
+ ERR << "Marking " << s << " for installation failed" << endl;
+ return result;
}
}
+ else
+ XXX << "patch " << s.name() << "is satisfied or not relevant" << endl;
}

return false;
@@ -679,7 +685,7 @@ mark_patch_updates( Zypper & zypper, bool skip_interactive )
for_(it, God->pool().proxy().byKindBegin(ResKind::patch),
God->pool().proxy().byKindEnd (ResKind::patch))
{
- if (mark_patch_update(findTheBest(God->pool(),**it), skip_interactive,
ignore_affects_pm))
+ if (mark_patch_update(**it, skip_interactive, ignore_affects_pm))
any_marked = true;
}
}
@@ -710,9 +716,8 @@ mark_patch_updates( Zypper & zypper, bool skip_interactive )
else
{
for_(pit, q.selectableBegin(), q.selectableEnd())
- {
- any_marked = mark_patch_update(findTheBest(God->pool(),**pit),
skip_interactive, ignore_affects_pm);
- }
+ if ( mark_patch_update(**pit, skip_interactive, ignore_affects_pm))
+ any_marked = true;
}
}
}
diff --git a/src/update.h b/src/update.h
index cc3fd16..e980bcb 100755
--- a/src/update.h
+++ b/src/update.h
@@ -44,6 +44,7 @@ void mark_updates(Zypper & zypper,
* Similar to zypp::solver::detail::Helper::findUpdateItem()
* but allows changing the vendor and does not allow chaning arch.
*/
+# warning get rid of findUpdateItem, make new API in zypp
zypp::PoolItem findUpdateItem(const zypp::ResPool & pool, const zypp::PoolItem
item);

/**
@@ -54,4 +55,5 @@ zypp::PoolItem findUpdateItem(const zypp::ResPool & pool,
const zypp::PoolItem i
* the best compatible instead.
* \todo All of this should be done in libzypp, using defined policies.
*/
+# warning get rid of findTheBest, make new API in zypp
zypp::PoolItem findTheBest( const zypp::ResPool & pool, const
zypp::ui::Selectable & s);
--
To unsubscribe, e-mail: zypp-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: zypp-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages