[yum-cvs] yum/bin yum-updatesd.py,1.2,1.3

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


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

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/bin/yum-updatesd.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- yum-updatesd.py	5 Dec 2006 00:40:51 -0000	1.2
+++ yum-updatesd.py	3 May 2007 01:24:34 -0000	1.3
@@ -1,32 +1,25 @@
 #!/usr/bin/python
-import sys
-try:
-    import yum
-except ImportError:
-    print >> sys.stderr, """\
-There was a problem importing one of the Python modules
-required to run yum. The error leading to this problem was:
-
-   %s
+import sys, os
+import optparse
 
-Please install a package which provides this module, or
-verify that the module is installed correctly.
+parser = optparse.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()
 
-It's possible that the above module doesn't match the
-current version of Python, which is:
-%s
-
-If you cannot solve this problem yourself, please go to 
-the yum faq at:
-  http://wiki.linux.duke.edu/YumFaq
-  
-""" % (sys.exc_value, sys.version)
-    sys.exit(1)
+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)
 
 sys.path.insert(0, '/usr/share/yum-cli')
 try:
     import yumupd
-    yumupd.main()
+    yumupd.main(options)
 except KeyboardInterrupt, e:
     print >> sys.stderr, "\n\nExiting on user cancel."
     sys.exit(1)




More information about the Yum-cvs-commits mailing list