[projects/git-slug: 65/170] Change set up of post-receive hooks

glen glen at pld-linux.org
Mon Sep 21 21:44:16 CEST 2015


commit 9bc6508de1c8938ce2e7b0a1388f49c146ea7a95
Author: Kacper Kornet <draenog at pld-linux.org>
Date:   Tue Dec 13 09:26:33 2011 +0000

    Change set up of post-receive hooks
    
    Allow for some additional hooks in hooks/post-receive.d directory.

 post-receive | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/post-receive b/post-receive
index d1c5f04..9e1b8b4 100755
--- a/post-receive
+++ b/post-receive
@@ -14,10 +14,15 @@ from git_slug.gitrepo import GitRepo
 
 data = sys.stdin.readlines()
 
-mail = subprocess.Popen(["./hooks/mailnotification"], stdin=subprocess.PIPE)
-for line in data:
-    mail.stdin.write(line.encode('utf-8'))
-mail.communicate()
+if (os.path.isdir('hooks/post-receive.d')):
+    for hook in os.listdir('hooks/post-receive.d'):
+        hook = os.path.join('hooks/post-receive.d', hook)
+        if (hook.endswith(('~','.bak','.rpmsave','.rpmnew')) or not os.access(hook, os.X_OK)):
+            continue
+        hook_process = subprocess.Popen([hook], stdin=subprocess.PIPE)
+        for line in data:
+            hook_process.stdin.write(line.encode('utf-8'))
+        hook_process.communicate()
 
 gitrepo = os.environ.get('GL_REPO')
 if gitrepo.startswith('packages/'):
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/projects/git-slug.git/commitdiff/4ed64f73960519a2f4fd04c42950b2c96ae795c5



More information about the pld-cvs-commit mailing list