summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-03-09 03:56:56 +0000
committerZac Medico <zmedico@gentoo.org>2009-03-09 03:56:56 +0000
commiteb702af2abed495471af86ba8cd15d6ec610fc69 (patch)
treedacdea6ca56b0b05ea5077a50ff29ba00a557f76
parent233dc0c9c6a66256bc6ebf8d414f96166c5f0439 (diff)
downloadportage-eb702af2abed495471af86ba8cd15d6ec610fc69.tar.gz
portage-eb702af2abed495471af86ba8cd15d6ec610fc69.tar.bz2
portage-eb702af2abed495471af86ba8cd15d6ec610fc69.zip
Reorganize code for --digests and FEATURES=digest.
svn path=/main/trunk/; revision=12801
-rw-r--r--pym/_emerge/__init__.py70
1 files changed, 49 insertions, 21 deletions
diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py
index 4449f8935..4d1f4792f 100644
--- a/pym/_emerge/__init__.py
+++ b/pym/_emerge/__init__.py
@@ -10429,6 +10429,51 @@ class Scheduler(PollScheduler):
return ebuild_phase.returncode
+ def _generate_digests(self):
+ """
+ Generate digests if necessary for --digests or FEATURES=digest.
+ In order to avoid interference, this must done before parallel
+ tasks are started.
+ """
+
+ if '--fetchonly' in self.myopts:
+ return os.EX_OK
+
+ digest = '--digest' in self.myopts
+ if not digest:
+ for pkgsettings in self.pkgsettings.itervalues():
+ if 'digest' in pkgsettings.features:
+ digest = True
+ break
+
+ if not digest:
+ return os.EX_OK
+
+ for x in self._mergelist:
+ if not isinstance(x, Package) or \
+ x.type_name != 'ebuild' or \
+ x.operation != 'merge':
+ continue
+ pkgsettings = self.pkgsettings[x.root]
+ if '--digest' not in self.myopts and \
+ 'digest' not in pkgsettings.features:
+ continue
+ portdb = x.root_config.trees['porttree'].dbapi
+ ebuild_path = portdb.findname(x.cpv)
+ if not ebuild_path:
+ writemsg_level(
+ "!!! Could not locate ebuild for '%s'.\n" \
+ % x.cpv, level=logging.ERROR, noiselevel=-1)
+ return 1
+ pkgsettings['O'] = os.path.dirname(ebuild_path)
+ if not portage.digestgen([], pkgsettings, myportdb=portdb):
+ writemsg_level(
+ "!!! Unable to generate manifest for '%s'.\n" \
+ % x.cpv, level=logging.ERROR, noiselevel=-1)
+ return 1
+
+ return os.EX_OK
+
def _check_manifests(self):
# Verify all the manifests now so that the user is notified of failure
# as soon as possible.
@@ -10636,6 +10681,10 @@ class Scheduler(PollScheduler):
self.pkgsettings[root] = portage.config(
clone=root_config.settings)
+ rval = self._generate_digests()
+ if rval != os.EX_OK:
+ return rval
+
rval = self._check_manifests()
if rval != os.EX_OK:
return rval
@@ -14572,27 +14621,6 @@ def action_build(settings, trees, mtimedb,
# Convert Atom instances to plain str.
mtimedb["resume"]["favorites"] = [str(x) for x in favorites]
- digest = '--digest' in myopts
- if not digest:
- for pkgsettings in mydepgraph.pkgsettings.itervalues():
- if 'digest' in pkgsettings.features:
- digest = True
- break
-
- if digest and '--fetchonly' not in myopts:
- for pkgline in mydepgraph.altlist():
- if pkgline[0]=="ebuild" and pkgline[3]=="merge":
- y = trees[pkgline[1]]["porttree"].dbapi.findname(pkgline[2])
- tmpsettings = portage.config(clone=settings)
- edebug = 0
- if settings.get("PORTAGE_DEBUG", "") == "1":
- edebug = 1
- retval = portage.doebuild(
- y, "digest", settings["ROOT"], tmpsettings, edebug,
- ("--pretend" in myopts),
- mydbapi=trees[pkgline[1]]["porttree"].dbapi,
- tree="porttree")
-
pkglist = mydepgraph.altlist()
mydepgraph.saveNomergeFavorites()
mydepgraph.break_refs(pkglist)