Author: adam-guest
Date: 2008-03-23 18:44:16 +0000 (Sun, 23 Mar 2008)
New Revision: 1183

Modified:
   trunk/debian/changelog
   trunk/scripts/debuild.1
   trunk/scripts/debuild.pl
Log:
debuild: Add a --prepend-path option allowing $PATH to have directories
added to it once it has been sanitised, for example to add /usr/lib/ccache.
Based on a patch by Matt T. Proud (Closes: #460719)

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog      2008-03-23 13:46:03 UTC (rev 1182)
+++ trunk/debian/changelog      2008-03-23 18:44:16 UTC (rev 1183)
@@ -32,6 +32,9 @@
     + Strip single change commit messages by default
   * debdiff: Escape package names when normalising path names
     (Closes: #471282)
+  * debuild: Add a --prepend-path option allowing $PATH to have directories
+    added to it once it has been sanitised, for example to add /usr/lib/ccache.
+    Based on a patch by Matt T. Proud (Closes: #460719)
   * uscan: Correctly handle an explicit upstream-version of 0
     (Closes: #471503)
 

Modified: trunk/scripts/debuild.1
===================================================================
--- trunk/scripts/debuild.1     2008-03-23 13:46:03 UTC (rev 1182)
+++ trunk/scripts/debuild.1     2008-03-23 18:44:16 UTC (rev 1183)
@@ -102,6 +102,10 @@
 programs from non-standard locations can easily result in the package
 being broken, as it will not be able to be built on standard systems.
 .PP
+Note that one may add directories to the beginning of the sanitised
+PATH, using the \fB\-\-prepend\-path\fR option. This is useful when
+one wishes to use tools such as ccache or distcc for building.
+.PP
 It is also possible to avoid having to type something like
 \fIFOO\fB=\fIbar \fBdebuild \-e \fIFOO\fR by writing \fBdebuild \-e
 \fIFOO\fB=\fIbar\fR or the long form \fBdebuild \-\-set\-envvar
@@ -229,6 +233,10 @@
 Set the environment variable \fIvar\fR to \fIvalue\fR and do not
 remove it from the environment.
 .TP
+.BI \-\-prepend\-path= "value "
+Once the normalized PATH has been set, prepend \fIvalue\fR
+to it.
+.TP
 .B \-\-lintian
 Run \fBlintian\fR after \fBdpkg-buildpackage\fR.  This is the default
 behaviour, and it overrides any configuration file directive to the
@@ -289,6 +297,9 @@
 .BI DEBUILD_SET_ENVVAR_ var = value
 This corresponds to \fB\-\-set\-envvar=\fIvar\fB=\fIvalue\fR.
 .TP
+.B DEBUILD_PREPEND_PATH
+This corresponds to \fB\-\-prepend\-path\fR.
+.TP
 .B DEBUILD_ROOTCMD
 Setting this variable to \fIprog\fR is the equivalent of
 \fB\-r\fIprog\fR.

Modified: trunk/scripts/debuild.pl
===================================================================
--- trunk/scripts/debuild.pl    2008-03-23 13:46:03 UTC (rev 1182)
+++ trunk/scripts/debuild.pl    2008-03-23 18:44:16 UTC (rev 1183)
@@ -87,6 +87,8 @@
         --set-envvar=<envvar>=<value>, -e<envvar>=<value>
                                  Set environment variable <envvar> to <value>
 
+        --prepend-path=<value>   Prepend <value> to the sanitised PATH
+
         -d                       Skip checking of build dependencies
         -D                       Force checking of build dependencies (default)
 
@@ -178,6 +180,7 @@
 my $check_dirname_regex = 'PACKAGE(-.*)?';
 my $logging=0;
 my $tgz_check=1;
+my $prepend_path='';
 my @hooks = (qw(dpkg-buildpackage clean dpkg-source build binary final-clean
                lintian signing post-dpkg-buildpackage));
 my %hook;
@@ -243,6 +246,7 @@
                       'DEBUILD_FINAL_CLEAN_HOOK' => '',
                       'DEBUILD_LINTIAN_HOOK' => '',
                       'DEBUILD_SIGNING_HOOK' => '',
+                       'DEBUILD_PREPEND_PATH' => '',
                       'DEBUILD_POST_DPKG_BUILDPACKAGE_HOOK' => '',
                       'DEVSCRIPTS_CHECK_DIRNAME_LEVEL' => 1,
                       'DEVSCRIPTS_CHECK_DIRNAME_REGEX' => 'PACKAGE(-.*)?',
@@ -315,6 +319,7 @@
     $run_lintian = $config_vars{'DEBUILD_LINTIAN'} eq 'no' ? 0 : 1;
     $root_command = $config_vars{'DEBUILD_ROOTCMD'};
     $tgz_check = $config_vars{'DEBUILD_TGZ_CHECK'} eq 'yes' ? 1 : 0;
+    $prepend_path = $config_vars{'DEBUILD_PREPEND_PATH'};
     $check_dirname_level = $config_vars{'DEVSCRIPTS_CHECK_DIRNAME_LEVEL'};
     $check_dirname_regex = $config_vars{'DEVSCRIPTS_CHECK_DIRNAME_REGEX'};
     for my $hookname (@hooks) {
@@ -561,6 +566,7 @@
     $ENV{'PATH'} = $1;
 } else {
     $ENV{'PATH'} = "/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11"
+    $ENV{'PATH'} = join(':', $prepend_path, $ENV{'PATH'}) if $prepend_path;
 }
 $save_vars{'PATH'}=1;
 $ENV{'TERM'}='dumb' unless exists $ENV{'TERM'};



-- 
To unsubscribe, send mail to [EMAIL PROTECTED]

Reply via email to