]> git.donarmstrong.com Git - wannabuild.git/commitdiff
commit uncommited changes
authorAndreas Barth <aba@not.so.argh.org>
Sat, 30 Apr 2011 21:31:48 +0000 (21:31 +0000)
committerAndreas Barth <aba@not.so.argh.org>
Sat, 30 Apr 2011 21:32:21 +0000 (21:32 +0000)
bin/process-triggers
bin/trigger-wrapper

index 7bae80ebf783c0003a993f15490d81006658ab88..fdaf17713722527e5df70c1c7d2c9bb333610195 100755 (executable)
@@ -24,21 +24,13 @@ while [ $work -eq 1 ]
 do
     # No further runs unless at least one signal is found.
     work=0
-    find /org/wanna-build/signals -type f | while read signal
+    find /org/wanna-build/signals -type f | while read signal_file
     do
         # Process it.
         work=1
-        if [ "$(stat -c '%s' $signal)" -eq 0 ]
-        then
-            /org/wanna-build/triggers/trigger.$(basename $signal)
-        else
-            cat $signal | \
-                (while read args
-                 do
-                     /org/wanna-build/triggers/trigger.$(basename $signal) $args
-                 done)
-        fi
-        rm $signal
+        signal=$(basename $signal_file)
+        /org/wanna-build/triggers/trigger.${signal/.?*} ${signal/?*./}
+        rm $signal_file
     done
 done
 
index 5208c22072b4a896e5ecfe06b4e4c775edb92cac..c3772da42f18cbc16e84db2c8f2880511f0d3ee1 100755 (executable)
@@ -8,16 +8,25 @@ set -- $SSH_ORIGINAL_COMMAND
 
 shift
 args="$*"
+args=${args//[^a-zA-Z-]/}
+args=${args,,}
+
+# Ignore ftpsync stuff.
+if [ "$args" = "syncall" -o "$args" = "sync:all" ]
+then
+    args=""
+fi
 
 echo "$(date): $trigger_name | $args" >> /org/wanna-build/db/signal.log
 
 if [ ! -z "$args" ]
 then
-    # Append because we might get triggered for multiple suites.
-    # (This is mainly for security currently.)
-    echo $args >> /org/wanna-build/signals/$trigger_name
+    # Pass arguments in the filename because we might get triggered for
+    # multiple suites.  A simple append wouldn't be race-free on the
+    # reader side.
+    touch "/org/wanna-build/signals/${trigger_name}.${args}"
 else
-    touch /org/wanna-build/signals/$trigger_name
+    touch "/org/wanna-build/signals/$trigger_name"
 fi
 
 exit 0