Lines 15-20
Link Here
|
15 |
'Portage', |
15 |
'Portage', |
16 |
'Pkgcore', |
16 |
'Pkgcore', |
17 |
'Paludis', |
17 |
'Paludis', |
|
|
18 |
'Cave', |
18 |
] |
19 |
] |
19 |
|
20 |
|
20 |
import grp |
21 |
import grp |
Lines 243-245
Link Here
|
243 |
packages.append(line.strip()) |
244 |
packages.append(line.strip()) |
244 |
return packages |
245 |
return packages |
245 |
|
246 |
|
|
|
247 |
class Cave(Base): |
248 |
|
249 |
_client = '/usr/bin/cave' |
250 |
_group = 'paludisbuild' |
251 |
|
252 |
post_uninstall = [ |
253 |
'You may want to remove the dependencies too, using:', |
254 |
'# cave purge', |
255 |
] |
256 |
|
257 |
def __init__(self, ask=False, verbose=False, pretend=False, oneshot=False, nocolor=False): |
258 |
self._fullcommand = [self._client] |
259 |
self._cmd = ['-z'] |
260 |
oneshot and self._cmd.append('-1') |
261 |
not pretend and self._cmd.append('-x') |
262 |
#if verbose: |
263 |
# self._fullcommand += [ |
264 |
# '--show-descriptions', 'all', |
265 |
# '--show-option-descriptions', 'all', |
266 |
# ] |
267 |
#cave doesn't support '--ask' |
268 |
#cave doesn't support '--no-color' |
269 |
|
270 |
def run_command(self, command): |
271 |
return subprocess.call(self._fullcommand + command + self._cmd) |
272 |
|
273 |
def install_package(self, pkgatom, catpkg): |
274 |
return self.run_command(['resolve'] + [pkgatom]) |
275 |
|
276 |
def uninstall_package(self, pkgatom, catpkg): |
277 |
return self.run_command(['uninstall'] + [pkgatom]) |
278 |
|
279 |
def update_package(self, pkgatom=None, catpkg=None): |
280 |
cmd = ['-1','-K','s','-k','s'] |
281 |
if pkgatom is None: |
282 |
pkgatom = self.installed_packages() |
283 |
else: |
284 |
pkgatom = [pkgatom] |
285 |
self.do_ebuilds(pkgatom) |
286 |
return self.run_command(['resolve'] + cmd + pkgatom) |
287 |
|
288 |
def installed_packages(self): |
289 |
packages = [] |
290 |
p = subprocess.Popen([ |
291 |
'cave', |
292 |
'print-ids', |
293 |
'--matching', 'g-octave/*::installed', |
294 |
'--format', '%c/%p\n', |
295 |
], stdout=subprocess.PIPE) |
296 |
if p.wait() == os.EX_OK: |
297 |
for line in p.stdout: |
298 |
packages.append(line.strip()) |
299 |
return packages |