]>
git.saurik.com Git - apt.git/blob - apt-pkg/policy.h
1 // -*- mode: cpp; mode: fold -*-
3 // $Id: policy.h,v 1.2 2001/02/20 07:03:17 jgg Exp $
4 /* ######################################################################
6 Package Version Policy implementation
8 This implements the more advanced 'Version 4' APT policy engine. The
9 standard 'Version 0' engine is included inside the DepCache which is
10 it's historical location.
12 The V4 engine allows the user to completly control all aspects of
13 version selection. There are three primary means to choose a version
14 * Selection by version match
15 * Selection by Release file match
16 * Selection by origin server
18 Each package may be 'pinned' with a single criteria, which will ultimately
19 result in the selection of a single version, or no version, for each
22 Furthermore, the default selection can be influenced by specifying
23 the ordering of package files. The order is derived by reading the
24 package file preferences and assigning a priority to each package
27 A special flag may be set to indicate if no version should be returned
28 if no matching versions are found, otherwise the default matching
29 rules are used to locate a hit.
31 ##################################################################### */
33 #ifndef PKGLIB_POLICY_H
34 #define PKGLIB_POLICY_H
37 #pragma interface "apt-pkg/policy.h"
40 #include <apt-pkg/depcache.h>
41 #include <apt-pkg/versionmatch.h>
44 class pkgPolicy
: public pkgDepCache::Policy
48 pkgVersionMatch::MatchType Type
;
50 signed short Priority
;
51 Pin() : Type(pkgVersionMatch::None
), Priority(0) {};
62 signed short *PFPriority
;
64 vector
<PkgPin
> Unmatched
;
70 void CreatePin(pkgVersionMatch::MatchType Type
,string Pkg
,
71 string Data
,signed short Priority
);
73 virtual pkgCache::VerIterator
GetCandidateVer(pkgCache::PkgIterator Pkg
);
74 virtual bool IsImportantDep(pkgCache::DepIterator Dep
) {return pkgDepCache::Policy::IsImportantDep(Dep
);};
77 pkgPolicy(pkgCache
*Owner
);
78 virtual ~pkgPolicy() {delete [] PFPriority
; delete [] Pins
;};
81 bool ReadPinFile(pkgPolicy
&Plcy
,string File
= "");