freebsd-ports/Tools/portbuild/scripts/buildproxy-client
2009-05-21 16:17:15 +00:00

42 lines
911 B
Python
Executable file

#!/usr/bin/env python
#
# Client for communicating proxy requests to the buildproxy
import sys, socket, os, commands
from freebsd import *
SOCKET='/tmp/.build'
try:
s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
s.connect(SOCKET)
sockfile = s.makefile()
sockfile.write("%s\n" % " ".join(sys.argv[1:]))
sockfile.flush()
code = sockfile.readline().strip()
out = "".join(sockfile.readlines())
if out:
print out
sockfile.close()
s.close()
sys.exit(int(code))
except Exception, e:
print "buildproxy-client: exception:"
print e
try:
if code == None:
print "buildproxy-client: error: code was None"
else:
print "buildproxy-client: error: code was '" + code + "'"
except Exception, e2:
print "buildproxy-client: exception 2:"
print e2
raise e # XXX debug
sys.exit(254)