[plague] Patch server to send a fake request in SIGTERM exit handler to end the

Michael Schwendt mschwendt at fedoraproject.org
Mon Apr 22 13:31:08 UTC 2013


commit 62b35fc4225ec4e0563597f3c7bbf1fa19a09432
Author: Michael Schwendt <mschwendt at fedoraproject.org>
Date:   Mon Apr 22 15:31:01 2013 +0200

    Patch server to send a fake request in SIGTERM exit handler to end the
    
      serve_forever loop.
    - Also add Requires=rpcbind.service in systemd files.
    - Fix typo in EmailUtils.py error message.

 plague-0.4.5.8-emailutils.patch           |   11 +++++++++++
 plague-0.4.5.8-wakeup-serve_forever.patch |   18 ++++++++++++++++++
 plague-builder.service                    |    1 +
 plague-server.service                     |    1 +
 plague.spec                               |   15 ++++++++++++++-
 5 files changed, 45 insertions(+), 1 deletions(-)
---
diff --git a/plague-0.4.5.8-emailutils.patch b/plague-0.4.5.8-emailutils.patch
new file mode 100644
index 0000000..75fe359
--- /dev/null
+++ b/plague-0.4.5.8-emailutils.patch
@@ -0,0 +1,11 @@
+diff -Nur plague-0.4.5.8-orig/server/EmailUtils.py plague-0.4.5.8/server/EmailUtils.py
+--- plague-0.4.5.8-orig/server/EmailUtils.py	2005-10-05 19:42:49.000000000 +0200
++++ plague-0.4.5.8/server/EmailUtils.py	2013-04-22 15:18:51.376472909 +0200
+@@ -31,6 +31,6 @@
+         s.sendmail(sender, [to], msg.as_string())
+         s.close()
+     except socket.error, e:
+-        print "ERROR: could send email to '%s' with subject '%s'.  Error: '%s'" % (to, subject, e)
++        print "ERROR: could not send email to '%s' with subject '%s'.  Error: '%s'" % (to, subject, e)
+         
+ 
diff --git a/plague-0.4.5.8-wakeup-serve_forever.patch b/plague-0.4.5.8-wakeup-serve_forever.patch
new file mode 100644
index 0000000..c2774da
--- /dev/null
+++ b/plague-0.4.5.8-wakeup-serve_forever.patch
@@ -0,0 +1,18 @@
+diff -Nur plague-0.4.5.8-orig/server/main.py plague-0.4.5.8/server/main.py
+--- plague-0.4.5.8-orig/server/main.py	2008-01-31 14:28:05.000000000 +0100
++++ plague-0.4.5.8/server/main.py	2013-04-22 15:16:36.932683928 +0200
+@@ -68,6 +68,14 @@
+     print "Received SIGTERM, quitting..."
+     bm_server.stop()
+ 
++    host = bm_server.server_name
++    port = bm_server.server_port
++    print "Sending fake request to %s:%s to trigger shutdown..." % (host, port)
++    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
++    s.connect((host, port))
++    s.send('WANNAQUIT')
++    s.close()
++
+ def main():
+     global bm_server
+ 
diff --git a/plague-builder.service b/plague-builder.service
index 3218395..7e5d9d8 100644
--- a/plague-builder.service
+++ b/plague-builder.service
@@ -1,5 +1,6 @@
 [Unit]
 Description=Plague builder daemon for build-system slave machines
+Requires=rpcbind.service
 After=rpcbind.service
 
 [Service]
diff --git a/plague-server.service b/plague-server.service
index 38d58bb..1d5aecb 100644
--- a/plague-server.service
+++ b/plague-server.service
@@ -1,5 +1,6 @@
 [Unit]
 Description=Plague server daemon for build-system master machines
+Requires=rpcbind.service
 After=rpcbind.service
 
 [Service]
diff --git a/plague.spec b/plague.spec
index 327911d..cf2b464 100644
--- a/plague.spec
+++ b/plague.spec
@@ -5,7 +5,7 @@ BuildArch: noarch
 Summary: Distributed build system for RPMs
 Name: plague
 Version: 0.4.5.8
-Release: 13%{?dist}
+Release: 14%{?dist}
 License: GPLv2+
 Group: Development/Tools
 #Source: http://fedoraproject.org/projects/plague/releases/%{name}-%{version}.tar.bz2
@@ -23,6 +23,11 @@ Patch1: plague-python25-sqlite.patch
 Patch2: plague-0.4.5.8-filter-results.patch
 # Let server not crash in prep stage with RpmUtilsError exception.
 Patch3: plague-0.4.5.8-prep-srpm-error.patch
+# Typo in email error message.
+Patch4: plague-0.4.5.8-emailutils.patch
+# Send a fake request to break out of the bm_server serve_forever loop.
+# This may avoid polling select() but causes an SSL error message in the log.
+Patch5: plague-0.4.5.8-wakeup-serve_forever.patch
 
 BuildRequires: python
 BuildRequires: systemd-units
@@ -95,6 +100,8 @@ the interface to the build server.
 %patch1 -p1 -b .sqlite3
 %patch2 -p1 -b .filter-results
 %patch3 -p1 -b .prep-srpm-exception
+%patch4 -p1 -b .emailutils-typo
+%patch5 -p1 -b .server-wakeup-serve_forever
 
 
 %build
@@ -181,6 +188,12 @@ mkdir -p $RPM_BUILD_ROOT/var/lib/plague/builder
 
 
 %changelog
+* Mon Apr 22 2013 Michael Schwendt <mschwendt at fedoraproject.org> - 0.4.5.8-14
+- Patch server to send a fake request in SIGTERM exit handler to end the
+  serve_forever loop.
+- Also add Requires=rpcbind.service in systemd files.
+- Fix typo in EmailUtils.py error message.
+
 * Sat Mar 16 2013 Michael Schwendt <mschwendt at fedoraproject.org> - 0.4.5.8-13
 - Let server not crash in prep stage with RpmUtilsError exception.
 


More information about the scm-commits mailing list