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
|
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
from _emerge.SlotObject import SlotObject
import portage
from portage import os
from portage.elog.messages import eerror
class EbuildFetchonly(SlotObject):
__slots__ = ("fetch_all", "pkg", "pretend", "settings")
def execute(self):
settings = self.settings
pkg = self.pkg
portdb = pkg.root_config.trees["porttree"].dbapi
ebuild_path = portdb.findname(pkg.cpv)
if ebuild_path is None:
raise AssertionError("ebuild not found for '%s'" % pkg.cpv)
settings.setcpv(pkg)
debug = settings.get("PORTAGE_DEBUG") == "1"
rval = portage.doebuild(ebuild_path, "fetch",
settings["ROOT"], settings, debug=debug,
listonly=self.pretend, fetchonly=1, fetchall=self.fetch_all,
mydbapi=portdb, tree="porttree")
if rval != os.EX_OK:
msg = "Fetch failed for '%s'" % (pkg.cpv,)
eerror(msg, phase="unpack", key=pkg.cpv)
return rval
def _execute(self):
settings = self.settings
pkg = self.pkg
root_config = pkg.root_config
portdb = root_config.trees["porttree"].dbapi
ebuild_path = portdb.findname(pkg.cpv)
if ebuild_path is None:
raise AssertionError("ebuild not found for '%s'" % pkg.cpv)
debug = settings.get("PORTAGE_DEBUG") == "1"
retval = portage.doebuild(ebuild_path, "fetch",
self.settings["ROOT"], self.settings, debug=debug,
listonly=self.pretend, fetchonly=1, fetchall=self.fetch_all,
mydbapi=portdb, tree="porttree")
if retval != os.EX_OK:
msg = "Fetch failed for '%s'" % (pkg.cpv,)
eerror(msg, phase="unpack", key=pkg.cpv)
portage.elog.elog_process(self.pkg.cpv, self.settings)
return retval
|