Tony Breeds wrote:
On Wed, Oct 24, 2007 at 12:03:03PM +1000, Tony Breeds wrote:
The debian package includes a bunch of symlinks (I've sumbitted a bug
asking that they're removed) for various compilers which point to
ccontrol which leads to the following unexpected behaviour.

Hmm actually this patch is broken. I'll work out a better fix....

How about this patch? The ccontrol config file can contain things like
  cc = /usr/bin

If invoked as gcc-4.2 it will execute /usr/bin/gcc-4.2, etc.

--
\0
Nur in ccontrol-0.9.1+20060806-new: build-stamp.
Nur in ccontrol-0.9.1+20060806-new: ccontrol.
Nur in ccontrol-0.9.1+20060806-new: ccontrol.1.
diff -ru ccontrol-0.9.1+20060806/ccontrol.1.txt ccontrol-0.9.1+20060806-new/ccontrol.1.txt
--- ccontrol-0.9.1+20060806/ccontrol.1.txt	2006-08-06 14:19:40.000000000 +1000
+++ ccontrol-0.9.1+20060806-new/ccontrol.1.txt	2007-11-04 13:10:53.000000000 +1000
@@ -74,37 +74,38 @@
 will end in a "*" to include all subdirectories.
 
 All paths beginning with "~" are relative to the user's home
-directory.
+directory. A path may be specified as a directory, in which case
+ccontrol will append the program name to the directory.
 
 The following settings are available:
 
 cc::
-  Followed by '=' specifies the full path of the compiler to be
+  Followed by '=' specifies the path of the compiler to be
   invoked when ccontrol is invoked as "cc" or "gcc".  ccontrol will
   fail to compile C programs if this is not set.
 
 c++::
-  Followed by '=' specifies the full path of the compiler to be
+  Followed by '=' specifies the path of the compiler to be
   invoked when ccontrol is invoked as "c++" or "g++".  ccontrol will
   fail to compile C++ programs if this is not set.
 
 ld::
-  Followed by '=' specifies the full path of the linker to be invoked
+  Followed by '=' specifies the path of the linker to be invoked
   when ccontrol is invoked as "ld".  ccontrol will fail to link
   programs if this is not set.
 
 make::
-  Followed by '=' specifies the full path of the binary to be invoked
+  Followed by '=' specifies the path of the binary to be invoked
   when ccontrol is invoked as "make".  ccontrol will fail to make if
   this is not set.
 
 ccache::
-  Followed by '=' specifies the full path of "ccache", and indicates
+  Followed by '=' specifies the path of "ccache", and indicates
   that ccache is to be used where appropriate.  If followed by
   'disable', or not set, ccache will not be used.
 
 distcc::
-  Followed by '=' specifies the full path of "distcc", and indicates
+  Followed by '=' specifies the path of "distcc", and indicates
   that distcc is to be used where appropriate.  If followed by
   'disable', or not set, or distcc-hosts is not set, distcc will not
   be used.
diff -ru ccontrol-0.9.1+20060806/ccontrol.c ccontrol-0.9.1+20060806-new/ccontrol.c
--- ccontrol-0.9.1+20060806/ccontrol.c	2006-08-06 14:19:40.000000000 +1000
+++ ccontrol-0.9.1+20060806-new/ccontrol.c	2007-11-04 13:22:54.000000000 +1000
@@ -330,6 +330,19 @@
 
 	/* This handles open failure if fd < 0. */
 	sec = read_config(configname, dirname, fd);
+
+    /* If the config file says this app is a directory, it means
+     * that the command can be found _in_ that directory.
+     * (Only doing this for absolute path names). */
+    if (sec.names[type][0] == '/'
+            && stat(sec.names[type], &st) == 0
+            && S_ISDIR(st.st_mode)) {
+        sec.names[type] = realloc_array(sec.names[type],
+                strlen(sec.names[type]) + strlen(argv[0]) + 2);
+        strcat(sec.names[type], "/");
+        strcat(sec.names[type], argv[0]);
+    }
+
 	fstat(fd, &st);
 
 	/* Run low priority; people like to use apps while compiling. */
diff -ru ccontrol-0.9.1+20060806/ccontrol-init ccontrol-0.9.1+20060806-new/ccontrol-init
--- ccontrol-0.9.1+20060806/ccontrol-init	2007-11-04 12:58:10.000000000 +1000
+++ ccontrol-0.9.1+20060806-new/ccontrol-init	2007-11-04 13:33:59.000000000 +1000
@@ -24,7 +24,7 @@
     else
 	echo Found "$ANS" >&2
     fi
-    echo $ANS
+    echo `dirname $ANS`
 }
 
 test_net()
Nur in ccontrol-0.9.1+20060806-new: ccontrol-init.1.
Nur in ccontrol-0.9.1+20060806-new: ccontrol_test.
Nur in ccontrol-0.9.1+20060806-new: config.status.
Nur in ccontrol-0.9.1+20060806-new/debian: ccontrol.
Nur in ccontrol-0.9.1+20060806-new/debian: ccontrol.substvars.
Nur in ccontrol-0.9.1+20060806-new/debian: files.
Nur in ccontrol-0.9.1+20060806-new/gui: gccontrol.
Nur in ccontrol-0.9.1+20060806-new/gui: gccontrol.1.
Nur in ccontrol-0.9.1+20060806-new: Makefile.
Nur in ccontrol-0.9.1+20060806-new: tags.
Nur in ccontrol-0.9.1+20060806-new/testsuite: 10ccontrol-invoke.test.
Nur in ccontrol-0.9.1+20060806-new/testsuite: 10ccontrol-invoke-V.test.

Reply via email to