1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-01 01:17:02 +00:00

Generalize the packge building scripts to be able to be run on more than

one 'head' node, rather than just pointyhat itself.

Constants are factored out into installation-specific files known as
portbuild/conf/server.conf and portbuild/conf/client.conf.  There is
only one server.conf file.  Individual <arch> directories may have
their own client.conf files, or may symlink to ../conf/client.conf.

While here, do some cleanup.

Feature safe:	yes
This commit is contained in:
Mark Linimon 2010-06-25 23:02:09 +00:00
parent 75fda7ac40
commit 381f8cb94b
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=256979
2 changed files with 22 additions and 10 deletions

View File

@ -1,4 +1,5 @@
#!/usr/bin/env python #!/usr/bin/env python
# $FreeBSD$
# #
# Allow access to privileged build commands to ports-* users for # Allow access to privileged build commands to ports-* users for
# managing their own build spaces. # managing their own build spaces.
@ -6,8 +7,11 @@
import sys, socket, os, commands import sys, socket, os, commands
from freebsd import * from freebsd import *
from freebsd_config import *
SOCKET='/tmp/.build' CONFIG_DIR="/var/portbuild"
CONFIG_SUBDIR="conf"
CONFIG_FILENAME="server.conf"
valid_cmds = ['create', 'clone', 'portsupdate', 'srcupdate', 'destroy'] valid_cmds = ['create', 'clone', 'portsupdate', 'srcupdate', 'destroy']
@ -46,12 +50,15 @@ def process(cmd, sockfile):
return (status, out) return (status, out)
if os.path.exists(SOCKET): config = getConfig( CONFIG_DIR, CONFIG_SUBDIR, CONFIG_FILENAME )
os.unlink(SOCKET) BUILDPROXY_SOCKET_FILE = config.get( 'BUILDPROXY_SOCKET_FILE' )
if os.path.exists(BUILDPROXY_SOCKET_FILE):
os.unlink(BUILDPROXY_SOCKET_FILE)
s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
s.bind(SOCKET) s.bind(BUILDPROXY_SOCKET_FILE)
os.chmod(SOCKET, 0660) os.chmod(BUILDPROXY_SOCKET_FILE, 0660)
os.chown(SOCKET, -1, getgidbyname('portmgr')) os.chown(BUILDPROXY_SOCKET_FILE, -1, getgidbyname('portmgr'))
s.listen(10) s.listen(10)

View File

@ -1,16 +1,23 @@
#!/usr/bin/env python #!/usr/bin/env python
# $FreeBSD$
# #
# Client for communicating proxy requests to the buildproxy # Client for communicating proxy requests to the buildproxy
import sys, socket, os, commands import sys, socket, os, commands
from freebsd import * from freebsd import *
from freebsd_config import *
SOCKET='/tmp/.build' CONFIG_DIR="/var/portbuild"
CONFIG_SUBDIR="conf"
CONFIG_FILENAME="server.conf"
config = getConfig( CONFIG_DIR, CONFIG_SUBDIR, CONFIG_FILENAME )
BUILDPROXY_SOCKET_FILE = config.get( 'BUILDPROXY_SOCKET_FILE' )
try: try:
s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
s.connect(SOCKET) s.connect(BUILDPROXY_SOCKET_FILE)
sockfile = s.makefile() sockfile = s.makefile()
sockfile.write("%s\n" % " ".join(sys.argv[1:])) sockfile.write("%s\n" % " ".join(sys.argv[1:]))
@ -38,5 +45,3 @@ except Exception, e:
print e2 print e2
raise e # XXX debug raise e # XXX debug
sys.exit(254) sys.exit(254)