extras-buildsys/common ExecUtils.py, NONE, 1.1.2.1 Makefile, 1.7.2.1, 1.7.2.2
Daniel Williams (dcbw)
fedora-extras-commits at redhat.com
Wed Aug 31 01:23:42 UTC 2005
Author: dcbw
Update of /cvs/fedora/extras-buildsys/common
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv22497/common
Modified Files:
Tag: STABLE_0_3
Makefile
Added Files:
Tag: STABLE_0_3
ExecUtils.py
Log Message:
2005-08-26 Dan Williams <dcbw at redhat.com>
* builder/builder.py
common/ExecUtils.py
- Thread jobs on the builder, even though we can only
do one at a time right now. It lets the job proceed
independently of the XMLRPCBuilderServer.
- Make the BuilderMock object's log function private
- Make the XMLRPCBuilderServer's log function private
- To execute mock, we now fork() and execv() the mock process
so that we can more reliably gather its output
- Correctly clean up the mock root directory
- Rename builder.log -> job.log so it can't get confused
with build.log from mock
--- NEW FILE ExecUtils.py ---
#
# executil.py - generic utility functions for executing programs
#
# Erik Troan <ewt at redhat.com>
#
# Copyright 1999-2002 Red Hat, Inc.
#
# This software may be freely redistributed under the terms of the GNU
# library public license.
#
# You should have received a copy of the GNU Library Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
import os
import sys
import types
import select
def getfd(filespec, readOnly = 0):
if type(filespec) == types.IntType:
return filespec
if filespec == None:
filespec = "/dev/null"
flags = os.O_RDWR | os.O_CREAT
if (readOnly):
flags = os.O_RDONLY
return os.open(filespec, flags, 0644)
def exec_with_redirect(cmd, argv, stdin=0, stdout=1, stderr=2):
stdin = getfd(stdin)
if stdout == stderr:
stdout = getfd(stdout)
stderr = stdout
else:
stdout = getfd(stdout)
stderr = getfd(stderr)
cmd = os.path.abspath(cmd)
if not os.access (cmd, os.X_OK):
raise RuntimeError(cmd + " can not be run")
childpid = os.fork()
if (not childpid):
if stdin != 0:
os.dup2(stdin, 0)
os.close(stdin)
if stdout != 1:
os.dup2(stdout, 1)
if stdout != stderr:
os.close(stdout)
if stderr != 2:
os.dup2(stderr, 2)
os.close(stderr)
try:
os.execv(cmd, argv)
except OSError, e:
print "Could not execute command '%s'. Reason: %s" % (cmd, e)
sys.exit(1)
return childpid
def foo():
status = -1
try:
(pid, status) = os.waitpid(childpid, 0)
except OSError, (errno, msg):
print __name__, "waitpid:", msg
return status
Index: Makefile
===================================================================
RCS file: /cvs/fedora/extras-buildsys/common/Makefile,v
retrieving revision 1.7.2.1
retrieving revision 1.7.2.2
diff -u -r1.7.2.1 -r1.7.2.2
--- Makefile 24 Aug 2005 19:23:26 -0000 1.7.2.1
+++ Makefile 31 Aug 2005 01:23:40 -0000 1.7.2.2
@@ -11,6 +11,7 @@
ArchUtils.py \
BaseConfig.py \
CommonErrors.py \
+ ExecUtils.py \
FileDownloader.py \
HTTPSURLopener.py \
HTTPServer.py \
More information about the fedora-extras-commits
mailing list