[libzypp] Applying solution selected by user.

I developing Packagekit’s zypper backend integration with Bonsole and daemonUI for interactively dependency handling. One think I cannot repair is … dependency handling. Everything looks well. User could get list of problems, select solutions, see new list of problems, select solution and packagekit reports progress correctly. Problem is: if I had select to remove some packages for resolve problems, it will not be removed from the system and new packages is installed.

I put code below:


/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
 *
 * Copyright (c) 2007 Novell, Inc.
 * Copyright (c) 2007 Boyd Timothy <btimothy@gmail.com>
 * Copyright (c) 2007-2008 Stefan Haas <shaas@suse.de>
 * Copyright (c) 2007-2008 Scott Reeves <sreeves@novell.com>
 *
 * Licensed under the GNU General Public License Version 2
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
.....
 ProblemSolutionList::const_iterator it3;
    ResolverProblem problem = **it2;
    it3 = problem.solutions().begin();
    
    for (; it3 != problem.solutions().end(); ++it3) {
    
      if (get_full_resolution_text(**it3) == (*it).selected) {
   
        apply = true;
        ProblemSolution solution = **it3;
        helper->solution_list->push_back(&solution);
      }
    }
  }
  
  if (apply)
  
    helper->resolver->applySolutions(*helper->solution_list);

You can see whole source at: https://github.com/nintyfan/PackageKit . See backends/zypp/pk-zypp-backend.cpp .

Everything seems to work, but packages aren’t removed if it needs to be removed to install another package. I think I must do something additional to adding solvable to resolver. It’s hard, because when I add solution and call resolve libzypp function, function returns true.

I solved this problems.

Look how it working:
https://www.youtube.com/watch?v=tktXPvD9Hw8

Please, test.
https://github.com/hughsie/PackageKit/issues/415
https://github.com/hughsie/PackageKit/pull/432