libzypp
11.13.5
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
libzypp
Welcome to libzypp
Code Pitfalls - Frequently made mistakes
Code Snippets
Environment Variables
Testing for provided features.
Notes on revisions
Extending ZYpp: Plugins and Hooks
Services
Solver - Vendor protection
Writing and tunning testcases
Libzypp and threads
Todo List
Deprecated List
Modules
Namespaces
Classes
Files
File List
zypp
base
media
misc
parser
pool
repo
sat
solver
detail
Helper.cc
Helper.h
InstallOrder.cc
InstallOrder.h
ProblemSolutionCombi.cc
ProblemSolutionCombi.h
ProblemSolutionIgnore.cc
ProblemSolutionIgnore.h
Resolver.cc
Resolver.h
SATResolver.cc
SATResolver.h
SolutionAction.cc
SolutionAction.h
SolverQueueItem.cc
SolverQueueItem.h
SolverQueueItemDelete.cc
SolverQueueItemDelete.h
SolverQueueItemInstall.cc
SolverQueueItemInstall.h
SolverQueueItemInstallOneOf.cc
SolverQueueItemInstallOneOf.h
SolverQueueItemLock.cc
SolverQueueItemLock.h
SolverQueueItemUpdate.cc
SolverQueueItemUpdate.h
SystemCheck.cc
SystemCheck.h
Testcase.cc
Testcase.h
Types.h
libzypp_solver.h
target
thread
ui
url
ws
zypp_detail
APIConfig.h
Arch.cc
Arch.h
AutoDispose.h
Bit.h
ByteCount.cc
ByteCount.h
Callback.h
Capabilities.cc
Capabilities.h
Capability.cc
Capability.h
CapMatch.cc
CapMatch.h
Changelog.cc
Changelog.h
CheckSum.cc
CheckSum.h
CountryCode.cc
CountryCode.h
Date.cc
Date.h
Dep.cc
Dep.h
Digest.cc
Digest.h
DiskUsage.cc
DiskUsage.h
DiskUsageCounter.cc
DiskUsageCounter.h
DownloadMode.cc
DownloadMode.h
Edition.cc
Edition.h
ExternalProgram.cc
ExternalProgram.h
Fetcher.cc
Fetcher.h
FileChecker.cc
FileChecker.h
Filter.h
Glob.cc
Glob.h
HistoryLog.cc
HistoryLog.h
HistoryLogData.cc
HistoryLogData.h
IdString.cc
IdString.h
IdStringType.h
InstanceId.cc
InstanceId.h
KeyContext.h
KeyRing.cc
KeyRing.h
KVMap.h
LanguageCode.cc
LanguageCode.h
Locale.cc
Locale.h
Locks.cc
Locks.h
ManagedFile.h
MediaProducts.cc
MediaProducts.h
MediaSetAccess.cc
MediaSetAccess.h
Misc.h
OnMediaLocation.cc
OnMediaLocation.h
Package.cc
Package.h
PackageKeyword.h
Patch.cc
Patch.h
PathInfo.cc
PathInfo.h
Pathname.cc
Pathname.h
Pattern.cc
Pattern.h
PluginFrame.cc
PluginFrame.h
PluginFrameException.cc
PluginFrameException.h
PluginScript.cc
PluginScript.h
PluginScriptException.cc
PluginScriptException.h
PoolItem.cc
PoolItem.h
PoolItemBest.cc
PoolItemBest.h
PoolQuery.cc
PoolQuery.h
PoolQueryResult.cc
PoolQueryResult.h
PoolQueryUtil.tcc
ProblemSolution.cc
ProblemSolution.h
ProblemTypes.h
Product.cc
Product.h
ProgressData.cc
ProgressData.h
ProvideFilePolicy.cc
ProvideFilePolicy.h
PublicKey.cc
PublicKey.h
Range.cc
Range.h
Rel.cc
Rel.h
RelCompare.h
RepoInfo.cc
RepoInfo.h
RepoManager.cc
RepoManager.h
Repository.cc
Repository.h
RepoStatus.cc
RepoStatus.h
ResFilters.h
ResKind.cc
ResKind.h
ResObject.cc
ResObject.h
ResObjects.h
Resolvable.cc
Resolvable.h
Resolver.cc
Resolver.h
ResolverProblem.cc
ResolverProblem.h
ResPool.cc
ResPool.h
ResPoolProxy.cc
ResPoolProxy.h
ResStatus.cc
ResStatus.h
ResTraits.h
ServiceInfo.cc
ServiceInfo.h
Signature.cc
Signature.h
SrcPackage.cc
SrcPackage.h
SysContent.cc
SysContent.h
Target.cc
Target.h
TmpPath.cc
TmpPath.h
TriBool.h
Url.cc
Url.h
Vendor.h
VendorAttr.cc
VendorAttr.h
VendorSupportOptions.cc
VendorSupportOptions.h
ZConfig.cc
ZConfig.h
ZYpp.cc
ZYpp.h
ZYppCallbacks.h
ZYppCommit.h
ZYppCommitPolicy.cc
ZYppCommitPolicy.h
ZYppCommitResult.cc
ZYppCommitResult.h
ZYppFactory.cc
ZYppFactory.h
File Members
Resolver.h
Go to the documentation of this file.
1
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 4 -*- */
2
/* Resolver.h
3
*
4
* Copyright (C) 2000-2002 Ximian, Inc.
5
* Copyright (C) 2005 SUSE Linux Products GmbH
6
*
7
* This program is free software; you can redistribute it and/or
8
* modify it under the terms of the GNU General Public License,
9
* version 2, as published by the Free Software Foundation.
10
*
11
* This program is distributed in the hope that it will be useful, but
12
* WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
* General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License
17
* along with this program; if not, write to the Free Software
18
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
19
* 02111-1307, USA.
20
*/
21
22
#ifndef ZYPP_SOLVER_DETAIL_RESOLVER_H
23
#define ZYPP_SOLVER_DETAIL_RESOLVER_H
24
25
#include <iosfwd>
26
#include <list>
27
#include <map>
28
#include <string>
29
30
#include "
zypp/base/ReferenceCounted.h
"
31
#include "
zypp/base/PtrTypes.h
"
32
33
#include "
zypp/ResPool.h
"
34
#include "
zypp/TriBool.h
"
35
#include "
zypp/base/SerialNumber.h
"
36
37
#include "
zypp/solver/detail/Types.h
"
38
#include "
zypp/solver/detail/SolverQueueItem.h
"
39
40
#include "
zypp/ProblemTypes.h
"
41
#include "
zypp/ResolverProblem.h
"
42
#include "
zypp/ProblemSolution.h
"
43
#include "
zypp/Capabilities.h
"
44
#include "
zypp/Capability.h
"
45
46
48
namespace
zypp
49
{
50
51
namespace
sat
52
{
53
class
Transaction;
54
}
55
57
namespace
solver
58
{
59
60
namespace
detail
61
{
62
63
class
SATResolver;
64
66
//
67
// CLASS NAME : ItemCapKind
68
//
70
struct
ItemCapKind
71
{
72
public
:
73
Capability
cap
;
//Capability which has triggerd this selection
74
Dep
capKind
;
//Kind of that capability
75
PoolItem
item
;
//Item which has triggered this selection
76
bool
initialInstallation
;
//This item has triggered the installation
77
//Not already fullfilled requierement only.
78
79
ItemCapKind
() :
capKind
(
Dep
::PROVIDES) {}
80
ItemCapKind
(
PoolItem
i,
Capability
c,
Dep
k,
bool
initial)
81
:
cap
( c )
82
,
capKind
( k )
83
,
item
( i )
84
,
initialInstallation
( initial )
85
{ }
86
};
87
typedef
std::multimap<PoolItem,ItemCapKind>
ItemCapKindMap
;
88
typedef
std::list<ItemCapKind>
ItemCapKindList
;
89
90
92
//
93
// CLASS NAME : Resolver
101
class
Resolver
:
public
base::ReferenceCounted
,
private
base::NonCopyable
{
102
103
private
:
104
ResPool
_pool
;
105
SATResolver
*
_satResolver
;
106
SerialNumberWatcher
_poolchanged
;
107
108
CapabilitySet
_extra_requires
;
109
CapabilitySet
_extra_conflicts
;
110
std::set<Repository>
_upgradeRepos
;
111
112
// Regard dependencies of the item weak onl
113
PoolItemList
_addWeak
;
114
117
bool
_forceResolve
;
// remove items which are conflicts with others or
118
// have unfulfilled requirements.
119
// This behaviour is favourited by ZMD
120
bool
_upgradeMode
;
// Resolver has been called with doUpgrade
121
bool
_updateMode
;
// Resolver has been called with doUpdate
122
bool
_verifying
;
// The system will be checked
123
bool
_onlyRequires
;
// do install required resolvables only
124
// no recommended resolvables, language
125
// packages, hardware packages (modalias)
126
bool
_allowVendorChange
;
// whether the solver should allow or disallow vendor changes.
127
bool
_solveSrcPackages
;
// whether to generate solver jobs for selected source packges.
128
bool
_cleandepsOnRemove
;
// whether removing a package should also remove no longer needed requirements
129
130
bool
_ignoreAlreadyRecommended
;
//ignore recommended packages that have already been recommended by the installed packages
132
133
// Additional QueueItems which has to be regarded by the solver
134
// This will be used e.g. by solution actions
135
solver::detail::SolverQueueItemList
_removed_queue_items
;
136
solver::detail::SolverQueueItemList
_added_queue_items
;
137
138
// Additional information about the solverrun
139
ItemCapKindMap
_isInstalledBy
;
140
ItemCapKindMap
_installs
;
141
ItemCapKindMap
_satifiedByInstalled
;
142
ItemCapKindMap
_installedSatisfied
;
143
144
// helpers
145
void
collectResolverInfo
();
146
147
// Unmaintained packages which does not fit to the updated system
148
// (broken dependencies) will be deleted.
149
// returns true if solving was successful
150
bool
checkUnmaintainedItems
();
151
152
void
solverInit
();
153
154
public
:
155
156
Resolver
(
const
ResPool
& pool );
157
virtual
~Resolver
();
158
159
// ---------------------------------- I/O
160
161
virtual
std::ostream &
dumpOn
( std::ostream & str )
const
;
162
friend
std::ostream&
operator<<
( std::ostream& str,
const
Resolver
& obj )
163
{
return
obj.
dumpOn
(str); }
164
165
// ---------------------------------- methods
166
167
ResPool
pool()
const
;
168
void
setPool
(
const
ResPool
& pool ) {
_pool
= pool; }
169
170
void
addUpgradeRepo
(
Repository
repo_r ) {
if
( repo_r && ! repo_r.
isSystemRepo
() )
_upgradeRepos
.insert( repo_r ); }
171
bool
upgradingRepo
(
Repository
repo_r )
const
{
return
(
_upgradeRepos
.find( repo_r ) !=
_upgradeRepos
.end() ); }
172
void
removeUpgradeRepo
(
Repository
repo_r ) {
_upgradeRepos
.erase( repo_r ); }
173
void
removeUpgradeRepos
() {
_upgradeRepos
.clear(); }
174
const
std::set<Repository> &
upgradeRepos
()
const
{
return
_upgradeRepos
; }
175
176
void
addExtraRequire(
const
Capability
& capability );
177
void
removeExtraRequire(
const
Capability
& capability );
178
void
addExtraConflict(
const
Capability
& capability );
179
void
removeExtraConflict(
const
Capability
& capability );
180
181
void
removeQueueItem( SolverQueueItem_Ptr item );
182
void
addQueueItem( SolverQueueItem_Ptr item );
183
184
CapabilitySet
extraRequires
()
const
{
return
_extra_requires
; }
185
CapabilitySet
extraConflicts
()
const
{
return
_extra_conflicts
; }
186
187
void
addWeak(
const
PoolItem
& item );
188
189
bool
verifySystem
();
190
bool
resolvePool
();
191
bool
resolveQueue
(
SolverQueueItemList
& queue );
192
void
doUpdate
();
193
194
bool
doUpgrade
();
195
PoolItemList
problematicUpdateItems
()
const
;
196
199
bool
ignoreAlreadyRecommended
()
const
{
return
_ignoreAlreadyRecommended
; }
200
void
setIgnoreAlreadyRecommended
(
bool
yesno_r ) {
_ignoreAlreadyRecommended
= yesno_r; }
201
202
bool
onlyRequires
()
const
{
return
_onlyRequires
; }
203
void
setOnlyRequires
(
TriBool
state_r );
204
205
bool
forceResolve
()
const
{
return
_forceResolve
; }
206
void
setForceResolve
(
TriBool
state_r ) {
_forceResolve
= indeterminate(state_r) ?
false
: bool(state_r); }
207
208
bool
isUpgradeMode
()
const
{
return
_upgradeMode
; }
// Resolver has been called with doUpgrade
209
void
setUpgradeMode
(
bool
yesno_r ) {
_upgradeMode
= yesno_r; }
210
211
bool
isUpdateMode
()
const
{
return
_updateMode
; }
// Resolver has been called with doUpdate
212
213
bool
isVerifyingMode
()
const
{
return
_verifying
; }
// The system will be checked
214
void
setVerifyingMode
(
TriBool
state_r ) {
_verifying
= indeterminate(state_r) ?
false
: bool(state_r); }
215
216
bool
allowVendorChange
()
const
{
return
_allowVendorChange
; }
217
void
setAllowVendorChange
(
TriBool
state_r );
218
219
bool
solveSrcPackages
()
const
{
return
_solveSrcPackages
; }
220
void
setSolveSrcPackages
(
TriBool
state_r ) {
_solveSrcPackages
= indeterminate(state_r) ?
false
: bool(state_r); }
221
222
bool
cleandepsOnRemove
()
const
{
return
_cleandepsOnRemove
; }
223
void
setCleandepsOnRemove
(
TriBool
state_r );
225
226
ResolverProblemList
problems
()
const
;
227
void
applySolutions
(
const
ProblemSolutionList
& solutions );
228
229
// Return the Transaction computed by the last solver run.
230
sat::Transaction
getTransaction
();
231
232
// reset all SOLVER transaction in pool
233
void
undo
();
234
235
void
reset
(
bool
keepExtras =
false
);
236
237
// Get more information about the solverrun
238
// Which item will be installed by another item or triggers an item for
239
// installation
240
ItemCapKindList
isInstalledBy
(
const
PoolItem
& item );
241
ItemCapKindList
installs
(
const
PoolItem
& item );
242
ItemCapKindList
satifiedByInstalled
(
const
PoolItem
& item );
243
ItemCapKindList
installedSatisfied
(
const
PoolItem
& item );
244
245
};
246
248
};
// namespace detail
251
};
// namespace solver
254
};
// namespace zypp
256
257
#endif // ZYPP_SOLVER_DETAIL_RESOLVER_H
zypp
solver
detail
Resolver.h
Generated by
1.8.1