1
2
3
4
5
6
7
8
9
10
11
12
13
14 """
15 Base classes and data used for all policy
16 """
17
18 import imp
19 import itertools
20 import os
21 import sys
22 import types
23
24 from conary.lib import util, log, graph
25 from conary.build import action, errors, filter, trovefilter
26
27
28
29
30 TESTSUITE = 1 << 0
31 DESTDIR_PREPARATION = 1 << 1
32 DESTDIR_MODIFICATION = 1 << 2
33 PACKAGE_CREATION = 1 << 3
34 PACKAGE_MODIFICATION = 1 << 4
35 ENFORCEMENT = 1 << 5
36 ERROR_REPORTING = 1 << 6
37 GROUP_ENFORCEMENT = 1 << 7
38
39
40 REQUIRED = 1 << 0
41 ORDERED = 1 << 1
42 PRIOR = 1 << 2
43 REQUIRED_PRIOR = REQUIRED|ORDERED|PRIOR
44 REQUIRED_SUBSEQUENT = REQUIRED|ORDERED
45 CONDITIONAL_PRIOR = ORDERED|PRIOR
46 CONDITIONAL_SUBSEQUENT = ORDERED
47
48
49 NO_FILES = 0 << 0
50 DESTDIR = 1 << 0
51 BUILDDIR = 1 << 1
52 DIR = DESTDIR|BUILDDIR
53 PACKAGE = 1 << 2
54
55
57 """
58 Abstract Superclass for all policy actions. Common bits between Policy
59 and GroupPolicy should be defined at this level
60 """
61 invariantsubtrees = []
62 invariantexceptions = []
63 invariantinclusions = []
64 allowUnusedFilters = False
65
69
71 """
72 Hook for initialization that cannot happen until after all
73 policies have been loaded into the recipe and thus cannot
74 happen in __init__; mainly for policies that need to pass
75 information to other policies at initialization time.
76 """
77 pass
78
80 """
81 The default way to update a class is to override any provided
82 keywords. Subclasses which have the ability to provide more
83 intelligent handling can override this method. This method
84 is invoked automatically by recipe.py when a recipe references
85 a policy object. It acts rather like __init__ except that it
86 can meaningfully be called more than once for an object.
87
88 Some keyword arguments (at least C{exceptions} and C{subtrees})
89 should be appended rather than replaced.
90 """
91 allowUnusedFilters =