initial release :)
Created attachment 16695 [details] python rewrite
Hi yall, please test this. :)
distcc-config when invoked w/o options should list the available option as --help does, as distcc-config w/o options has no use
Created attachment 16792 [details] python rewrite thanks, included.
--get-hosts and --set-hosts should not print anything ("such and such is..."). DISTCC_DIR would be great if it could be a global constant so its a bit easier to change. If DISTCC_DIR does not exist it must be created with 1777 perms, owned by root (in the functions --set-env and --install and whatever.) The config needs a --set-env command: --set-env FOO VALUE will update /etc/env.d/02_distcc to include FOO=VALUE. It also needs a Gentoo header. :)
Created attachment 17490 [details, diff] Make /etc/distcc/hosts newline terminated. Enhanced Usage. The patch though small was tested with emerge.
I've tried it out, and I found a few things, perhaps because I am using distcc for first time, so had no expectations about how it would work. These are my impressions :) The patch is to address points 1) & 4) only. By the way, it has set me up, which is the main thing, and though I've a few points, that's inevitable once I had to tinkering with the source. Let me know if you'ld like further submissions, addressing issues I've pointed out (yes, even the dreaded documentation). 1) The --install option seems necessary, and it's not in Usage 2) Documentation Guide http://www.gentoo.org/doc/en/distcc.xml I found I needed to look at the script source to figure out how to use it. a) I set the hosts, got the print message and nothing happened. Looks like --install is necessary. There wasn't a file made if I --set-hosts. The section on bootstrapping with distcc does have a mention of --install. b) Server side; the guide should explain that distccd needs to be set up, minimum reminder about /etc/{conf,init}.d/distc, and hint about adding distcdd to runlevel. c) Quote terminator missing? Code listing 2.3: Sample command to set the hosts # /usr/bin/distcc-config --set-hosts "192.168.0.1 192.168.0.2 192.168.0.3 d) No mention of log file 3) Using the --set-verbose 1 option to see what going on I got : oak gentoo # python distcc-config.py --set-verbose 1 --install Traceback (most recent call last): File "distcc-config.py", line 88, in ? writeenv('DISTCC_VERBOSE',tmpcmdline[1]) File "distcc-config.py", line 37, in writeenv distcc_env = open(envfile, 'r').readlines() IOError: [Errno 2] No such file or directory: '/etc/env.d/02distcc' oak gentoo # python distcc-config.py --install Creating /etc/env.d/02distcc ... Looks like account should be taken that /etc/env.d/02distcc may not exist. 4) /etc/distcc/hosts It's entry is written without a \n line terminator, this confused my vi editor (nvi), unlike nano it didn't display anything, which seems to add termination to last line if missing. 5) On the interface design. I'm not sure why it's necesary to make options mutually exclusive. For example it ought to be perfectly reasonable to : distcc-config --install --set-hosts "127.0.0.2/4 10.0.0.1/2 10.0.0.2/2" As it is, the user has to run distcc-config multiple times, and understand that it's actually creating various environment files. If fact, why doesn't --set-hosts implicitly do a --install, if stuff is missing? It's what the user wants to do! Perhaps distcc-config --install host1 host2/2 .. hostN, then you can have a sensible default for : distcc-config 10.0.0.9/4 10.0.0.8/2 10.0.0.7/2 Wouldn't that be the most common usage? Most users won't change the log file, or verbosity, and not providing short flag alternatives adds error prone typing. Standard kind of pattern for option processing flags and values is : Initalise option map to set defaults. loop through command line switches validate option If flag option set options{ current } on else get option value set options{ current } to option value Do processing modified by flags, for example are we listing or setting things? In C and perl there's access to standard modules getopt_long for arg processing which does help a fair bit. I've just checked Programming Python, doesn't talk about it, but presumably there's some binding to get access to getopt_long(3) in glibc. The getopt_long() function works like getopt() except that it also accepts long options, started out by two dashes. Long option names may be abbreviated if the abbreviation is unique or is an exact match for some defined option. A long option may take a parameter, of the form --arg=param or --arg param.
Created attachment 18006 [details] python rewrite Issues of comment #5 fixed. Added the new line character and fixed the 'usage' to uppercase as in the patch of comment #6.
--install runs once to setup the initial distcc environment. it's called from the distcc ebuild. All problems are related to the fact, that it wasn't called, because the current distcc-config script handles the installation in several subroutines.
if the user is not root, --set-hosts should set ~/.distcc/hosts further for --get-hosts, if $DISTCC_HOSTS is not null, return that, else ~/.distcc/hosts is not empty, return contents, else return contents of /etc/distcc/hosts
Created attachment 18852 [details] python rewrite your wish is my command.
Reminder: Restart daemon after upgrade.
Also, DISTCC_DIR should be removed from the /etc/env.d/02distcc file. distcc_env.write('DISTCC_DIR="/tmp"\n') createdistccdir('/tmp') can be removed I also got this Traceback error when using the distcc-config in atttachment 18852 : (Use an unmodified 2.11 ebuild with this distcc-config) Traceback (most recent call last): File "/usr/bin/distcc-config", line 111, in ? open(FILE, 'w').write(cmdline + '\n') TypeError: can only concatenate list (not "str") to list Furthermore, with a modified ebuild to just run --install this is the output: Traceback (most recent call last): File "/usr/bin/distcc-config", line 111, in ? open(FILE, 'w').write(cmdline + '\n') TypeError: can only concatenate list (not "str") to list * Installing links to native compilers... Creating /etc/env.d/02distcc ... Creating /usr/lib/distcc/bin/gcc symlink... Already exists. Skipping... Creating /usr/lib/distcc/bin/cc symlink... Already exists. Skipping... Creating /usr/lib/distcc/bin/c++ symlink... Already exists. Skipping... Creating /usr/lib/distcc/bin/g++ symlink... Already exists. Skipping... Creating /usr/lib/distcc/bin/i586-pc-linux-gnu-gcc symlink... Already exists. Skipping... Creating /usr/lib/distcc/bin/i586-pc-linux-gnu-c++ symlink... Already exists. Skipping... Creating /usr/lib/distcc/bin/i586-pc-linux-gnu-g++ symlink... Already exists. Skipping... Configuring /usr/lib/distcc/bin/.keep... Configuring /usr/lib/distcc/bin/gcc... Configuring /usr/lib/distcc/bin/cc... Configuring /usr/lib/distcc/bin/c++... Configuring /usr/lib/distcc/bin/g++... Configuring /usr/lib/distcc/bin/i686-pc-linux-gnu-gcc... Configuring /usr/lib/distcc/bin/i686-pc-linux-gnu-c++... Configuring /usr/lib/distcc/bin/i686-pc-linux-gnu-g++... Configuring /usr/lib/distcc/bin/i586-pc-linux-gnu-gcc... Configuring /usr/lib/distcc/bin/i586-pc-linux-gnu-c++... Configuring /usr/lib/distcc/bin/i586-pc-linux-gnu-g++... Configuring /var/run/distccd/.keep... --- Can the output be silenced a bit? And what's it doing to /var/run/distccd/.keep?
Also, DISTCC_LOG should not be set to anything by default.
Created attachment 19348 [details] python rewrite fixed everything and added restart of distccd after call of --install. :)
Committed in CVS as distcc-2.11.1-r1, its in package.mask, so you will have to force it: emerge /usr/portage/sys-devel/distcc/distcc-2.11.1-r1.ebuild
Have been testing here for the last 36 hours or so with compiles of a couple of small apps, then kdelibs & glibc on different machines. Seem to work fine.
Just a formal reminder to create /etc/distcc or ~/.distcc if they aren't present.
reopened waiting a fix for comment 18 :-)
I'm having a problem with the distccd init script not creating a pid file. I did: emerge =distcc-2.11.2 /sbin/depscan.sh # told me to do so at the end of emerge, for some reason nano -w /etc/make.conf # added -jX to MAKEOPTS, added distcc to FEATURES /usr/sbin/distcc-config --set-hosts "xxx.xxx.xxx.xxx ..." /etc/init.d/distccd start # appears to work but doesn't create pidfile /etc/init.d/distccd stop # "succeeds" but doesn't stop processes /etc/init.d/distccd start # fails Manually creating the pidfile containing the correct value and it all works...
argh, links -g has retarded key bindings of some sort. My carriage returns were destroyed. :|
worked. marked stable in x86
this is in as distcc-2.11.2-r1 thanks a lot Markus and testers.
I have some additional comments about distcc-config. I'm only using distcc with portage. After I've emerged distcc, if I do (as root) distcc-config --get-hosts or distcc-config --set-hosts "10.0.0.2", I get errors. The error for --get-hosts looks sorta like this: Traceback (...): blahblah... print rstrip(open('/etc/distcc/hosts', 'r').read()) blahblah no such file or directory The message I get with --set-hosts is similar (although I don't think I saw a filename in that error message). At this time the /etc/distcc directory does not exist. If I create this directory and try again, only --get-hosts still fails (because the hosts file doesn't exist). Once I've --set-hosts, also --get-hosts succeeds. I think the script needs some additional checks. # $Header: /home/cvsroot/gentoo-x86/sys-devel/distcc/files/2.11.1p/distcc-config,v 1.3 2003/12/06 17:31:04 lisa Exp $ How to reproduce (probably): 1) remove or rename /etc/distcc 2) run distcc-config --get-hosts or distcc-config --set-hosts "10.0.0.2" 3) mkdir /etc/distcc 4) run distcc-config --get-hosts
Markus?
nice catch. fixed it in cvs.
Nother bug. Running distcc-config --install with no distcc user in the /etc/passwd (such as during bootstrap) results in: Creating /etc/env.d/02.distcc... Traceback... File "/usr/bin/distcc-config", line 134, in ? foobar = getpwnam('distcc') KeyError: getpwnam(): name not found
Another bug: # distcc-config --set-hosts " .... " Traceback... File /usr/bin/distcc-config, line 153, in ? createdistccidr(PATH) File /usr/bin/distcc-config, line 85, in createdistccdir os.chmod(dir, '1777') TypeError: an integer is required This is on a bootstrap, with a virgin make.conf aside from FEATURES, MAKEOPTS, and USE changes. /etc/distcc/ exists. after this dir is created /var/tmp/portage/.distcc does not.
lisa, what distcc-config cvs revision were you using at comment #28? I just fixed this 7 days ago. the one in comment #27.. well we should consider an additional flag for bootstrapping or something. isn't --install called while using the distcc ebuild from bootstrap? i actually hadn't the time to test the script while bootstrapping. .. i'll catch you on irc.
> lisa, what distcc-config cvs revision were you using at comment #28? > I just fixed this 7 days ago. But it is still in Portage tree fetched via rsync, today.
Here's an obscure bug. If /etc/distcc does not exist, then invoking: distcc-config --set-hosts "hostname>/<num jobs>" will trigger a python traceback ONLY once. Any further invocations works fine. [root@minas-tirith distfiles]# distcc-config --set-hosts "isengard/4" Traceback (most recent call last): File "/usr/bin/distcc-config", line 113, in ? createdistccdir(PATH) File "/usr/bin/distcc-config", line 85, in createdistccdir os.chmod(dir, '1777') TypeError: an integer is required [root@minas-tirith distfiles]# distcc-config --set-hosts "isengard/4" [root@minas-tirith distfiles]# [root@minas-tirith distfiles]# rm -Rf /etc/distcc [root@minas-tirith distfiles]# distcc-config --set-hosts "isengard/4" Traceback (most recent call last): File "/usr/bin/distcc-config", line 113, in ? createdistccdir(PATH) File "/usr/bin/distcc-config", line 85, in createdistccdir os.chmod(dir, '1777') TypeError: an integer is required [root@minas-tirith distfiles]# Using a straight IP address instead of the histname during the first call doesn't trigger the bug either.
verfied fixed.
*** Bug 36504 has been marked as a duplicate of this bug. ***
all issues should be fixed.
All issues with the Python rewrite of distcc-config should be filed in a new bug.