rpms/tinyerp/FC-3 tinyerp-server-pidlog.patch, NONE, 1.1 tinyerp-server, 1.3, 1.4 tinyerp-server.conf, 1.1, 1.2 tinyerp-server.patch, 1.5, 1.6 tinyerp.spec, 1.11, 1.12

Dan Horak (sharkcz) fedora-extras-commits at redhat.com
Sat Mar 18 14:39:59 UTC 2006


Author: sharkcz

Update of /cvs/extras/rpms/tinyerp/FC-3
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv12462

Modified Files:
	tinyerp-server tinyerp-server.conf tinyerp-server.patch 
	tinyerp.spec 
Added Files:
	tinyerp-server-pidlog.patch 
Log Message:
 - added patch for handling the pid and log file in the server, modified the init.d script
 - updated config file to include only default values


tinyerp-server-pidlog.patch:

--- NEW FILE tinyerp-server-pidlog.patch ---
diff -Nru server.orig/bin/netsvc.py server/bin/netsvc.py
--- server.orig/bin/netsvc.py	2005-10-07 13:45:46.000000000 +0200
+++ server/bin/netsvc.py	2006-03-18 14:47:47.000000000 +0100
@@ -96,13 +96,20 @@
 class ServiceUnavailable(Exception):
 	pass
 
+import tools.config
+import os
+
 LOG_DEBUG='debug'
 LOG_INFO='info'
 LOG_WARNING='warn'
 LOG_ERROR='error'
 LOG_CRITICAL='critical'
 
-handler = logging.StreamHandler(sys.stdout)
+if tools.config['logfile']:
+	fd = open(tools.config['logfile'], 'a')
+	handler = logging.StreamHandler(fd)
+else:
+	handler = logging.StreamHandler(sys.stdout)
 
 # create a format for log messages and dates
 formatter = logging.Formatter('%(asctime)s %(levelname)s:%(name)s:%(message)s', '%a, %d %b %Y %H:%M:%S')
@@ -202,11 +209,19 @@
 		self.server.socket.close()
 		self.server.socket.close()
 		Agent.quit()
+		if tools.config['pidfile']:
+			os.unlink(tools.config['pidfile'])
 		del self.server
 		sys.exit(0)
 
 	def start(self):
+		if tools.config['pidfile']:
+			fd=open(tools.config['pidfile'], 'w')
+			pidtext="%d" % (os.getpid())
+			fd.write(pidtext)
+			fd.close()
 		signal.signal(signal.SIGINT, self.handler)
+		signal.signal(signal.SIGTERM, self.handler)
 		self.server.register_introspection_functions()
 		self.server.serve_forever()
 
diff -Nru server.orig/bin/tools/config.py server/bin/tools/config.py
--- server.orig/bin/tools/config.py	2006-01-22 20:26:30.000000000 +0100
+++ server/bin/tools/config.py	2006-03-10 11:16:19.000000000 +0100
@@ -50,6 +50,8 @@
 			'language': None,
 			'addons_path' : None,
 			'root_path' : None,
+			'pidfile' : None,
+			'logfile' : None,
 		}
 
 		parser = optparse.OptionParser(version=tinyerp_version_string)
@@ -57,6 +59,8 @@
 		parser.add_option("-c", "--config", dest="config", help="specify alternate config file")
 		parser.add_option("-s", "--save", action="store_true", dest="save", default=False, help="save configuration to ~/.terp_serverrc")
 		parser.add_option("-v", "--verbose", action="store_true", dest="verbose", default=False, help="enable debugging")
+		parser.add_option("--pidfile", dest="pidfile", help="file where the server pid will be stored")
+		parser.add_option("--logfile", dest="logfile", help="file where the server log will be stored")
 		
 		parser.add_option("-n", "--interface", dest="interface", help="specify the TCP IP address")
 		parser.add_option("-p", "--port", dest="port", help="specify the TCP port")
@@ -104,6 +108,8 @@
 			
 		self.options['upgrade'] = opt.upgrade
 		self.options['verbose'] = opt.verbose
+		self.options['pidfile'] = opt.pidfile
+		self.options['logfile'] = opt.logfile
 
 		init = {}
 		if opt.init:


Index: tinyerp-server
===================================================================
RCS file: /cvs/extras/rpms/tinyerp/FC-3/tinyerp-server,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- tinyerp-server	25 Jan 2006 09:14:04 -0000	1.3
+++ tinyerp-server	18 Mar 2006 14:39:56 -0000	1.4
@@ -14,21 +14,23 @@
 # Source function library.
 . /etc/rc.d/init.d/functions
 
-OPTS=""
+PIDFILE=/var/spool/tinyerp/tinyerp-server.pid
+LOCKFILE=/var/lock/subsys/tinyerp-server
+LOGFILE=/var/log/tinyerp/tinyerp-server.log
+
+OPTS="--pidfile=$PIDFILE --logfile=$LOGFILE"
 
 prog="tinyerp-server"
 
 # check if the tinyerp-server conf file is present, then use it
 if [ -f /etc/tinyerp-server.conf ]; then
-    OPTS="-c /etc/tinyerp-server.conf"
+    OPTS="$OPTS -c /etc/tinyerp-server.conf"
 fi
 
 # check the existence of the tinyerp-server script
 [ -z "/usr/bin/tinyerp-server" ] && exit 0
 
 RETVAL=0
-PIDFILE=/var/spool/tinyerp/tinyerp-server.pid
-LOCKFILE=/var/lock/subsys/tinyerp-server
 
 start() {
     echo -n $"Starting $prog: "
@@ -45,7 +47,7 @@
     kill -TERM `cat $PIDFILE` > /dev/null 2>&1
     RETVAL=$?
     if [ $RETVAL -eq 0 ] ; then
-    	rm -f $PIDFILE $LOCKFILE
+    	rm -f $LOCKFILE
 
 	echo_success
 	echo 


Index: tinyerp-server.conf
===================================================================
RCS file: /cvs/extras/rpms/tinyerp/FC-3/tinyerp-server.conf,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- tinyerp-server.conf	27 Nov 2005 09:26:58 -0000	1.1
+++ tinyerp-server.conf	18 Mar 2006 14:39:57 -0000	1.2
@@ -1,21 +1,18 @@
 [options]
 without_demo = False
-root_path = None
+upgrade = False
 verbose = False
 xmlrpc = True
-db_user = tinyerp
+db_user = False
 db_password = False
-webdb_host = False
-webdb_name = False
+root_path = None
 soap = False
-db_host = False
-webdb_user = False
-webdb_password = False
-db_name = tinyerp
-webdb_port = False
+translate_modules = ['all']
+db_name = terp
+netrpc = True
 demo = {}
 interface = 
-netrpc = True
+db_host = False
 db_port = False
 port = 8069
 addons_path = None

tinyerp-server.patch:

Index: tinyerp-server.patch
===================================================================
RCS file: /cvs/extras/rpms/tinyerp/FC-3/tinyerp-server.patch,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- tinyerp-server.patch	30 Jan 2006 13:42:31 -0000	1.5
+++ tinyerp-server.patch	18 Mar 2006 14:39:57 -0000	1.6
@@ -21,14 +21,3 @@
                     'stock', 'subscription']
  
  required_modules = [('psycopg', 'PostgreSQL module'),
-@@ -104,8 +106,9 @@
- # create startup script
- start_script = \
- "#!/bin/sh\n\
-+echo $$ > /var/spool/tinyerp/tinyerp-server.pid\n\
- cd %s/lib/python%s/site-packages/tinyerp-server\n\
--exec %s ./tinyerp-server.py $@" % (sys.prefix, py_short_version, sys.executable)
-+exec %s ./tinyerp-server.py $@ >> /var/log/tinyerp/tinyerp-server.log 2>&1" % (sys.prefix, py_short_version, sys.executable)
- # write script
- f = open('tinyerp-server', 'w')
- f.write(start_script)


Index: tinyerp.spec
===================================================================
RCS file: /cvs/extras/rpms/tinyerp/FC-3/tinyerp.spec,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- tinyerp.spec	30 Jan 2006 13:42:31 -0000	1.11
+++ tinyerp.spec	18 Mar 2006 14:39:57 -0000	1.12
@@ -3,7 +3,7 @@
 
 Name:		tinyerp
 Version:	3.2.1
-Release:	1%{?dist}
+Release:	2%{?dist}
 License:	GPL
 Group:		Applications/Productivity
 Summary:	Open Source ERP Client
@@ -22,6 +22,7 @@
 Requires:	pygtk2, pygtk2-libglade, pydot
 Patch0:		tinyerp-client.patch
 Patch1:		tinyerp-server.patch
+Patch2:		tinyerp-server-pidlog.patch
 
 %description
 Tiny ERP is a free enterprise management software package. It 
@@ -49,6 +50,7 @@
 %setup -q -a 1 -c %{name}-%{version}
 %patch0
 %patch1
+%patch2
 
 %build
 cd client
@@ -137,6 +139,10 @@
 
 
 %changelog
+* Sat Mar 18 2006 Dan Horak <dan at danny.cz> 3.2.1-2
+- new config file with only default values (#184505)
+- added a patch for handling the pid and log file in the server (#184502)
+
 * Mon Jan 30 2006 Dan Horak <dan at danny.cz> 3.2.1-1
 - update to upstream tinyerp 3.2.1
 - fixed filename for the czech translation




More information about the fedora-extras-commits mailing list