Use execfile to run the client/deps/ setup .py files instead of
launching them as their own subprocess.  None of them do anything
beyond just importing the autotest utils module for utils.system()
anyways and none of them call sys.exit() so this makes it easier.

Why?  We have our autotest client packaged up as a bundle such that
subprocesses wouldn't be able to find and import code from its
autotest_lib.client without gross hackery.  Using execfile allows
the deps to remain individually packaged without needing to be bundled
up with their own copy of the supporting client utils code that they
depend on.

As these are no longer run as their own process but ran in process,
their common.py imports and files are no longer needed.

TESTED: I ran a client tsc test using a client with this change
which fetches our gcc64 dependency, runs it via execfile and builds
the code.

Signed-off-by: Gregory Smith <[email protected]>

--- autotest/client/bin/job.py  2010-07-29 10:44:58.000000000 -0700
+++ autotest/client/bin/job.py  2010-08-31 10:57:37.000000000 -0700
@@ -503,7 +503,7 @@
                 raise error.TestError("Dependency %s does not exist" % dep)
 
             os.chdir(dep_dir)
-            utils.system('./' + dep + '.py')
+            execfile('./' + dep + '.py', {})
 
 
     def _runtest(self, url, tag, args, dargs):
--- autotest/client/deps/boottool/boottool.py   2009-01-08 13:02:27.000000000 
-0800
+++ autotest/client/deps/boottool/boottool.py   2010-08-31 10:57:37.000000000 
-0700
@@ -1,7 +1,6 @@
 #!/usr/bin/python
 
 import os
-import common
 from autotest_lib.client.bin import utils
 
 # To use this, you have to set PERL5LIB to:
==== (deleted) 
//depot/google_vendor_src_branch/autotest/client/deps/boottool/common.py ====
--- autotest/client/deps/boottool/common.py     2008-06-20 10:53:56.000000000 
-0700
+++ /dev/null   2009-12-17 12:29:38.000000000 -0800
@@ -1,8 +0,0 @@
-import os, sys
-dirname = os.path.dirname(sys.modules[__name__].__file__)
-client_dir = os.path.abspath(os.path.join(dirname, "../../"))
-sys.path.insert(0, client_dir)
-import setup_modules
-sys.path.pop(0)
-setup_modules.setup(base_path=client_dir,
-                    root_module_name="autotest_lib.client")
==== (deleted) 
//depot/google_vendor_src_branch/autotest/client/deps/dejagnu/common.py ====
--- autotest/client/deps/dejagnu/common.py      2009-04-24 14:27:53.000000000 
-0700
+++ /dev/null   2009-12-17 12:29:38.000000000 -0800
@@ -1,8 +0,0 @@
-import os, sys
-dirname = os.path.dirname(sys.modules[__name__].__file__)
-client_dir = os.path.abspath(os.path.join(dirname, "../../"))
-sys.path.insert(0, client_dir)
-import setup_modules
-sys.path.pop(0)
-setup_modules.setup(base_path=client_dir,
-                    root_module_name="autotest_lib.client")
--- autotest/client/deps/dejagnu/dejagnu.py     2009-04-24 14:27:53.000000000 
-0700
+++ autotest/client/deps/dejagnu/dejagnu.py     2010-08-31 10:57:37.000000000 
-0700
@@ -1,7 +1,6 @@
 #!/usr/bin/python
 
 import os
-import common
 from autotest_lib.client.bin import utils
 
 version = 1
==== (deleted) 
//depot/google_vendor_src_branch/autotest/client/deps/gcc32/common.py ====
--- autotest/client/deps/libaio/common.py       2008-06-20 10:53:56.000000000 
-0700
+++ /dev/null   2009-12-17 12:29:38.000000000 -0800
@@ -1,8 +0,0 @@
-import os, sys
-dirname = os.path.dirname(sys.modules[__name__].__file__)
-client_dir = os.path.abspath(os.path.join(dirname, "../../"))
-sys.path.insert(0, client_dir)
-import setup_modules
-sys.path.pop(0)
-setup_modules.setup(base_path=client_dir,
-                    root_module_name="autotest_lib.client")
--- autotest/client/deps/libaio/libaio.py       2010-03-04 11:05:13.000000000 
-0800
+++ autotest/client/deps/libaio/libaio.py       2010-08-31 10:57:37.000000000 
-0700
@@ -1,7 +1,6 @@
 #!/usr/bin/python
 
 import os
-import common
 from autotest_lib.client.bin import utils
 
 version = 1
==== (deleted) 
//depot/google_vendor_src_branch/autotest/client/deps/libcap/common.py ====
--- autotest/client/deps/libcap/common.py       2008-11-13 13:04:31.000000000 
-0800
+++ /dev/null   2009-12-17 12:29:38.000000000 -0800
@@ -1,8 +0,0 @@
-import os, sys
-dirname = os.path.dirname(sys.modules[__name__].__file__)
-client_dir = os.path.abspath(os.path.join(dirname, "../../"))
-sys.path.insert(0, client_dir)
-import setup_modules
-sys.path.pop(0)
-setup_modules.setup(base_path=client_dir,
-                    root_module_name="autotest_lib.client")
--- autotest/client/deps/libcap/libcap.py       2009-01-08 13:02:27.000000000 
-0800
+++ autotest/client/deps/libcap/libcap.py       2010-08-31 10:57:37.000000000 
-0700
@@ -1,6 +1,6 @@
 #!/usr/bin/python
 
-import os, common
+import os
 from autotest_lib.client.bin import utils
 
 version = 2
==== (deleted) 
//depot/google_vendor_src_branch/autotest/client/deps/libnet/common.py ====
--- autotest/client/deps/libnet/common.py       2008-06-20 10:53:56.000000000 
-0700
+++ /dev/null   2009-12-17 12:29:38.000000000 -0800
@@ -1,8 +0,0 @@
-import os, sys
-dirname = os.path.dirname(sys.modules[__name__].__file__)
-client_dir = os.path.abspath(os.path.join(dirname, "../../"))
-sys.path.insert(0, client_dir)
-import setup_modules
-sys.path.pop(0)
-setup_modules.setup(base_path=client_dir,
-                    root_module_name="autotest_lib.client")
--- autotest/client/deps/libnet/libnet.py       2009-01-08 13:02:27.000000000 
-0800
+++ autotest/client/deps/libnet/libnet.py       2010-08-31 10:57:37.000000000 
-0700
@@ -1,7 +1,6 @@
 #!/usr/bin/python
 
 import os
-import common
 from autotest_lib.client.bin import utils
 
 version = 1
==== (deleted) 
//depot/google_vendor_src_branch/autotest/client/deps/mysql/common.py ====
--- autotest/client/deps/mysql/common.py        2008-06-20 10:53:56.000000000 
-0700
+++ /dev/null   2009-12-17 12:29:38.000000000 -0800
@@ -1,8 +0,0 @@
-import os, sys
-dirname = os.path.dirname(sys.modules[__name__].__file__)
-client_dir = os.path.abspath(os.path.join(dirname, "../../"))
-sys.path.insert(0, client_dir)
-import setup_modules
-sys.path.pop(0)
-setup_modules.setup(base_path=client_dir,
-                    root_module_name="autotest_lib.client")
--- autotest/client/deps/mysql/mysql.py 2009-01-08 13:02:27.000000000 -0800
+++ autotest/client/deps/mysql/mysql.py 2010-08-31 10:57:37.000000000 -0700
@@ -1,7 +1,6 @@
 #!/usr/bin/python
 
 import os
-import common
 from autotest_lib.client.bin import utils
 
 version = 3
==== (deleted) 
//depot/google_vendor_src_branch/autotest/client/deps/pgpool/common.py ====
--- autotest/client/deps/pgpool/common.py       2008-06-20 10:53:56.000000000 
-0700
+++ /dev/null   2009-12-17 12:29:38.000000000 -0800
@@ -1,8 +0,0 @@
-import os, sys
-dirname = os.path.dirname(sys.modules[__name__].__file__)
-client_dir = os.path.abspath(os.path.join(dirname, "../../"))
-sys.path.insert(0, client_dir)
-import setup_modules
-sys.path.pop(0)
-setup_modules.setup(base_path=client_dir,
-                    root_module_name="autotest_lib.client")
--- autotest/client/deps/pgpool/pgpool.py       2009-01-08 13:02:27.000000000 
-0800
+++ autotest/client/deps/pgpool/pgpool.py       2010-08-31 10:57:37.000000000 
-0700
@@ -1,7 +1,6 @@
 #!/usr/bin/python
 
 import os
-import common
 from autotest_lib.client.bin import utils
 
 version = 1
==== (deleted) 
//depot/google_vendor_src_branch/autotest/client/deps/pgsql/common.py ====
--- autotest/client/deps/pgsql/common.py        2008-06-20 10:53:56.000000000 
-0700
+++ /dev/null   2009-12-17 12:29:38.000000000 -0800
@@ -1,8 +0,0 @@
-import os, sys
-dirname = os.path.dirname(sys.modules[__name__].__file__)
-client_dir = os.path.abspath(os.path.join(dirname, "../../"))
-sys.path.insert(0, client_dir)
-import setup_modules
-sys.path.pop(0)
-setup_modules.setup(base_path=client_dir,
-                    root_module_name="autotest_lib.client")
--- autotest/client/deps/pgsql/pgsql.py 2009-01-08 13:02:27.000000000 -0800
+++ autotest/client/deps/pgsql/pgsql.py 2010-08-31 10:57:37.000000000 -0700
@@ -1,7 +1,6 @@
 #!/usr/bin/python
 
 import os
-import common
 from autotest_lib.client.bin import utils
 
 version = 4
==== (deleted) 
//depot/google_vendor_src_branch/autotest/client/deps/systemtap/common.py ====
--- autotest/client/deps/systemtap/common.py    2009-04-24 10:21:48.000000000 
-0700
+++ /dev/null   2009-12-17 12:29:38.000000000 -0800
@@ -1,8 +0,0 @@
-import os, sys
-dirname = os.path.dirname(sys.modules[__name__].__file__)
-client_dir = os.path.abspath(os.path.join(dirname, "../../"))
-sys.path.insert(0, client_dir)
-import setup_modules
-sys.path.pop(0)
-setup_modules.setup(base_path=client_dir,
-                    root_module_name="autotest_lib.client")
--- autotest/client/deps/systemtap/systemtap.py 2009-11-10 12:15:23.000000000 
-0800
+++ autotest/client/deps/systemtap/systemtap.py 2010-08-31 10:57:37.000000000 
-0700
@@ -1,7 +1,6 @@
 #!/usr/bin/python
 
 import os
-import common
 import shutil
 from autotest_lib.client.bin import utils
_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

Reply via email to