]>
git.saurik.com Git - apt.git/blob - apt-pkg/algorithms.h
1 // -*- mode: cpp; mode: fold -*-
3 // $Id: algorithms.h,v 1.3 1998/07/19 21:24:11 jgg Exp $
4 /* ######################################################################
6 Algorithms - A set of misc algorithms
8 This simulate class displays what the ordering code has done and
9 analyses it with a fresh new dependency cache. In this way we can
10 see all of the effects of an upgrade run.
12 pkgDistUpgrade computes an upgrade that causes as many packages as
13 possible to move to the newest verison.
15 pkgApplyStatus sets the target state based on the content of the status
16 field in the status file. It is important to get proper crash recovery.
18 pkgFixBroken corrects a broken system so that it is in a sane state.
20 ##################################################################### */
22 // Header section: pkglib
23 #ifndef PKGLIB_ALGORITHMS_H
24 #define PKGLIB_ALGORITHMS_H
27 #pragma interface "apt-pkg/algorithms.h"
30 #include <apt-pkg/packagemanager.h>
31 #include <apt-pkg/depcache.h>
33 class pkgSimulate
: public pkgPackageManager
41 // The Actuall installation implementation
42 virtual bool Install(PkgIterator Pkg
,string File
);
43 virtual bool Configure(PkgIterator Pkg
);
44 virtual bool Remove(PkgIterator Pkg
);
49 pkgSimulate(pkgDepCache
&Cache
);
52 class pkgProblemResolver
55 typedef pkgCache::PkgIterator PkgIterator
;
56 typedef pkgCache::VerIterator VerIterator
;
57 typedef pkgCache::DepIterator DepIterator
;
58 typedef pkgCache::PrvIterator PrvIterator
;
59 typedef pkgCache::Version Version
;
60 typedef pkgCache::Package Package
;
62 enum Flags
{Protected
= (1 << 0), PreInstalled
= (1 << 1),
63 Upgradable
= (1 << 2)};
69 static pkgProblemResolver
*This
;
70 static int ScoreSort(const void *a
,const void *b
);
79 bool DoUpgrade(pkgCache::PkgIterator Pkg
);
83 inline void Protect(pkgCache::PkgIterator Pkg
) {Flags
[Pkg
->ID
] |= Protected
;};
84 bool Resolve(bool BrokenFix
= false);
86 pkgProblemResolver(pkgDepCache
&Cache
);
89 bool pkgDistUpgrade(pkgDepCache
&Cache
);
90 bool pkgApplyStatus(pkgDepCache
&Cache
);
91 bool pkgFixBroken(pkgDepCache
&Cache
);