1
2 """
3
4 @author: Fabio Erculiani <lxnay@sabayonlinux.org>
5 @contact: lxnay@sabayonlinux.org
6 @copyright: Fabio Erculiani
7 @license: GPL-2
8
9 B{Entropy Framework repository database prototype classes module}.
10 """
11
12
14 """
15 This is the base class for implementing EntropyRepository plugin hooks.
16 You have to subclass this, implement not implemented methods and provide
17 it to EntropyRepository class as described below.
18
19 Every plugin hook function features this signature:
20 int something_hook(entropy_repository_instance)
21 Where entropy_repository_instance is the calling EntropyRepository instance.
22 Every method should return a return status code which, when nonzero causes
23 a RepositoryPluginError exception to be thrown.
24 Every method returns 0 in the base class implementation.
25 """
26
28 """
29 Return string identifier of myself.
30
31 @return: EntropyRepositoryPlugin identifier.
32 @rtype: string
33 """
34 return str(self)
35
52
54 """
55 Called during EntropyRepository plugin addition.
56
57 @param entropy_repository_instance: EntropyRepository instance
58 @type entropy_repository_instance: EntropyRepository
59 @return: execution status code, return nonzero for errors, this will
60 raise a RepositoryPluginError exception.
61 @rtype: int
62 """
63 return 0
64
66 """
67 Called during EntropyRepository plugin removal.
68
69 @param entropy_repository_instance: EntropyRepository instance
70 @type entropy_repository_instance: EntropyRepository
71 @return: execution status code, return nonzero for errors, this will
72 raise a RepositoryPluginError exception.
73 @rtype: int
74 """
75 return 0
76
78 """
79 Called during EntropyRepository data commit.
80
81 @param entropy_repository_instance: EntropyRepository instance
82 @type entropy_repository_instance: EntropyRepository
83 @return: execution status code, return nonzero for errors, this will
84 raise a RepositoryPluginError exception.
85 @rtype: int
86 """
87 return 0
88
90 """
91 Called during EntropyRepository instance shutdown (closeDB).
92
93 @param entropy_repository_instance: EntropyRepository instance
94 @type entropy_repository_instance: EntropyRepository
95 @return: execution status code, return nonzero for errors, this will
96 raise a RepositoryPluginError exception.
97 @rtype: int
98 """
99 return 0
100
101 - def add_package_hook(self, entropy_repository_instance, idpackage,
102 package_data):
103 """
104 Called after the addition of a package from EntropyRepository.
105
106 @param entropy_repository_instance: EntropyRepository instance
107 @type entropy_repository_instance: EntropyRepository
108 @param idpackage: Entropy repository package identifier
109 @type idpackage: int
110 @param package_data: package metadata used for insertion
111 (see addPackage)
112 @type package_data: dict
113 @return: execution status code, return nonzero for errors, this will
114 raise a RepositoryPluginError exception.
115 @rtype: int
116 """
117 return 0
118
121 """
122 Called after the removal of a package from EntropyRepository.
123
124 @param entropy_repository_instance: EntropyRepository instance
125 @type entropy_repository_instance: EntropyRepository
126 @param idpackage: Entropy repository package identifier
127 @type idpackage: int
128 @param from_add_package: inform whether removePackage() is called inside
129 addPackage()
130 @return: execution status code, return nonzero for errors, this will
131 raise a RepositoryPluginError exception.
132 @rtype: int
133 """
134 return 0
135
137 """
138 Called during EntropyRepository cache cleanup (clearCache).
139
140 @param entropy_repository_instance: EntropyRepository instance
141 @type entropy_repository_instance: EntropyRepository
142 @return: execution status code, return nonzero for errors, this will
143 raise a RepositoryPluginError exception.
144 @rtype: int
145 """
146 return 0
147
149 """
150 Called during EntropyRepository data initialization (not instance init).
151
152 @param entropy_repository_instance: EntropyRepository instance
153 @type entropy_repository_instance: EntropyRepository
154 @return: execution status code, return nonzero for errors, this will
155 raise a RepositoryPluginError exception.
156 @rtype: int
157 """
158 return 0
159
161 """
162 Called during EntropyRepository acceptLicense call.
163
164 @param entropy_repository_instance: EntropyRepository instance
165 @type entropy_repository_instance: EntropyRepository
166 @return: execution status code, return nonzero for errors, this will
167 raise a RepositoryPluginError exception.
168 @rtype: int
169 """
170 return 0
171
174 """
175 Called after EntropyRepository treeupdates move action execution for
176 given idpackage in given EntropyRepository instance.
177
178 @param entropy_repository_instance: EntropyRepository instance
179 @type entropy_repository_instance: EntropyRepository
180 @param idpackage: Entropy repository package identifier
181 @type idpackage: int
182 @return: execution status code, return nonzero for errors, this will
183 raise a RepositoryPluginError exception.
184 @rtype: int
185 """
186 return 0
187
190 """
191 Called after EntropyRepository treeupdates slot move action
192 execution for given idpackage in given EntropyRepository instance.
193
194 @param entropy_repository_instance: EntropyRepository instance
195 @type entropy_repository_instance: EntropyRepository
196 @param idpackage: Entropy repository package identifier
197 @type idpackage: int
198 @return: execution status code, return nonzero for errors, this will
199 raise a RepositoryPluginError exception.
200 @rtype: int
201 """
202 return 0
203
206 """
207 This hook is called inside
208 EntropyRepository.generateReverseDependenciesMetadata() method at
209 the very end of the function code.
210 Every time that repository is "tainted" with new packages, sooner or
211 later that function is called.
212
213 @param entropy_repository_instance: EntropyRepository instance
214 @type entropy_repository_instance: EntropyRepository
215 @return: execution status code, return nonzero for errors, this will
216 raise a RepositoryPluginError exception.
217 @rtype: int
218 """
219 return 0
220