From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 1DCC91389E2 for ; Thu, 4 Dec 2014 20:16:18 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id E48C9E0916; Thu, 4 Dec 2014 20:16:14 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 15C87E0904 for ; Thu, 4 Dec 2014 20:16:14 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 57A4434059F for ; Thu, 4 Dec 2014 20:16:13 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id AD19CB943 for ; Thu, 4 Dec 2014 20:16:10 +0000 (UTC) From: "Brian Dolbec" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Brian Dolbec" Message-ID: <1417722994.737ccc31d83f73395a22f4a19bb13fbc1e94208a.dol-sen@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/sync/ X-VCS-Repository: proj/portage X-VCS-Files: pym/portage/sync/controller.py X-VCS-Directories: pym/portage/sync/ X-VCS-Committer: dol-sen X-VCS-Committer-Name: Brian Dolbec X-VCS-Revision: 737ccc31d83f73395a22f4a19bb13fbc1e94208a X-VCS-Branch: master Date: Thu, 4 Dec 2014 20:16:10 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 88a52f44-ce24-4f57-a4d7-90d92a97d7ae X-Archives-Hash: 84ba50fe1ed592c125c21949d1a0a14d commit: 737ccc31d83f73395a22f4a19bb13fbc1e94208a Author: Brian Dolbec gentoo org> AuthorDate: Sat Sep 27 05:05:01 2014 +0000 Commit: Brian Dolbec gmail com> CommitDate: Thu Dec 4 19:56:34 2014 +0000 URL: http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=737ccc31 Sync: Implement native postsync.d hook code As per bug 522032, pass the repo.name and repo.sync_uri to the hooks. With this information, the hooks can be taylored to operate for only certain repos, or only when all repos have been synced. --- pym/portage/sync/controller.py | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/pym/portage/sync/controller.py b/pym/portage/sync/controller.py index 9e483e9..c860e1a 100644 --- a/pym/portage/sync/controller.py +++ b/pym/portage/sync/controller.py @@ -87,6 +87,19 @@ class SyncManager(object): self.module_controller = portage.sync.module_controller self.module_names = self.module_controller.module_names + postsync_dir = os.path.join(self.settings["PORTAGE_CONFIGROOT"], + portage.USER_CONFIG_PATH, "postsync.d") + hooks = [] + for root, dirs, names in os.walk(postsync_dir, topdown=True): + #print("root:", root, "dirs:", dirs, "names:", names) + for name in names: + filepath = os.path.join(root, name) + if os.access(filepath, os.X_OK): + hooks.append((filepath, name)) + else: + writemsg_level(" %s postsync.d hook: '%s' is not executable\n" + % (warn("*"), name,), level=logging.WARN, noiselevel=2) + self.hooks = hooks def get_module_descriptions(self, mod): @@ -129,7 +142,7 @@ class SyncManager(object): taskmaster = TaskHandler(callback=self.do_callback) taskmaster.run_tasks(tasks, func, status, options=task_opts) - self.perform_post_sync_hook(repo.sync_uri) + self.perform_post_sync_hook(repo.name, repo.sync_uri) return self.exitcode, None @@ -143,17 +156,18 @@ class SyncManager(object): return - def perform_post_sync_hook(self, dosyncuri): - postsync = os.path.join(self.settings["PORTAGE_CONFIGROOT"], - portage.USER_CONFIG_PATH, "bin", "post_sync") - if os.access(postsync, os.X_OK): - retval = portage.process.spawn([postsync, dosyncuri], - env=self.settings.environ()) + def perform_post_sync_hook(self, reponame, dosyncuri=''): + succeeded = os.EX_OK + for filepath, hook in self.hooks: + writemsg_level("Spawning post_sync hook: %s\n" % (hook,), + level=logging.ERROR, noiselevel=4) + retval = portage.process.spawn([filepath, + reponame, dosyncuri], env=self.settings.environ()) if retval != os.EX_OK: - writemsg_level(" %s spawn failed of %s\n" % (bad("*"), - postsync,), level=logging.ERROR, noiselevel=-1) - return retval - return os.EX_OK + writemsg_level(" %s Spawn failed for: %s, %s\n" % (bad("*"), + hook, filepath), level=logging.ERROR, noiselevel=-1) + succeeded = retval + return succeeded def pre_sync(self, repo): From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 931A61389E2 for ; Thu, 4 Dec 2014 20:04:39 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 20661E08D4; Thu, 4 Dec 2014 20:04:36 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 3EDDBE087A for ; Thu, 4 Dec 2014 20:04:35 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 5941A34059A for ; Thu, 4 Dec 2014 20:04:34 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 50030B940 for ; Thu, 4 Dec 2014 20:04:31 +0000 (UTC) From: "Brian Dolbec" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Brian Dolbec" Message-ID: <1417722994.737ccc31d83f73395a22f4a19bb13fbc1e94208a.dol-sen@gentoo> Subject: [gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/ X-VCS-Repository: proj/portage X-VCS-Files: pym/portage/sync/controller.py X-VCS-Directories: pym/portage/sync/ X-VCS-Committer: dol-sen X-VCS-Committer-Name: Brian Dolbec X-VCS-Revision: 737ccc31d83f73395a22f4a19bb13fbc1e94208a X-VCS-Branch: plugin-sync Date: Thu, 4 Dec 2014 20:04:31 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: d7724270-f9ae-45de-888a-acb9ddc2bbac X-Archives-Hash: 08fec10dc45b78b0e9afa53f10f10d05 Message-ID: <20141204200431.Cu3Ea2tCA4JAm6s_Q4dYykbH5Wfp5TWPgrIOPP0UyDY@z> commit: 737ccc31d83f73395a22f4a19bb13fbc1e94208a Author: Brian Dolbec gentoo org> AuthorDate: Sat Sep 27 05:05:01 2014 +0000 Commit: Brian Dolbec gmail com> CommitDate: Thu Dec 4 19:56:34 2014 +0000 URL: http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=737ccc31 Sync: Implement native postsync.d hook code As per bug 522032, pass the repo.name and repo.sync_uri to the hooks. With this information, the hooks can be taylored to operate for only certain repos, or only when all repos have been synced. --- pym/portage/sync/controller.py | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/pym/portage/sync/controller.py b/pym/portage/sync/controller.py index 9e483e9..c860e1a 100644 --- a/pym/portage/sync/controller.py +++ b/pym/portage/sync/controller.py @@ -87,6 +87,19 @@ class SyncManager(object): self.module_controller = portage.sync.module_controller self.module_names = self.module_controller.module_names + postsync_dir = os.path.join(self.settings["PORTAGE_CONFIGROOT"], + portage.USER_CONFIG_PATH, "postsync.d") + hooks = [] + for root, dirs, names in os.walk(postsync_dir, topdown=True): + #print("root:", root, "dirs:", dirs, "names:", names) + for name in names: + filepath = os.path.join(root, name) + if os.access(filepath, os.X_OK): + hooks.append((filepath, name)) + else: + writemsg_level(" %s postsync.d hook: '%s' is not executable\n" + % (warn("*"), name,), level=logging.WARN, noiselevel=2) + self.hooks = hooks def get_module_descriptions(self, mod): @@ -129,7 +142,7 @@ class SyncManager(object): taskmaster = TaskHandler(callback=self.do_callback) taskmaster.run_tasks(tasks, func, status, options=task_opts) - self.perform_post_sync_hook(repo.sync_uri) + self.perform_post_sync_hook(repo.name, repo.sync_uri) return self.exitcode, None @@ -143,17 +156,18 @@ class SyncManager(object): return - def perform_post_sync_hook(self, dosyncuri): - postsync = os.path.join(self.settings["PORTAGE_CONFIGROOT"], - portage.USER_CONFIG_PATH, "bin", "post_sync") - if os.access(postsync, os.X_OK): - retval = portage.process.spawn([postsync, dosyncuri], - env=self.settings.environ()) + def perform_post_sync_hook(self, reponame, dosyncuri=''): + succeeded = os.EX_OK + for filepath, hook in self.hooks: + writemsg_level("Spawning post_sync hook: %s\n" % (hook,), + level=logging.ERROR, noiselevel=4) + retval = portage.process.spawn([filepath, + reponame, dosyncuri], env=self.settings.environ()) if retval != os.EX_OK: - writemsg_level(" %s spawn failed of %s\n" % (bad("*"), - postsync,), level=logging.ERROR, noiselevel=-1) - return retval - return os.EX_OK + writemsg_level(" %s Spawn failed for: %s, %s\n" % (bad("*"), + hook, filepath), level=logging.ERROR, noiselevel=-1) + succeeded = retval + return succeeded def pre_sync(self, repo):