[yum-cvs] yum yum-updatesd.py,1.41,1.42

Jeremy Katz katzj at linux.duke.edu
Thu May 3 01:24:36 UTC 2007


Update of /home/groups/yum/cvs/yum
In directory login1.linux.duke.edu:/tmp/cvs-serv8674

Modified Files:
	yum-updatesd.py 
Log Message:
move option parsing around a little so that yum-updatesd will start
faster (rh#220614)


Index: yum-updatesd.py
===================================================================
RCS file: /home/groups/yum/cvs/yum/yum-updatesd.py,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -r1.41 -r1.42
--- yum-updatesd.py	2 May 2007 21:58:08 -0000	1.41
+++ yum-updatesd.py	3 May 2007 01:24:34 -0000	1.42
@@ -602,25 +602,25 @@
     os.chdir(initial_directory)
     os.execve(sys.argv[0], sys.argv, os.environ)  
 
-def main():
+def main(options = None):
     # we'll be threading for downloads/updates
     gobject.threads_init()
     dbus.glib.threads_init()
-    
-    parser = OptionParser()
-    parser.add_option("-f", "--no-fork", action="store_true", default=False, dest="nofork")
-    parser.add_option("-r", "--remote-shutdown", action="store_true", default=False, dest="remoteshutdown")    
-    (options, args) = parser.parse_args()
-
-    if not options.nofork:
-        if os.fork():
-            sys.exit()
-        fd = os.open("/dev/null", os.O_RDWR)
-        os.dup2(fd, 0)
-        os.dup2(fd, 1)
-        os.dup2(fd, 2)
-        os.close(fd)
 
+    if options is None:
+        parser = OptionParser()
+        parser.add_option("-f", "--no-fork", action="store_true", default=False, dest="nofork")
+        parser.add_option("-r", "--remote-shutdown", action="store_true", default=False, dest="remoteshutdown")    
+        (options, args) = parser.parse_args()
+
+        if not options.nofork:
+            if os.fork():
+                sys.exit()
+            fd = os.open("/dev/null", os.O_RDWR)
+            os.dup2(fd, 0)
+            os.dup2(fd, 1)
+            os.dup2(fd, 2)
+            os.close(fd)
 
     confparser = ConfigParser()
     opts = UDConfig()




More information about the Yum-cvs-commits mailing list