[Buildbot-commits] buildbot/buildbot/test test_vc.py,1.58,1.59

Brian Warner warner at users.sourceforge.net
Mon Jun 12 08:36:29 UTC 2006


Update of /cvsroot/buildbot/buildbot/buildbot/test
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv17071/buildbot/test

Modified Files:
	test_vc.py 
Log Message:
[project @ test_vc.py (P4): avoid use of 'sh -c' by passing '-d' to p4 so it won't use PWD]

Original author: warner at lothar.com
Date: 2006-06-12 08:18:17

Index: test_vc.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/test/test_vc.py,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -d -r1.58 -r1.59
--- test_vc.py	12 Jun 2006 08:36:22 -0000	1.58
+++ test_vc.py	12 Jun 2006 08:36:27 -0000	1.59
@@ -1415,7 +1415,10 @@
         return proto.started, proto.ended
 
     def dop4(self, basedir, command, failureIsOk=False, stdin=None):
-        command = "-p " + self.p4port + " " + command
+        # p4 looks at $PWD instead of getcwd(), which causes confusion when
+        # we spawn commands without an intervening shell (sh -c). We can
+        # override this with a -d argument.
+        command = "-p %s -d %s %s" % (self.p4port, basedir, command)
         return self.dovc(basedir, command, failureIsOk, stdin)
 
     def createRepository(self):
@@ -1443,11 +1446,8 @@
         # Create first rev (trunk).
         self.populate(os.path.join(tmp, 'trunk'))
         files = ['main.c', 'version.c', 'subdir/subdir.c']
-        w = self.do(tmp, ['sh', '-c', # TODO: ???
-                          "p4 -p %s -c creator add " % self.p4port
-                          + " ".join(['trunk/%s' % f for f in files])])
-        #self.dop4(tmp, "-c creator add "
-        #          + " ".join(['trunk/%s' % f for f in files]))
+        w = self.dop4(tmp, "-c creator add "
+                      + " ".join(['trunk/%s' % f for f in files]))
         yield w; w.getResult()
         descr = self.base_descr
         for file in files:
@@ -1462,9 +1462,7 @@
         w = self.dop4(tmp, '-c creator integrate '
                       + '//depot/trunk/... //depot/branch/...')
         yield w; w.getResult()
-        w = self.do(tmp, ['sh', '-c', # TODO: again?
-                          "p4 -p %s -c creator edit branch/main.c"
-                          % self.p4port])
+        w = self.dop4(tmp, "-c creator edit branch/main.c")
         yield w; w.getResult()
         self.populate_branch(os.path.join(tmp, 'branch'))
         descr = self.base_descr
@@ -1480,9 +1478,7 @@
         tmp = os.path.join(self.repbase, "p4tmp")
         self.version += 1
         version_c = VERSION_C % self.version
-        w = self.do(tmp, ['sh', '-c', # TODO
-                          'p4 -p %s -c creator edit trunk/version.c'
-                           % self.p4port])
+        w = self.dop4(tmp, '-c creator edit trunk/version.c')
         yield w; w.getResult()
         open(os.path.join(tmp, "trunk/version.c"), "w").write(version_c)
         descr = self.base_descr + '\t//depot/trunk/version.c\n'





More information about the Commits mailing list