if one has been specified. Otherwise, if none has been specified,
\fBfakeroot\fP will be used by default, if the command is present.
.I gain-root-command
-should be the name of a program on the
+should start with the name of a program on the
.B PATH
and will get as arguments the name of the real command to run and the
arguments it should take.
.I gain-root-command
-should not contain spaces or any other shell metacharacters.
-.\" what happens, if it contains spaces? (hs)
+can include parameters (they must be space-separated) but no shell
+metacharacters.
.I gain-root-command
might typically be
.BR fakeroot ", " sudo ", " super " or " really .
.B su
-is not suitable, since it requires a
-.B \-c
-option to run a command and even then it can only invoke the user's
-shell with
+is not suitable, since it can only invoke the user's shell with
.B \-c
instead of passing arguments individually to the command to be run.
.TP
+.BI \-R rules-file
+Building a Debian package usually involves invoking
+.B debian/rules
+as a command with several standard parameters. With this option it's
+possible to use another program invocation to build the package (it can
+include space separated parameters).
+Alternatively it can be used to execute the standard rules file with
+another make program (for example by using
+.B /usr/local/bin/make -f debian/rules
+as \fIrules-file\fR).
+.TP
.BI \-p sign-command
When
.B dpkg\-buildpackage
Options:
-r<gain-root-command>
command to gain root privileges (default is fakeroot).
+ -R<rules> rules file to execute (default is debian/rules).
-p<sign-command>
-d do not check build dependencies and conflicts.
-D check build dependencies and conflicts.
"), $progname;
}
-my $rootcommand = '';
+my @debian_rules = ("debian/rules");
+my @rootcommand = ();
my $signcommand = '';
if ( ( ($ENV{GNUPGHOME} && -e $ENV{GNUPGHOME})
|| ($ENV{HOME} && -e "$ENV{HOME}/.gnupg") )
} elsif (/^-j(\d*)$/) {
$parallel = $1 || '-1';
} elsif (/^-r(.*)$/) {
- $rootcommand = $1;
+ @rootcommand = split /\s+/, $1;
} elsif (/^-p(.*)$/) {
$signcommand = $1;
} elsif (/^-k(.*)$/) {
} elsif (/^-E$/) {
$warnable_error = 0;
push @passopts, '-E';
+ } elsif (/^-R(.*)$/) {
+ @debian_rules = split /\s+/, $1;
} else {
usageerr(_g("unknown option or argument %s"), $_);
}
}
if ($< == 0) {
- warning(_g("using a gain-root-command while being root")) if ($rootcommand);
+ warning(_g("using a gain-root-command while being root")) if (@rootcommand);
} else {
- $rootcommand ||= 'fakeroot';
+ push @rootcommand, "fakeroot" unless @rootcommand;
- if (!testcommand($rootcommand)) {
- if ($rootcommand eq 'fakeroot') {
+ if (!testcommand($rootcommand[0])) {
+ if ($rootcommand[0] eq 'fakeroot') {
error(_g("fakeroot not found, either install the fakeroot\n" .
"package, specify a command with the -r option, " .
"or run this as root"));
} else {
- error(_g("gain-root-commmand '%s' not found"), $rootcommand);
+ error(_g("gain-root-commmand '%s' not found"), $rootcommand[0]);
}
}
}
}
unless ($noclean) {
- withecho($rootcommand, 'debian/rules', 'clean');
+ withecho(@rootcommand, @debian_rules, 'clean');
}
unless ($binaryonly) {
chdir('..') or failure('chdir ..');
chdir($dir) or failure("chdir $dir");
}
unless ($sourceonly) {
- withecho('debian/rules', 'build');
- withecho($rootcommand, 'debian/rules', $binarytarget);
+ withecho(@debian_rules, 'build');
+ withecho(@rootcommand, @debian_rules, $binarytarget);
}
if ($usepause &&
($signchanges || ( !$binaryonly && $signsource )) ) {
}
if ($cleansource) {
- withecho($rootcommand, 'debian/rules', 'clean');
+ withecho(@rootcommand, @debian_rules, 'clean');
}
print "$progname: $srcmsg\n";