Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 16792 Details for
Bug 27432
python rewrite of distcc-config
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
python rewrite
distcc-config (text/plain), 3.47 KB, created by
Markus Nigbur (RETIRED)
on 2003-08-29 20:38:14 UTC
(
hide
)
Description:
python rewrite
Filename:
MIME Type:
Creator:
Markus Nigbur (RETIRED)
Created:
2003-08-29 20:38:14 UTC
Size:
3.47 KB
patch
obsolete
>#!/usr/bin/env python ># Author Info: pYrania <pYrania@c0ffeine.de> > >import os, re, signal, sys, commands, pwd, socket > >options=[ > '--get-hosts', > '--set-hosts', > '--get-verbose', > '--set-verbose', > '--get-log', > '--set-log', > '--install', > '--help', >] > >tmpcmdline=sys.argv[1:] >cmdline=[] >envfile = '/etc/env.d/02distcc' > >def exithandler(foo,bar): > os.kill(0,signal.SIGKILL) > sys.exit(1) > >signal.signal(signal.SIGINT,exithandler) > >def isroot(): > if os.getuid() != 0: > print '!!!',sys.argv[:1][0],tmpcmdline[0],'must be run as root' > sys.exit(1) > >def writeenv(var,value): > isroot() > distcc_env = [] > distcc_env = open(envfile, 'r').readlines() > distcc_env_new = open(envfile, 'w') > for i in range(len(distcc_env)): > if re.compile(var+'="(.*)"').match(distcc_env[i]): > distcc_env[i] = var+'="'+value+'"\n' > distcc_env_new.write(distcc_env[i]) > print 'Set',var,'to:',value > os.popen('/usr/sbin/env-update') > print 'If you want to use these new settings in an existing shell,' > print 'you need to "source /etc/profile" to get the changes.' > >def readenv(var): > distcc_env = open(envfile, 'r').read() > print var+'='+re.compile(var+'="(.*)"').search(distcc_env).group(1) > >def permissions(path,user,group): > for file in os.listdir(path): > print 'Configuring',path+file+'...' > os.chown(path+file,user,group) > >def installlinks(chost=''): > for file in ['gcc', 'cc', 'c++', 'g++']: > path = '/usr/lib/distcc/bin/' > if not chost == '': > file = chost+'-'+file > if os.path.exists('/usr/bin/'+file): > print 'Creating',path+file,'symlink...' > if not os.path.exists(path+file): > os.symlink('/usr/bin/distcc',path+file) > else: > print 'Already exists. Skipping...' > >for x in tmpcmdline: > if not x: > continue > if x[0:2]=="--": > if not x in options: > print "!!! Error:",x,"is an invalid option." > sys.exit(1) > else: > cmdline = x > >if '--get-hosts' in tmpcmdline: > print 'Current DISTCC_HOSTS:',open('/etc/distcc/hosts', 'r').read() >elif '--set-hosts' in tmpcmdline: > isroot() > open('/etc/distcc/hosts', 'w').write(cmdline) > print 'Set DISTCC_HOSTS to:',cmdline >elif '--get-verbose' in tmpcmdline: > readenv('DISTCC_VERBOSE') >elif '--set-verbose' in tmpcmdline: > writeenv('DISTCC_VERBOSE',tmpcmdline[1]) >elif '--get-log' in tmpcmdline: > readenv('DISTCC_LOG') >elif '--set-log' in tmpcmdline: > writeenv('DISTCC_LOG',tmpcmdline[1]) >elif '--install' in tmpcmdline: > isroot() > print 'Creating',envfile,'...' > distcc_env = open(envfile, 'w') > distcc_env.write('# This file is managed by distcc-config; use it to change these settings.\n') > distcc_env.write('DISTCC_LOG="/var/log/distcc.log"\n') > distcc_env.write('DCCC_PATH="/usr/lib/distcc/bin"\n') > distcc_env.write('DISTCC_VERBOSE="0"\n') > distcc_env.write('DISTCC_DIR="/tmp"\n') > > if os.WEXITSTATUS(commands.getstatusoutput('/usr/sbin/useradd -g daemon -s /bin/false -d /dev/null -c "distccd" distcc')[0]) == 9: > os.WEXITSTATUS(commands.getstatusoutput('/usr/sbin/usermod -g daemon -s /bin/false -d /dev/null -c "distccd" distcc')[0]) > > foobar = pwd.getpwnam('distcc') > user = foobar[2] > group = foobar[3] > > makeconf = open('/etc/make.conf', 'r').read() > chost = re.compile('CHOST="(.*)"').search(makeconf).group(1) > installlinks() > installlinks(chost) > > permissions('/usr/lib/distcc/bin/',user,group) > permissions('/var/run/distccd/',user,group) > >else: > print 'usage: /usr/bin/distcc-config --set-hosts DISTCC_HOSTS | --get-hosts' > print ' /usr/bin/distcc-config --set-verbose { 0 | 1 } | --get-verbose' > print ' /usr/bin/distcc-config --set-log FILE | --get-log'
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 27432
:
16695
|
16792
|
17490
|
18006
|
18852
|
19348