From: Stefan Schubert Date: Mon, 21 Apr 2008 15:26:56 +0000 (+0000) Subject: - removed unneeded Solutions X-Git-Tag: 6.6.0~1017 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1aef8e07fccd3cc1194d79dbd66e2718075dc9f5;p=platform%2Fupstream%2Flibzypp.git - removed unneeded Solutions - added ignore dependencies --- diff --git a/zypp/CMakeLists.txt b/zypp/CMakeLists.txt index bc845f7d6..a8146922d 100644 --- a/zypp/CMakeLists.txt +++ b/zypp/CMakeLists.txt @@ -479,10 +479,6 @@ SET( zypp_solver_detail_SRCS solver/detail/Helper.cc solver/detail/InstallOrder.cc solver/detail/ProblemSolutionIgnore.cc - solver/detail/ProblemSolutionInstall.cc - solver/detail/ProblemSolutionKeep.cc - solver/detail/ProblemSolutionUninstall.cc - solver/detail/ProblemSolutionUnlock.cc solver/detail/ProblemSolutionCombi.cc solver/detail/Resolver.cc solver/detail/ResolverUpgrade.cc @@ -502,10 +498,6 @@ SET( zypp_solver_detail_HEADERS solver/detail/Helper.h solver/detail/InstallOrder.h solver/detail/ProblemSolutionIgnore.h - solver/detail/ProblemSolutionInstall.h - solver/detail/ProblemSolutionKeep.h - solver/detail/ProblemSolutionUninstall.h - solver/detail/ProblemSolutionUnlock.h solver/detail/ProblemSolutionCombi.h solver/detail/Resolver.h solver/detail/SolutionAction.h diff --git a/zypp/solver/detail/ProblemSolutionIgnore.cc b/zypp/solver/detail/ProblemSolutionIgnore.cc index 0cbb3733d..4d9855439 100644 --- a/zypp/solver/detail/ProblemSolutionIgnore.cc +++ b/zypp/solver/detail/ProblemSolutionIgnore.cc @@ -49,7 +49,7 @@ ProblemSolutionIgnore::ProblemSolutionIgnore( ResolverProblem_Ptr parent, : ProblemSolution (parent, "", "") { // TranslatorExplanation %s = name of package, patch, selection ... - _description = str::form (_("Ignore some dependencies for %s"), item->name().c_str() ); + _description = str::form (_("Ignore some dependencies of %s"), item->name().c_str() ); // addAction ( new InjectSolutionAction (item, capability, REQUIRES)); } diff --git a/zypp/solver/detail/ProblemSolutionInstall.cc b/zypp/solver/detail/ProblemSolutionInstall.cc deleted file mode 100644 index 6a0723f60..000000000 --- a/zypp/solver/detail/ProblemSolutionInstall.cc +++ /dev/null @@ -1,88 +0,0 @@ - -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ -/* ProblemSolution.cc - * - * Easy-to use interface to the ZYPP dependency resolver - * - * Copyright (C) 2000-2002 Ximian, Inc. - * Copyright (C) 2005 SUSE Linux Products GmbH - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * 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., 59 Temple Place, Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#include - -#include "zypp/base/String.h" -#include "zypp/base/Gettext.h" - -#include "zypp/solver/detail/ProblemSolutionInstall.h" -#include "zypp/solver/detail/Helper.h" - -using namespace std; - -///////////////////////////////////////////////////////////////////////// -namespace zypp -{ /////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////// - namespace solver - { ///////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////// - namespace detail - { /////////////////////////////////////////////////////////////////// - -IMPL_PTR_TYPE(ProblemSolutionInstall); - -//--------------------------------------------------------------------------- - -ProblemSolutionInstall::ProblemSolutionInstall( ResolverProblem_Ptr parent, - PoolItem item ) - : ProblemSolution (parent, "", "") -{ - // TranslatorExplanation %s = name of package, patch, selection ... - _description = str::form (_("install %s"), item->name().c_str() ); - // TranslatorExplanation %s = name of package, patch, selection ... - _details = str::form (_("install %s"), Helper::itemToString (item).c_str()); - - addAction ( new TransactionSolutionAction (item, - INSTALL)); -} - -ProblemSolutionInstall::ProblemSolutionInstall( ResolverProblem_Ptr parent, - PoolItemList & itemList ) - : ProblemSolution (parent, "", "") -{ - _description = _("Install missing resolvables"); - - for (PoolItemList::iterator iter = itemList.begin(); - iter != itemList.end(); iter++) { - PoolItem item = *iter; - addAction ( new TransactionSolutionAction (item, INSTALL)); - } - - ostringstream details; - details << _actions; - _details = details.str(); - -} - - /////////////////////////////////////////////////////////////////// - };// namespace detail - ///////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////// - };// namespace solver - /////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////// -};// namespace zypp -///////////////////////////////////////////////////////////////////////// diff --git a/zypp/solver/detail/ProblemSolutionInstall.h b/zypp/solver/detail/ProblemSolutionInstall.h deleted file mode 100644 index 6b76d2de4..000000000 --- a/zypp/solver/detail/ProblemSolutionInstall.h +++ /dev/null @@ -1,65 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ -/* Resolver_problems.cc - * - * Copyright (C) 2000-2002 Ximian, Inc. - * Copyright (C) 2005 SUSE Linux Products GmbH - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * 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., 59 Temple Place, Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#ifndef ZYPP_SOLVER_DETAIL_PROBLEMSOLUTIONINSTALL_H -#define ZYPP_SOLVER_DETAIL_PROBLEMSOLUTIONINSTALL_H - -#include "zypp/ProblemSolution.h" -#include "zypp/solver/detail/Types.h" - -///////////////////////////////////////////////////////////////////////// -namespace zypp -{ /////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////// - namespace solver - { ///////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////// - namespace detail - { /////////////////////////////////////////////////////////////////// - - /** - * Class representing one possible solution to one problem found during resolving - * This problem solution installs one or more items - * - **/ - class ProblemSolutionInstall : public ProblemSolution - { - public: - - /** - * Constructor. - **/ - ProblemSolutionInstall( ResolverProblem_Ptr parent, PoolItem item); - ProblemSolutionInstall( ResolverProblem_Ptr parent, PoolItemList & itemlist ); - }; - - /////////////////////////////////////////////////////////////////// - };// namespace detail - ///////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////// - };// namespace solver - /////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////// -};// namespace zypp -///////////////////////////////////////////////////////////////////////// - -#endif // ZYPP_SOLVER_DETAIL_PROBLEMSOLUTIONAINSTALL_H - diff --git a/zypp/solver/detail/ProblemSolutionKeep.cc b/zypp/solver/detail/ProblemSolutionKeep.cc deleted file mode 100644 index b7f589c4f..000000000 --- a/zypp/solver/detail/ProblemSolutionKeep.cc +++ /dev/null @@ -1,87 +0,0 @@ - -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ -/* ProblemSolution.cc - * - * Easy-to use interface to the ZYPP dependency resolver - * - * Copyright (C) 2000-2002 Ximian, Inc. - * Copyright (C) 2005 SUSE Linux Products GmbH - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * 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., 59 Temple Place, Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#include - -#include "zypp/base/String.h" -#include "zypp/base/Gettext.h" -#include "zypp/solver/detail/ProblemSolutionKeep.h" -#include "zypp/solver/detail/Helper.h" - -using namespace std; - -///////////////////////////////////////////////////////////////////////// -namespace zypp -{ /////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////// - namespace solver - { ///////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////// - namespace detail - { /////////////////////////////////////////////////////////////////// - -IMPL_PTR_TYPE(ProblemSolutionKeep); - -//--------------------------------------------------------------------------- - -ProblemSolutionKeep::ProblemSolutionKeep( ResolverProblem_Ptr parent, - PoolItem item ) - : ProblemSolution (parent, "", "") -{ - // TranslatorExplanation %s = name of package, patch, selection ... - _description = str::form (_("keep %s"), item->name().c_str() ); - // TranslatorExplanation %s = name of package, patch, selection ... - _details = str::form (_("keep %s"), Helper::itemToString (item).c_str()); - - addAction ( new TransactionSolutionAction (item, - KEEP)); -} - -ProblemSolutionKeep::ProblemSolutionKeep( ResolverProblem_Ptr parent, - PoolItemList & itemList ) - : ProblemSolution (parent, "", "") -{ - _description = _("Keep resolvables"); - - for (PoolItemList::iterator iter = itemList.begin(); - iter != itemList.end(); iter++) { - PoolItem item = *iter; - addAction ( new TransactionSolutionAction (item, KEEP)); - } - - ostringstream details; - details << _actions; - _details = details.str(); - -} - - /////////////////////////////////////////////////////////////////// - };// namespace detail - ///////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////// - };// namespace solver - /////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////// -};// namespace zypp -///////////////////////////////////////////////////////////////////////// diff --git a/zypp/solver/detail/ProblemSolutionKeep.h b/zypp/solver/detail/ProblemSolutionKeep.h deleted file mode 100644 index e333a6d04..000000000 --- a/zypp/solver/detail/ProblemSolutionKeep.h +++ /dev/null @@ -1,65 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ -/* Resolver_problems.cc - * - * Copyright (C) 2000-2002 Ximian, Inc. - * Copyright (C) 2005 SUSE Linux Products GmbH - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * 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., 59 Temple Place, Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#ifndef ZYPP_SOLVER_DETAIL_PROBLEMSOLUTIONKEEP_H -#define ZYPP_SOLVER_DETAIL_PROBLEMSOLUTIONKEEP_H - -#include "zypp/ProblemSolution.h" -#include "zypp/solver/detail/Types.h" - -///////////////////////////////////////////////////////////////////////// -namespace zypp -{ /////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////// - namespace solver - { ///////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////// - namespace detail - { /////////////////////////////////////////////////////////////////// - - /** - * Class representing one possible solution to one problem found during resolving - * This problem solution keeps one or more items - * - **/ - class ProblemSolutionKeep : public ProblemSolution - { - public: - - /** - * Constructor. - **/ - ProblemSolutionKeep( ResolverProblem_Ptr parent, PoolItem item); - ProblemSolutionKeep( ResolverProblem_Ptr parent, PoolItemList & itemlist ); - }; - - /////////////////////////////////////////////////////////////////// - };// namespace detail - ///////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////// - };// namespace solver - /////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////// -};// namespace zypp -///////////////////////////////////////////////////////////////////////// - -#endif // ZYPP_SOLVER_DETAIL_PROBLEMSOLUTIONAKEEP_H - diff --git a/zypp/solver/detail/ProblemSolutionUninstall.cc b/zypp/solver/detail/ProblemSolutionUninstall.cc deleted file mode 100644 index 662087c4b..000000000 --- a/zypp/solver/detail/ProblemSolutionUninstall.cc +++ /dev/null @@ -1,102 +0,0 @@ - -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ -/* ProblemSolution.cc - * - * Easy-to use interface to the ZYPP dependency resolver - * - * Copyright (C) 2000-2002 Ximian, Inc. - * Copyright (C) 2005 SUSE Linux Products GmbH - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * 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., 59 Temple Place, Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#include - -#include "zypp/base/String.h" -#include "zypp/base/Gettext.h" -#include "zypp/solver/detail/ProblemSolutionUninstall.h" -#include "zypp/solver/detail/Helper.h" - -using namespace std; - -///////////////////////////////////////////////////////////////////////// -namespace zypp -{ /////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////// - namespace solver - { ///////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////// - namespace detail - { /////////////////////////////////////////////////////////////////// - -IMPL_PTR_TYPE(ProblemSolutionUninstall); - -//--------------------------------------------------------------------------- -ProblemSolutionUninstall::ProblemSolutionUninstall( ResolverProblem_Ptr parent, PoolItem item, - const std::string & descr, - const std::string & detail) - : ProblemSolution (parent, descr, detail) -{ - addAction ( new TransactionSolutionAction (item, REMOVE)); -} - - - -ProblemSolutionUninstall::ProblemSolutionUninstall( ResolverProblem_Ptr parent, - PoolItem item) - : ProblemSolution (parent, "", "") -{ - ResStatus status = item.status(); - if (status.isInstalled()) { - // TranslatorExplanation %s = name of package, patch, selection ... - _description = str::form (_("delete %s"), item->name().c_str() ); - // TranslatorExplanation %s = name of package, patch, selection ... - _details = str::form (_("delete %s"), Helper::itemToString (item).c_str()); - } else { - // TranslatorExplanation %s = name of package, patch, selection ... - _description = str::form (_("do not install %s"), item->name().c_str() ); - // TranslatorExplanation %s = name of package, patch, selection ... - _details = str::form (_("do not install %s"), Helper::itemToString (item).c_str()); - } - - addAction ( new TransactionSolutionAction (item, REMOVE)); -} - -ProblemSolutionUninstall::ProblemSolutionUninstall( ResolverProblem_Ptr parent, - PoolItemList & itemlist) - : ProblemSolution (parent, "", "") -{ - _description = _("Do not install or delete the resolvables concerned"); - - for (PoolItemList::iterator iter = itemlist.begin(); - iter != itemlist.end(); iter++) { - PoolItem item = *iter; - addAction ( new TransactionSolutionAction (item, REMOVE)); - } - - ostringstream details; - details << _actions; - _details = details.str(); -} - - /////////////////////////////////////////////////////////////////// - };// namespace detail - ///////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////// - };// namespace solver - /////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////// -};// namespace zypp -///////////////////////////////////////////////////////////////////////// diff --git a/zypp/solver/detail/ProblemSolutionUninstall.h b/zypp/solver/detail/ProblemSolutionUninstall.h deleted file mode 100644 index 710d7973d..000000000 --- a/zypp/solver/detail/ProblemSolutionUninstall.h +++ /dev/null @@ -1,68 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ -/* Resolver_problems.cc - * - * Copyright (C) 2000-2002 Ximian, Inc. - * Copyright (C) 2005 SUSE Linux Products GmbH - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * 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., 59 Temple Place, Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#ifndef ZYPP_SOLVER_DETAIL_PROBLEMSOLUTIONUNINSTALL_H -#define ZYPP_SOLVER_DETAIL_PROBLEMSOLUTIONUNINSTALL_H - -#include "zypp/solver/detail/Types.h" -#include "zypp/ProblemSolution.h" - -///////////////////////////////////////////////////////////////////////// -namespace zypp -{ /////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////// - namespace solver - { ///////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////// - namespace detail - { /////////////////////////////////////////////////////////////////// - - /** - * Class representing one possible solution to one problem found during resolving - * This problem solution uninstalls one or more items - * - **/ - class ProblemSolutionUninstall : public ProblemSolution - { - public: - - /** - * Constructor. - **/ - ProblemSolutionUninstall( ResolverProblem_Ptr parent, PoolItem item); - ProblemSolutionUninstall( ResolverProblem_Ptr parent, PoolItem item, - const std::string & descr, - const std::string & detail); - ProblemSolutionUninstall( ResolverProblem_Ptr parent, PoolItemList & itemlist); - }; - - /////////////////////////////////////////////////////////////////// - };// namespace detail - ///////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////// - };// namespace solver - /////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////// -};// namespace zypp -///////////////////////////////////////////////////////////////////////// - -#endif // ZYPP_SOLVER_DETAIL_PROBLEMSOLUTIONAUNINSTALL_H - diff --git a/zypp/solver/detail/ProblemSolutionUnlock.cc b/zypp/solver/detail/ProblemSolutionUnlock.cc deleted file mode 100644 index d06a8476a..000000000 --- a/zypp/solver/detail/ProblemSolutionUnlock.cc +++ /dev/null @@ -1,112 +0,0 @@ - -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ -/* ProblemSolution.cc - * - * Easy-to use interface to the ZYPP dependency resolver - * - * Copyright (C) 2000-2002 Ximian, Inc. - * Copyright (C) 2005 SUSE Linux Products GmbH - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * 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., 59 Temple Place, Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#include - -#include "zypp/base/String.h" -#include "zypp/base/Gettext.h" -#include "zypp/base/Algorithm.h" -#include "zypp/ResPool.h" -#include "zypp/ResFilters.h" -#include "zypp/solver/detail/ProblemSolutionUnlock.h" - -using namespace std; - -///////////////////////////////////////////////////////////////////////// -namespace zypp -{ /////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////// - namespace solver - { ///////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////// - namespace detail - { /////////////////////////////////////////////////////////////////// - -IMPL_PTR_TYPE(ProblemSolutionUnlock); - -//--------------------------------------------------------------------------- - -struct LockReset : public resfilter::PoolItemFilterFunctor -{ - ProblemSolutionUnlock & _problemSolutionUnlock; - LockReset( ProblemSolutionUnlock & solution ) - : _problemSolutionUnlock( solution ) - { } - - bool operator()( PoolItem item ) - { - _problemSolutionUnlock.addAction ( new TransactionSolutionAction (item, UNLOCK)); - return true; - } -}; - - -ProblemSolutionUnlock::ProblemSolutionUnlock( ResolverProblem_Ptr parent, - const ResPool & pool) - : ProblemSolution (parent, "", "") -{ - _description = _("unlock all resolvables"); - LockReset lockReset (*this); - - invokeOnEach ( pool.begin(), pool.end(), - resfilter::ByLock( ), - functor::functorRef(lockReset)); -} - -ProblemSolutionUnlock::ProblemSolutionUnlock( ResolverProblem_Ptr parent, - PoolItem item) - : ProblemSolution (parent, "", "") -{ - // TranslatorExplanation %s = name of package, patch, selection ... - _description = str::form (_("unlock %s"), item->name().c_str() ); - - addAction ( new TransactionSolutionAction (item, UNLOCK)); -} - -ProblemSolutionUnlock::ProblemSolutionUnlock( ResolverProblem_Ptr parent, - PoolItemList & itemlist) - : ProblemSolution (parent, "", "") -{ - _description = _("Unlock these resolvables"); - - for (PoolItemList::iterator iter = itemlist.begin(); - iter != itemlist.end(); iter++) { - PoolItem item = *iter; - addAction ( new TransactionSolutionAction (item, UNLOCK)); - } - - ostringstream details; - details << _actions; - _details = details.str(); -} - - /////////////////////////////////////////////////////////////////// - };// namespace detail - ///////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////// - };// namespace solver - /////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////// -};// namespace zypp -///////////////////////////////////////////////////////////////////////// diff --git a/zypp/solver/detail/ProblemSolutionUnlock.h b/zypp/solver/detail/ProblemSolutionUnlock.h deleted file mode 100644 index 1648e6470..000000000 --- a/zypp/solver/detail/ProblemSolutionUnlock.h +++ /dev/null @@ -1,66 +0,0 @@ -/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */ -/* Resolver_problems.cc - * - * Copyright (C) 2000-2002 Ximian, Inc. - * Copyright (C) 2005 SUSE Linux Products GmbH - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License, - * version 2, as published by the Free Software Foundation. - * - * 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., 59 Temple Place, Suite 330, Boston, MA - * 02111-1307, USA. - */ - -#ifndef ZYPP_SOLVER_DETAIL_PROBLEMSOLUTIONUNLOCK_H -#define ZYPP_SOLVER_DETAIL_PROBLEMSOLUTIONUNLOCK_H - -#include "zypp/solver/detail/Types.h" -#include "zypp/ProblemSolution.h" - -///////////////////////////////////////////////////////////////////////// -namespace zypp -{ /////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////// - namespace solver - { ///////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////// - namespace detail - { /////////////////////////////////////////////////////////////////// - - /** - * Class representing one possible solution to one problem found during resolving - * This problem solution unlocks one or more items - * - **/ - class ProblemSolutionUnlock : public ProblemSolution - { - public: - - /** - * Constructor. - **/ - ProblemSolutionUnlock( ResolverProblem_Ptr parent, PoolItem item); - ProblemSolutionUnlock( ResolverProblem_Ptr parent, PoolItemList & itemlist); - ProblemSolutionUnlock( ResolverProblem_Ptr parent, const ResPool & pool); - }; - - /////////////////////////////////////////////////////////////////// - };// namespace detail - ///////////////////////////////////////////////////////////////////// - ///////////////////////////////////////////////////////////////////// - };// namespace solver - /////////////////////////////////////////////////////////////////////// - /////////////////////////////////////////////////////////////////////// -};// namespace zypp -///////////////////////////////////////////////////////////////////////// - -#endif // ZYPP_SOLVER_DETAIL_PROBLEMSOLUTIONAUNLOCK_H - diff --git a/zypp/solver/detail/Resolver.cc b/zypp/solver/detail/Resolver.cc index 495b390aa..508ca0be3 100644 --- a/zypp/solver/detail/Resolver.cc +++ b/zypp/solver/detail/Resolver.cc @@ -261,14 +261,14 @@ bool Resolver::resolvePool() { solverInit(); - return _satResolver->resolvePool(_extra_requires, _extra_conflicts); + return _satResolver->resolvePool(_extra_requires, _extra_conflicts, _addWeak); } bool Resolver::resolveQueue(solver::detail::SolverQueueItemList & queue) { solverInit(); - return _satResolver->resolveQueue(queue); + return _satResolver->resolveQueue(queue, _addWeak); } diff --git a/zypp/solver/detail/SATResolver.cc b/zypp/solver/detail/SATResolver.cc index 472efd996..3dab46803 100644 --- a/zypp/solver/detail/SATResolver.cc +++ b/zypp/solver/detail/SATResolver.cc @@ -35,6 +35,7 @@ #include "zypp/sat/WhatProvides.h" #include "zypp/solver/detail/SATResolver.h" #include "zypp/solver/detail/ProblemSolutionCombi.h" +#include "zypp/solver/detail/ProblemSolutionIgnore.h" extern "C" { #include "satsolver/repo_solv.h" @@ -470,6 +471,9 @@ SATResolver::solving() sat::Pool::instance().prepare(); + // Add ignoring request + + // Solve ! MIL << "Starting solving...." << endl; MIL << *this; @@ -576,7 +580,7 @@ SATResolver::solving() void -SATResolver::solverInit() +SATResolver::solverInit(const PoolItemList & weakItems) { SATCollectTransact info (*this); @@ -597,6 +601,16 @@ SATResolver::solverInit() invokeOnEach ( _pool.begin(), _pool.end(), functor::functorRef(info) ); + + for (PoolItemList::const_iterator iter = weakItems.begin(); iter != weakItems.end(); iter++) { + Id id = (*iter)->satSolvable().id(); + if (id == ID_NULL) { + ERR << "Weaken: " << *iter << " not found" << endl; + } + MIL << "Weaken dependencies of " << *iter << " with the SAT-Pool ID: " << id << endl; + queue_push( &(_jobQueue), SOLVER_WEAKEN_SOLVABLE_DEPS ); + queue_push( &(_jobQueue), id ); + } } void @@ -611,16 +625,15 @@ SATResolver::solverEnd() bool SATResolver::resolvePool(const CapabilitySet & requires_caps, - const CapabilitySet & conflict_caps) + const CapabilitySet & conflict_caps, + const PoolItemList & weakItems) { MIL << "SATResolver::resolvePool()" << endl; // initialize - solverInit(); + solverInit(weakItems); for (PoolItemList::const_iterator iter = _items_to_install.begin(); iter != _items_to_install.end(); iter++) { - PoolItem r = *iter; - Id id = (*iter)->satSolvable().id(); if (id == ID_NULL) { ERR << "Install: " << *iter << " not found" << endl; @@ -631,8 +644,6 @@ SATResolver::resolvePool(const CapabilitySet & requires_caps, } for (PoolItemList::const_iterator iter = _items_to_update.begin(); iter != _items_to_update.end(); iter++) { - PoolItem r = *iter; - Id id = (*iter)->satSolvable().id(); if (id == ID_NULL) { ERR << "Update explicit: " << *iter << " not found" << endl; @@ -699,12 +710,13 @@ SATResolver::resolvePool(const CapabilitySet & requires_caps, bool -SATResolver::resolveQueue(const SolverQueueItemList &requestQueue) +SATResolver::resolveQueue(const SolverQueueItemList &requestQueue, + const PoolItemList & weakItems) { MIL << "SATResolver::resolvQueue()" << endl; // initialize - solverInit(); + solverInit(weakItems); // generate solver queue for (SolverQueueItemList::const_iterator iter = requestQueue.begin(); iter != requestQueue.end(); iter++) { @@ -728,7 +740,7 @@ bool SATResolver::doUpdate() MIL << "SATResolver::doUpdate()" << endl; // initialize - solverInit(); + solverInit(PoolItemList()); _solv = solver_create( _SATPool, sat::Pool::instance().systemRepo().get() ); _solv->vendorCheckCb = &vendorCheck; @@ -827,7 +839,7 @@ struct FindPackage : public resfilter::ResObjectFilterFunctor }; -string SATResolver::SATprobleminfoString(Id problem, string &detail) +string SATResolver::SATprobleminfoString(Id problem, string &detail, Id &ignoreId) { string ret; Pool *pool = _solv->pool; @@ -835,6 +847,7 @@ string SATResolver::SATprobleminfoString(Id problem, string &detail) Id dep, source, target; Solvable *s, *s2; + ignoreId = 0; probr = solver_findproblemrule(_solv, problem); switch (solver_problemruleinfo(_solv, &(_jobQueue), probr, &dep, &source, &target)) { @@ -872,6 +885,7 @@ string SATResolver::SATprobleminfoString(Id problem, string &detail) ret = str::form (_("%s obsoletes %s provided by %s"), solvable2str(pool, s), dep2str(pool, dep), solvable2str(pool, s2)); break; case SOLVER_PROBLEM_DEP_PROVIDERS_NOT_INSTALLABLE: + ignoreId = source; // for setting weak dependencies s = pool_id2solvable(pool, source); Capability cap(dep); sat::WhatProvides possibleProviders(cap); @@ -946,10 +960,12 @@ SATResolver::problems () MIL << "Problem " << pcnt++ << ":" << endl; MIL << "====================================" << endl; string detail; - string whatString = SATprobleminfoString (problem,detail); + Id ignorId; + string whatString = SATprobleminfoString (problem,detail,ignorId); MIL << whatString << endl; MIL << "------------------------------------" << endl; ResolverProblem_Ptr resolverProblem = new ResolverProblem (whatString, detail); + solution = 0; while ((solution = solver_next_solution(_solv, problem, solution)) != 0) { element = 0; @@ -1145,6 +1161,15 @@ SATResolver::problems () problemSolution->actionCount() > 1 ? true : false); // Solutions with more than 1 action will be shown first. MIL << "------------------------------------" << endl; } + + if (ignorId > 0) { + // There is a possibility to ignore this error by setting weak dependencies + PoolItem item = _pool.find (sat::Solvable(ignorId)); + ProblemSolutionIgnore *problemSolution = new ProblemSolutionIgnore(resolverProblem, item); + resolverProblem->addSolution (problemSolution, + false); // Solutions will be shown at the end + } + // save problem resolverProblems.push_back (resolverProblem); } diff --git a/zypp/solver/detail/SATResolver.h b/zypp/solver/detail/SATResolver.h index d6a31d204..6494d7c36 100644 --- a/zypp/solver/detail/SATResolver.h +++ b/zypp/solver/detail/SATResolver.h @@ -84,11 +84,11 @@ class SATResolver : public base::ReferenceCounted, private base::NonCopyable { bool _onlyRequires; // true: consider required packages only // ---------------------------------- methods - std::string SATprobleminfoString (Id problem, std::string &detail); + std::string SATprobleminfoString (Id problem, std::string &detail, Id &ignoreId); void resetItemTransaction (PoolItem item); // Create a SAT solver and reset solver selection in the pool (Collecting - void solverInit(); + void solverInit(const PoolItemList & weakItems); // common solver run with the _jobQueue; Save results back to pool bool solving(); // cleanup solver @@ -110,9 +110,11 @@ 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 CapabilitySet & conflict_caps, + const PoolItemList & weakItems); // solver run with the given request queue - bool resolveQueue(const SolverQueueItemList &requestQueue); + bool resolveQueue(const SolverQueueItemList &requestQueue, + const PoolItemList & weakItems); // searching for new packages bool doUpdate();