From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/portage:plugin-sync commit in: pym/portage/sync/
Date: Mon, 1 Dec 2014 21:50:06 +0000 (UTC) [thread overview]
Message-ID: <1417470581.462c077d732d50aadd21318e55e6ecda55aff9ff.mgorny@gentoo> (raw)
commit: 462c077d732d50aadd21318e55e6ecda55aff9ff
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 27 05:05:01 2014 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Dec 1 21:49:41 2014 +0000
URL: http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=462c077d
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 21b57f4..a88d4c5 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
@@ -142,17 +155,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='None'):
+ 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):
next reply other threads:[~2014-12-01 21:50 UTC|newest]
Thread overview: 66+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-01 21:50 Michał Górny [this message]
-- strict thread matches above, loose matches on Subject: below --
2014-12-04 20:16 [gentoo-commits] proj/portage:master commit in: pym/portage/sync/ Brian Dolbec
2014-12-04 20:04 ` [gentoo-commits] proj/portage:plugin-sync " Brian Dolbec
2014-12-04 20:16 [gentoo-commits] proj/portage:master " Brian Dolbec
2014-12-04 20:04 ` [gentoo-commits] proj/portage:plugin-sync " Brian Dolbec
2014-12-04 20:16 [gentoo-commits] proj/portage:master " Brian Dolbec
2014-12-04 20:04 ` [gentoo-commits] proj/portage:plugin-sync " Brian Dolbec
2014-12-04 20:04 Brian Dolbec
2014-12-04 20:04 Brian Dolbec
2014-12-04 20:04 Brian Dolbec
2014-12-04 20:04 Brian Dolbec
2014-12-04 20:04 Brian Dolbec
2014-12-01 21:50 Michał Górny
2014-12-01 21:50 Michał Górny
2014-12-01 21:50 Michał Górny
2014-12-01 21:50 Michał Górny
2014-12-01 21:50 Michał Górny
2014-10-21 5:05 Zac Medico
2014-10-21 5:05 Zac Medico
2014-10-21 5:05 Zac Medico
2014-10-21 5:05 Zac Medico
2014-10-21 5:05 Zac Medico
2014-10-21 5:05 Zac Medico
2014-10-20 20:46 Zac Medico
2014-10-20 3:54 Zac Medico
2014-10-20 3:54 Zac Medico
2014-10-20 3:54 Zac Medico
2014-10-20 3:54 Zac Medico
2014-10-20 3:54 Zac Medico
2014-09-30 0:46 Brian Dolbec
2014-09-30 0:46 Brian Dolbec
2014-09-30 0:46 Brian Dolbec
2014-09-30 0:46 Brian Dolbec
2014-09-30 0:46 Brian Dolbec
2014-09-29 18:29 Brian Dolbec
2014-09-29 18:29 Brian Dolbec
2014-09-29 18:29 Brian Dolbec
2014-09-29 18:29 Brian Dolbec
2014-09-29 18:29 Brian Dolbec
2014-09-27 5:05 Brian Dolbec
2014-09-27 2:20 Brian Dolbec
2014-09-27 2:20 Brian Dolbec
2014-09-27 2:20 Brian Dolbec
2014-09-27 2:20 Brian Dolbec
2014-09-05 21:15 Brian Dolbec
2014-09-05 21:15 Brian Dolbec
2014-09-05 21:15 Brian Dolbec
2014-09-05 4:38 Brian Dolbec
2014-09-05 4:38 Brian Dolbec
2014-09-05 4:38 Brian Dolbec
2014-09-04 1:18 Brian Dolbec
2014-09-04 1:18 Brian Dolbec
2014-09-03 23:36 Brian Dolbec
2014-09-03 23:36 Brian Dolbec
2014-08-19 20:19 Brian Dolbec
2014-06-17 0:42 Brian Dolbec
2014-06-16 15:46 Brian Dolbec
2014-06-16 15:18 Brian Dolbec
2014-05-11 17:22 Brian Dolbec
2014-05-02 23:13 Brian Dolbec
2014-04-22 2:36 Brian Dolbec
2014-04-22 2:36 Brian Dolbec
2014-04-22 2:36 Brian Dolbec
2014-04-22 2:36 Brian Dolbec
2014-04-22 2:36 Brian Dolbec
2014-04-22 2:36 Brian Dolbec
2014-03-14 16:23 Brian Dolbec
2014-03-14 16:23 Brian Dolbec
2014-02-19 8:29 Brian Dolbec
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1417470581.462c077d732d50aadd21318e55e6ecda55aff9ff.mgorny@gentoo \
--to=mgorny@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox