[sysadmin-bin] post-receive-notify-ostree: Encode - and + when passing module names through fishpoll



commit ae44709fc7d24295777ba276303fbbd93ea49ee0
Author: Owen W. Taylor <otaylor fishsoup net>
Date:   Tue Oct 9 02:14:51 2012 -0400

    post-receive-notify-ostree: Encode - and + when passing module names through fishpoll

 git/post-receive-notify-ostree |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/git/post-receive-notify-ostree b/git/post-receive-notify-ostree
index ae25591..087040b 100755
--- a/git/post-receive-notify-ostree
+++ b/git/post-receive-notify-ostree
@@ -25,6 +25,7 @@
 # ostree.gnome.org
 
 import os
+import re
 from subprocess import Popen
 import sys
 
@@ -38,6 +39,19 @@ from git import *
 def main():
     module_name = get_module_name()
 
+    # fishpoke only allows a limited set of characters in subjects, which
+    # isn't sufficient to encode our module names. We do a simple encoding
+    # substitution to pass through - and +. (Probably should just fix
+    # fishpoll - fishpoll isn't even erroring out in a clear fashion,
+    # but this is easier for the moment.)
+    module_name = re.replace('__', '___5f', module_name)
+    module_name = re.replace('+', '__2b', module_name)
+    module_name = re.replace('-', '__2d', module_name)
+
+    if (re.match('^[A-Za-z0-9_.]$', module_name)):
+        print >>sys.stderr, "Module name has unexpected characters, can't notify ostree.gnome.org"
+        return
+
     process = Popen(["/usr/bin/fishpoke", "ostree-back", "modules_changed", module_name],
                       stdout=None, stderr=None, stdin=None)
     process.wait()



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]