1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
|
# -*- coding: utf-8 -*-
#
# File: portato/backend/system_interface.py
# This file is part of the Portato-Project, a graphical portage-frontend.
#
# Copyright (C) 2007 René 'Necoro' Neumann
# This is free software. You may redistribute copies of it under the terms of
# the GNU General Public License version 2.
# There is NO WARRANTY, to the extent permitted by law.
#
# Written by René 'Necoro' Neumann <necoro@necoro.net>
class SystemInterface:
def split_cpv (self, cpv):
"""Splits a cpv into all its parts.
@param cpv: the cpv to split
@type cpv: string
@returns: the splitted cpv
@rtype: string[]"""
raise NotImplementedError
def find_best(self, list):
"""Returns the best package out of a list of packages.
@param list: the list of packages to select from
@type list: string[]
@returns: the best package
@rtype: backend.Package"""
raise NotImplementedError
def find_best_match (self, search_key, only_installed = False):
"""Finds the best match in the portage tree. It does not find masked packages!
@param search_key: the key to find in the portage tree
@type search_key: string
@param only_installed: if True, only installed packages are searched
@type only_installed: boolean
@returns: the package found or None
@rtype: backend.Package"""
raise NotImplementedError
def find_packages (self, search_key, masked=False):
"""This returns a list of packages which have to fit exactly. Additionally ranges like '<,>,=,~,!' et. al. are possible.
@param search_key: the key to look for
@type search_key: string
@param masked: if True, also look for masked packages
@type masked: boolean
@returns: list of found packages
@rtype: backend.Package[]"""
raise NotImplementedError
def find_installed_packages (self, search_key, masked = False):
"""This returns a list of packages which have to fit exactly. Additionally ranges like '<,>,=,~,!' et. al. are possible.
@param search_key: the key to look for
@type search_key: string
@param masked: if True, also look for masked packages
@type masked: boolean
@returns: list of found packages
@rtype: backend.Package[]"""
raise NotImplementedError
def find_system_packages (self):
"""Looks for all packages saved as "system-packages".
@returns: a tuple of (resolved_packages, unresolved_packages).
@rtype: (backend.Package[], backend.Package[])"""
raise NotImplementedError
def find_world_packages (self):
"""Looks for all packages saved in the world-file.
@returns: a tuple of (resolved_packages, unresolved_packages).
@rtype: (backend.Package[], backend.Package[])"""
raise NotImplementedError
def find_all_installed_packages (self, name = None, withVersion = True):
"""Finds all installed packages matching a name or all if no name is specified.
@param name: the name to look for - it is expanded to .*name.* ; if None, all packages are returned
@type name: string or None
@param withVersion: if True version-specific packages are returned; else only the cat/package-strings a delivered
@type withVersion: boolean
@returns: all packages/cp-strings found
@rtype: backend.Package[] or cp-string[]"""
raise NotImplementedError
def find_all_uninstalled_packages (self, name = None):
"""Finds all uninstalled packages matching a name or all if no name is specified.
@param name: the name to look for - it is expanded to .*name.* ; if None, all packages are returned
@type name: string or None
@returns: all packages found
@rtype: backend.Package[]"""
raise NotImplementedError
def find_all_packages (self, name = None, withVersion = True):
"""Finds all packages matching a name or all if no name is specified.
@param name: the name to look for - it is expanded to .*name.* ; if None, all packages are returned
@type name: string or None
@param withVersion: if True version-specific packages are returned; else only the cat/package-strings a delivered
@type withVersion: boolean
@returns: all packages/cp-strings found
@rtype: backend.Package[] or cp-string[]"""
raise NotImplementedError
def find_all_world_packages (self, name = None):
"""Finds all world packages matching a name or all if no name is specified.
@param name: the name to look for - it is expanded to .*name.* ; if None, all packages are returned
@type name: string or None
@returns: all packages found
@rtype: backend.Package[]"""
raise NotImplementedError
def find_all_system_packages (self, name = None):
"""Finds all system packages matching a name or all if no name is specified.
@param name: the name to look for - it is expanded to .*name.* ; if None, all packages are returned
@type name: string or None
@returns: all packages found
@rtype: backend.Package[]"""
raise NotImplementedError
def list_categories (self, name = None):
"""Finds all categories matching a name or all if no name is specified.
@param name: the name to look for - it is expanded to .*name.* ; if None, all categories are returned
@type name: string or None
@returns: all categories found
@rtype: string[]"""
raise NotImplementedError
def sort_package_list(self, pkglist):
"""Sorts a package list in the same manner portage does.
@param pkglist: list to sort
@type pkglist: Packages[]"""
raise NotImplementedError
def reload_settings (self):
"""Reloads portage."""
raise NotImplementedError
def update_world (self, newuse = False, deep = False):
"""Calculates the packages to get updated in an update world.
@param newuse: Checks if a use-flag has a different state then to install time.
@type newuse: boolean
@param deep: Not only check world packages but also there dependencies.
@type deep: boolean
@returns: a list containing of the tuple (new_package, old_package)
@rtype: (backend.Package, backend.Package)[]"""
raise NotImplementedError
def get_use_desc (self, flag, package = None):
"""Returns the description of a specific useflag or None if no desc was found.
If a package is given (in the <cat>/<name> format) the local use descriptions are searched too.
@param flag: flag to get the description for
@type flag: string
@param package: name of a package: if given local use descriptions are searched too
@type package: cp-string
@returns: found description
@rtype: string"""
raise NotImplementedError
def new_package (self, cpv):
"""Returns an instance of the appropriate Package-Subclass.
@param cpv: the cpv to create the package from
@type cpv: string
@returns: a new Package-object.
@rtype: Package"""
raise NotImplementedError
def get_config_path (self):
"""Returns the actual path to the config files.
@returns: the path, e.g. /etc/portage
@rtyoe: string"""
raise NotImplementedError
def get_world_file_path (self):
"""Returns the path to the world file.
@returns: the path of the world file
@rtype: string"""
raise NotImplementedError
def get_sync_command (self):
"""Returns the command(s) to run for syncing. This can be overridden by the user.
@returns: command to run
@rtype: string[]"""
raise NotImplementedError
def get_merge_command (self):
"""Returns the command(s) to run for the merging.
@returns: command to run
@rtype: string[]"""
raise NotImplementedError
def get_oneshot_option (self):
"""Returns the options to append for marking a merge as "oneshot".
@returns: option(s) to append
@rtype: string[]"""
raise NotImplementedError
def get_newuse_option (self):
"""Returns the options to append for marking a merge as "newuse".
@returns: option(s) to append
@rtype: string[]"""
raise NotImplementedError
def get_deep_option (self):
"""Returns the options to append for marking a merge as "deep".
@returns: option(s) to append
@rtype: string[]"""
raise NotImplementedError
def get_update_option (self):
"""Returns the options to append for marking a merge as "update".
@returns: option(s) to append
@rtype: string[]"""
raise NotImplementedError
def get_pretend_option (self):
"""Returns the options to append for marking a merge as "pretend".
@returns: option(s) to append
@rtype: string[]"""
raise NotImplementedError
def get_unmerge_option (self):
"""Returns the options to append for marking a merge as "unmerge".
@returns: option(s) to append
@rtype: string[]"""
raise NotImplementedError
|