aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2015-11-12 23:18:38 -0800
committerZac Medico <zmedico@gentoo.org>2015-11-13 09:52:01 -0800
commit1ac5e7f9b92b33f76cdb1e6e6f7e5bba42f2b496 (patch)
treefe74e004206894d8137bc256e561db688dc36681 /bin/egencache
parentFindVCS: support optional cwd argument (diff)
downloadportage-1ac5e7f9b92b33f76cdb1e6e6f7e5bba42f2b496.tar.gz
portage-1ac5e7f9b92b33f76cdb1e6e6f7e5bba42f2b496.tar.bz2
portage-1ac5e7f9b92b33f76cdb1e6e6f7e5bba42f2b496.zip
GenChangeLogs: parallelize remaining git calls, scale linearly (bug 565540)
Move all git calls to the subprocesses, so performance scales linearly with --jobs. X-Gentoo-Bug: 565540 X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=565540 Acked-by: Alexander Berntsen <bernalex@gentoo.org>
Diffstat (limited to 'bin/egencache')
-rwxr-xr-xbin/egencache33
1 files changed, 18 insertions, 15 deletions
diff --git a/bin/egencache b/bin/egencache
index b44ad11b6..1cc2f3d4f 100755
--- a/bin/egencache
+++ b/bin/egencache
@@ -781,6 +781,23 @@ class GenChangeLogs(object):
encoding=_encodings['stdio'], errors='strict')
def generate_changelog(self, cp):
+
+ os.chdir(os.path.join(self._repo_path, cp))
+ # Determine whether ChangeLog is up-to-date by comparing
+ # the newest commit timestamp with the ChangeLog timestamp.
+ lmod = self.grab(['git', self._work_tree, 'log', '--format=%ct', '-1', '.'])
+ if not lmod:
+ # This cp has not been added to the repo.
+ return
+
+ try:
+ cmod = os.stat('ChangeLog').st_mtime
+ except OSError:
+ cmod = 0
+
+ if float(cmod) >= float(lmod):
+ return
+
try:
output = io.open(self._changelog_output,
mode='w', encoding=_encodings['repo.content'],
@@ -913,21 +930,7 @@ class GenChangeLogs(object):
return
for cp in self._portdb.cp_all():
- os.chdir(os.path.join(self._repo_path, cp))
- # Determine whether ChangeLog is up-to-date by comparing
- # the newest commit timestamp with the ChangeLog timestamp.
- lmod = self.grab(['git', self._work_tree, 'log', '--format=%ct', '-1', '.'])
- if not lmod:
- # This cp has not been added to the repo.
- continue
-
- try:
- cmod = os.stat('ChangeLog').st_mtime
- except OSError:
- cmod = 0
-
- if float(cmod) < float(lmod):
- yield AsyncFunction(target=self.generate_changelog, args=[cp])
+ yield AsyncFunction(target=self.generate_changelog, args=[cp])
def run(self):
return run_main_scheduler(