summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Savchenko <bircoph@gmail.com>2012-05-23 14:18:10 +0400
committerAndrew Savchenko <bircoph@gmail.com>2012-05-23 14:18:10 +0400
commitf697f3aaf27f402ac9eadb492e376e231f153661 (patch)
treea41ff92e7288eecdd750cae618b2257a1c33662e /sys-devel
parentPreliminary distcc upgrade. (diff)
downloadbircoph-f697f3aaf27f402ac9eadb492e376e231f153661.tar.gz
bircoph-f697f3aaf27f402ac9eadb492e376e231f153661.tar.bz2
bircoph-f697f3aaf27f402ac9eadb492e376e231f153661.zip
distcc: add missing file
Diffstat (limited to 'sys-devel')
-rw-r--r--sys-devel/distcc/Manifest1
-rw-r--r--sys-devel/distcc/files/distcc-config-3.2_rc1181
2 files changed, 182 insertions, 0 deletions
diff --git a/sys-devel/distcc/Manifest b/sys-devel/distcc/Manifest
index e892988..dd937ee 100644
--- a/sys-devel/distcc/Manifest
+++ b/sys-devel/distcc/Manifest
@@ -10,6 +10,7 @@ AUX distcc-3.2_rc1-crosscompile.patch 5029 RMD160 3b763c1b81390bd4565b50ec9426e3
AUX distcc-3.2_rc1-freedesktop.patch 3140 RMD160 7402c835493978e3a2e4b338bf783f1958f7694b SHA1 b117588006f1b3d6de3bb7034f0fa303c1957f1d SHA256 7ead1174fc170cee5c32ac183edf0c15ae35df56bedbbf6bc24c0099fe23b7f6
AUX distcc-3.2_rc1-gssapi.patch 1638 RMD160 88adbe60a6818075a7153ed99a638cb46418c86c SHA1 a911bdef83ca0d17dcbc7121e4dc71987c5fb6ce SHA256 2693fbf5b76ab64874e0a4bc1540067f402799dfabde5202a89ec045f1d88ea0
AUX distcc-3.2_rc1-python.patch 10592 RMD160 fd8af66d2470fd9a6823765fafd726d5a8a3b64c SHA1 21dba21ddd532c74f8ba337555bcb352b30c02be SHA256 935328943efe26f20bfb94952bc8bcb7f8536465db72411d81e6f3d1ade37989
+AUX distcc-config-3.2_rc1 5332 RMD160 5a51782d1dcff1fdb8af3deed6574869dbf36bd0 SHA1 5cc91a745b324a20230635685f5a670825f5a086 SHA256 b825a21dc43afe71f9c14697bd7070a3a6798a6b6089084bd6b26e0c4ea7c167
AUX distcc-hardened.patch 1084 RMD160 0f11c9c8e8b56e91399b054fb57566e290a0baa5 SHA1 746f1905a9bc45ea7b71d71f4b1feba7d96d0f7f SHA256 dcf63f201cb7f4bf13eeb1485a5056c64370b9239d28e4acc77a47046dcda6cf
DIST distcc-3.1.tar.bz2 588820 RMD160 82229c230e6917b0df7db275460579b02dbf6b60 SHA1 30663e8ff94f13c0553fbfb928adba91814e1b3a SHA256 f55dbafd76bed3ce57e1bbcdab1329227808890d90f4c724fcd2d53f934ddd89
DIST distcc-3.2rc1.tar.bz2 609904 RMD160 505447b910d90ea403a98fe0d0a3a0fa92cd7039 SHA1 7564e4a4890ad6ff78ec0de620329b71179361e7 SHA256 311671e844625d7fdb18dd3d096cd855751cfe8de13827682bcb7beff9133b30
diff --git a/sys-devel/distcc/files/distcc-config-3.2_rc1 b/sys-devel/distcc/files/distcc-config-3.2_rc1
new file mode 100644
index 0000000..6d13810
--- /dev/null
+++ b/sys-devel/distcc/files/distcc-config-3.2_rc1
@@ -0,0 +1,181 @@
+#!/usr/bin/env python2
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-devel/distcc/files/distcc-config-3.2_rc1,v 1.1 2011/10/28 05:41:06 matsuu Exp $
+
+import os, re, signal, subprocess, sys
+
+options=[
+ '--get-hosts',
+ '--set-hosts',
+ '--get-verbose',
+ '--set-verbose',
+ '--get-log',
+ '--set-log',
+ '--update-masquerade',
+ '--update-masquerade-with-crossdev',
+ '--help',
+ '--get-env',
+ '--set-env'
+]
+
+tmpcmdline=sys.argv[1:]
+cmdline=[]
+
+eprefix = '@EPREFIX@'
+bindir = os.path.join(eprefix, 'usr', 'bin')
+sbindir = os.path.join(eprefix, 'usr', 'sbin')
+libdir = os.path.join(eprefix, '@libdir@')
+sysconfdir = os.path.join(eprefix, 'etc')
+
+gcc_config = os.path.join(bindir, 'gcc-config')
+env_update = os.path.join(sbindir, 'env-update')
+envfile = os.path.join(sysconfdir, 'env.d', '02distcc')
+default_distcc_dir = os.path.join(sysconfdir, 'distcc')
+hostfile = os.path.join(default_distcc_dir, 'hosts')
+distcc_path = os.path.join(bindir, 'distcc')
+dccc_dir = os.path.join(libdir, 'distcc', 'bin')
+
+def exithandler(foo,bar):
+ os.kill(0,signal.SIGKILL)
+ sys.exit(1)
+
+signal.signal(signal.SIGINT,exithandler)
+
+def isroot(ret=0):
+ if os.getuid() != 0:
+ if ret == 0:
+ print('!!! %s %s must be run as root' % (sys.argv[:1][0],tmpcmdline[0]))
+ sys.exit(1)
+ else:
+ retval = 0
+ else:
+ retval = 1
+ return retval
+
+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 %s to: %s ' % (var,value))
+ subprocess.Popen(env_update, shell=True)
+ 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()
+ match = re.compile(var+'="(.*)"').search(distcc_env)
+ if match:
+ print(var+'='+match.group(1))
+ else:
+ print(var,'not set.')
+
+def installlink(chost='', version=''):
+ for file in ['gcc', 'cc', 'c++', 'g++']:
+ if not chost == '':
+ file = '%s-%s' % (chost,file)
+ if not version == '':
+ file = '%s-%s' % (file,version)
+ path = os.path.join(dccc_dir,file)
+ if os.path.exists(os.path.join(bindir,file)):
+ if not os.path.exists(path):
+ print('Creating %s symlink...' % (path))
+ os.symlink(distcc_path,path)
+ #else:
+ # print('Already exists. Skipping...')
+
+def installlinks():
+ p = subprocess.Popen([gcc_config+" -C -l"], shell=True, stdout=subprocess.PIPE)
+ lines = p.stdout.read().rstrip().split('\n')
+ for line in lines:
+ columns = line.split()
+ if len(columns) >= 2:
+ matches = re.match("(.*)-(.*)", columns[1])
+ chost = matches.group(1)
+ version = matches.group(2)
+ installlink(chost)
+ installlink(chost, version)
+
+def uninstalllinks():
+ for root, dirs, files in os.walk(dccc_dir):
+ for file in files:
+ os.remove(os.path.join(root, file))
+
+def createdistccdir(dir):
+ if not os.path.exists(dir):
+ os.mkdir(dir)
+ os.chmod(dir, 0o755)
+
+for x in tmpcmdline:
+ if not x:
+ continue
+ if x[0:2]=="--":
+ if not x in options:
+ print("!!! Error: %s is an invalid option." % (x))
+ sys.exit(1)
+ else:
+ cmdline = x
+
+if '--get-hosts' in tmpcmdline:
+ HOSTS_ENV = os.environ.get('DISTCC_HOSTS')
+ HOSTS_HOME = os.path.join(os.environ.get('HOME'), '.distcc', 'hosts')
+ if HOSTS_ENV:
+ print(HOSTS_ENV)
+ elif os.path.isfile(HOSTS_HOME) and os.path.getsize(HOSTS_HOME) != 0:
+ print(HOSTS_HOME)
+ elif os.path.exists(hostfile):
+ print(open(hostfile, 'r').read().rstrip())
+ else:
+ print('No configuration file found. Setup your hosts with --set-hosts.')
+elif '--set-hosts' in tmpcmdline:
+ if isroot(1):
+ PATH = default_distcc_dir
+ else:
+ PATH = os.path.join(os.environ.get('HOME'), '.distcc')
+ createdistccdir(PATH)
+ open(os.path.join(PATH, 'hosts'), 'w').write(cmdline + '\n')
+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 '--update-masquerade' in tmpcmdline:
+ isroot()
+ uninstalllinks()
+ print('Creating symlinks...')
+ installlink()
+ installlinks()
+elif '--update-masquerade-with-crossdev' in tmpcmdline:
+ isroot()
+ uninstalllinks()
+ print('Creating symlinks...')
+ installlinks()
+elif '--get-env' in tmpcmdline:
+ if len(tmpcmdline) == 1:
+ print(open(envfile, 'r').read().rstrip())
+ elif len(tmpcmdline) == 2:
+ readenv(tmpcmdline[1])
+ else:
+ print('!!! Error: Specify only one variable.')
+elif '--set-env' in tmpcmdline:
+ if len(tmpcmdline) > 2 and len(tmpcmdline) <= 3:
+ isroot()
+ writeenv(tmpcmdline[1],tmpcmdline[2])
+ else:
+ print('!!! Error: Awaiting two parameters.')
+else:
+ cmd = sys.argv[:1][0]
+ print('Usage: %s --set-hosts DISTCC_HOSTS | --get-hosts' % (cmd))
+ print(' %s --set-verbose { 0 | 1 } | --get-verbose' % (cmd))
+ print(' %s --set-log FILE | --get-log' % (cmd))
+ print(' %s --set-env VARIABLE VALUE | --get-env [VARIABLE]' % (cmd))
+ print(' %s --update-masquerade' % (cmd))
+ print(' %s --update-masquerade-with-crossdev' % (cmd))