removed unneeded code
authorJán Kupec <jkupec@suse.cz>
Tue, 13 Apr 2010 15:16:11 +0000 (17:16 +0200)
committerJán Kupec <jkupec@suse.cz>
Tue, 13 Apr 2010 15:16:11 +0000 (17:16 +0200)
TODO: handle non-packages in SolverRequester

src/update.cc
src/update.h

index ef90aa1..036769d 100755 (executable)
@@ -616,171 +616,6 @@ mark_patch_updates( Zypper & zypper, bool skip_interactive )
 
 // ----------------------------------------------------------------------------
 
-// report back when specified selectable can't be updated (bnc #522223)
-// TODO make this function return special Status object that can be both tested
-// and that can report itself as string or xml or terse
-void selectable_update_report(Zypper & zypper, const ui::Selectable & s)
-{
-  PoolItem theone = s.updateCandidateObj();
-  DBG << "best:      " << theone    << endl;
-  if (!theone)
-    theone = s.installedObj();
-
-  PoolItem highest = s.highestAvailableVersionObj();
-  PoolItem installed = s.installedObj();
-  if (!installed)
-    return;
-  DBG << "installed: " << installed << endl;
-  DBG << "highest:   " << highest   << endl;
-
-  // no installable update candidate
-  if (identical(installed, theone))
-  {
-    // no update candidate at all
-    // (!highest means no available objects in repos. bnc #591760)
-    if (!highest || identical(installed, highest))
-    {
-      DBG << "the One (" << theone << ") is installed, skipping." << endl;
-      zypper.out().info(str::form(
-          _("No update candidate for '%s'."), s.name().c_str()));
-    }
-    // update candidate locked
-    else if (s.status() == ui::S_Protected)
-    {
-      DBG << "Newer object exists, but is locked: " << highest << endl;
-
-      ostringstream cmdhint;
-      cmdhint << "zypper removelock " << highest.resolvable()->name();
-
-      zypper.out().info(str::form(
-        _("There is an update candidate for '%s', but it is locked."
-          " Use '%s' to unlock it."),
-        s.name().c_str(), cmdhint.str().c_str()));
-    }
-    // update candidate has different vendor
-    else if (highest->vendor() != installed->vendor())
-    {
-      DBG << "Newer object with different vendor exists: " << highest << endl;
-
-      ostringstream cmdhint;
-      cmdhint << "zypper install " << highest->name()
-          << "-" << highest->edition() << "." << highest->arch();
-
-      zypper.out().info(str::form(
-        _("There is an update candidate for '%s', but it is from different"
-          " vendor. Use '%s' to install this candidate."),
-          s.name().c_str(), cmdhint.str().c_str()));
-    }
-    // update candidate is from low-priority (higher priority number) repo
-    else if (highest->repoInfo().priority() > installed->repoInfo().priority())
-    {
-      DBG << "Newer object exists in lower-priority repo: " << highest << endl;
-
-      ostringstream cmdhint;
-      cmdhint << "zypper install " << highest->name()
-          << "-" << highest->edition() << "." << highest->arch();
-
-      zypper.out().info(str::form(
-        _("There is an update candidate for '%s', but it comes from repository"
-           " with lower priority. Use '%s' to install this candidate."),
-          s.name().c_str(), cmdhint.str().c_str()));
-    }
-  }
-  // got update candidate
-  else
-  {
-    zypper.out().info(
-        str::form(_("Selecting '%s' for update."), s.name().c_str()),
-        Out::HIGH);
-    Capability c(s.name(), Rel::GT, installed->edition(), s.kind());
-    DBG << s << " update: adding requirement " << c << endl;
-  }
-}
-
-// ----------------------------------------------------------------------------
-
-void mark_updates(Zypper & zypper, const ResKindSet & kinds, bool skip_interactive, bool best_effort )
-{
-  MIL << endl;
-
-  ResKindSet localkinds = kinds;
-
-  if (zypper.arguments().empty() || zypper.globalOpts().is_rug_compatible)
-  {
-    for_(kindit, localkinds.begin(), localkinds.end())
-    {
-      if (*kindit == ResKind::package)
-      {
-        MIL << "Computing package update..." << endl;
-        // this will do a complete pacakge update as far as possible
-        God->resolver()->doUpdate();
-        // no need to call Resolver::resolvePool() afterwards
-        zypper.runtimeData().solve_before_commit = false;
-      }
-      else if (*kindit == ResKind::patch)
-      {
-        mark_patch_updates(zypper, skip_interactive);
-      }
-      else
-      {
-        Candidates candidates;
-        find_updates (localkinds, candidates);
-        if (best_effort)
-          invokeOnEach (candidates.begin(), candidates.end(), require_item_update);
-        else
-          invokeOnEach (candidates.begin(), candidates.end(), mark_item_install);
-      }
-    }
-  }
-  // treat arguments as package names (+allow wildcards)
-  else if (!zypper.arguments().empty())
-  {
-    for_(kindit, localkinds.begin(), localkinds.end())
-    {
-      Resolver_Ptr solver = God->resolver();
-      for_(it, zypper.arguments().begin(), zypper.arguments().end())
-      {
-        PoolQuery q;
-        q.addKind(*kindit);
-        q.addAttribute(sat::SolvAttr::name, *it);
-        q.setMatchGlob();
-        q.setInstalledOnly();
-
-        if (q.empty())
-        {
-          if (it->find_first_of("?*") != string::npos) // wildcards used
-            zypper.out().info(str::form(
-                _("No packages matching '%s' are installed."), it->c_str()));
-          else
-            zypper.out().info(str::form(
-                _("Package '%s' is not installed."), it->c_str()));
-          zypper.setExitCode(ZYPPER_EXIT_INF_CAP_NOT_FOUND);
-        }
-        else
-          for_(solvit, q.selectableBegin(), q.selectableEnd())
-          {
-            ui::Selectable::Ptr s = *solvit;
-            PoolItem theone = s->updateCandidateObj();
-            if (!theone)
-              theone = s->installedObj();
-
-            if (!identical(s->installedObj(), theone))
-            {
-              //s->setCandidate(theone); ?
-              //s->setStatus(ui::S_Update); ?
-              Capability c(s->name(), Rel::GT, s->installedObj()->edition(), s->kind());
-              solver->addRequire(c);
-              DBG << *s << " update: adding requirement " << c << endl;
-            }
-            selectable_update_report(zypper, *s);
-          }
-      }
-    }
-  }
-}
-
-// ----------------------------------------------------------------------------
-
 void list_patches_by_issue(Zypper & zypper)
 {
   // lu --issues               - list all issues which need to be fixed
index e91a8af..49051c4 100755 (executable)
@@ -29,20 +29,6 @@ void list_updates(Zypper & zypper,
 void list_patches_by_issue(Zypper & zypper);
 
 /**
- * Mark patches for installation or package for update.
- *
- * \param kinds  set of resolvable types
- * \param skip_interactive
- *               whether to skip updates that need user interaction
- * \param best_effort
- *               only require the resolvable name, let the solver choose
- */
-void mark_updates(Zypper & zypper,
-                  const ResKindSet & kinds,
-                  bool skip_interactive,
-                  bool best_effort);
-
-/**
  * Mark patches for installation according to bugzilla or CVE number specified
  * in --cve or --bugzilla or --bz.
  */