diff options
author | Raphael Hertzog <hertzog@debian.org> | 2009-02-11 14:19:44 +0100 |
---|---|---|
committer | Raphael Hertzog <hertzog@debian.org> | 2009-02-11 15:29:32 +0100 |
commit | 66264bb2662d4f8d8cbe9e50c689182c4566a92d (patch) | |
tree | fbd2f56166c9882317001ff7a553932023005349 | |
parent | fc08909f3af4cbe8a6351e61eab16ea23bf87ec1 (diff) | |
download | dpkg-66264bb2662d4f8d8cbe9e50c689182c4566a92d.tar.gz |
dpkg-buildpackage: new option to call arbitrary debian/rules targets
* scripts/dpkg-buildpackage.pl: Add new option --target/-T to
allow a specific debian/rules target to be run. The new --as-root
option forces the target to be run with root rights.
Add support for the two common syntaxes for long
options ("--admindir=…" and "--admindir …").
* man/dpkg-buildpackage.1: Update documentation accordingly.
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | debian/changelog | 3 | ||||
-rw-r--r-- | man/dpkg-buildpackage.1 | 27 | ||||
-rwxr-xr-x | scripts/dpkg-buildpackage.pl | 25 |
4 files changed, 62 insertions, 2 deletions
@@ -1,5 +1,14 @@ 2009-02-11 Raphael Hertzog <hertzog@debian.org> + * scripts/dpkg-buildpackage.pl: Add new option --target/-T to + allow a specific debian/rules target to be run. The new --as-root + option forces the target to be run with root rights. + Add support for the two common syntaxes for long + options ("--admindir=…" and "--admindir …"). + * man/dpkg-buildpackage.1: Update documentation accordingly. + +2009-02-11 Raphael Hertzog <hertzog@debian.org> + * man/dpkg-buildpackage.1: Fix name of binary target in default case. diff --git a/debian/changelog b/debian/changelog index 41bb0c651..7b262339e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -138,6 +138,9 @@ dpkg (1.15.0) UNRELEASED; urgency=low installed is the one currently selected. Closes: #100135 * Let update-alternatives deal with empty files in its administrative directory by ignoring them. Closes: #457863 + * Add new --target and --as-root options to dpkg-buildpackage to call + any debian/rules target with the proper build environment. + Closes: #477916 [ Pierre Habouzit ] * Add a --query option to update-alternatives. Closes: #336091, #441904 diff --git a/man/dpkg-buildpackage.1 b/man/dpkg-buildpackage.1 index 1d6b88990..a3bdd0502 100644 --- a/man/dpkg-buildpackage.1 +++ b/man/dpkg-buildpackage.1 @@ -17,7 +17,9 @@ variables (see \fBENVIRONMENT VARIABLES\fP). It checks that the build-dependencies and build-conflicts are satisfied (unless \fB\-d\fP is specified). .IP \fB3.\fP 3 -It calls \fBfakeroot debian/rules clean\fP to clean the build-tree (unless +If a specific target has been selected with the \fB-T\fP or \fB--target\fP +option, it calls that target and stops here. Otherwise it calls +\fBfakeroot debian/rules clean\fP to clean the build-tree (unless \fB\-nc\fP is specified). .IP \fB4.\fP 3 It calls \fBdpkg-source\fP to generate the source package (unless @@ -62,6 +64,23 @@ packages. Passed to \fBdpkg-genchanges\fP. Specifies a source-only build, no binary packages need to be made. Passed to \fBdpkg-genchanges\fP. .P +.BI \-\-target= target +.br +.BI "\-\-target " target +.br +.BI \-T target +.RS +Calls \fBdebian/rules\fP \fItarget\fP after having setup the build +environment and stops the package build process here. If +\fB\-\-as\-root\fP is also given, then the command is executed +as root (see \fB\-r\fP). Note that official targets that are required to +be run as root by the Debian policy do not need this option. +.RE +.TP +.B \-\-as\-root +Only meaningful together with \fB\-\-target\fP. Requires that the target be +run with root rights. +.P .B \-si .br .B \-sa @@ -186,10 +205,14 @@ Do not sign the \fB.changes\fP file. .RS Passed unchanged to \fBdpkg\-source\fP. See its manual page. .RE -.TP +.P .BI \-\-admindir= dir +.br +.BI "\-\-admindir " dir +.RS Change the location of the \fBdpkg\fR database. The default location is \fI/var/lib/dpkg\fP. +.RE .TP .BR \-h ", " \-\-help Show the usage message and exit. diff --git a/scripts/dpkg-buildpackage.pl b/scripts/dpkg-buildpackage.pl index f0eea3e6b..df4684a8b 100755 --- a/scripts/dpkg-buildpackage.pl +++ b/scripts/dpkg-buildpackage.pl @@ -43,6 +43,8 @@ Options: -p<sign-command> -d do not check build dependencies and conflicts. -D check build dependencies and conflicts. + -T<target> call debian/rules <target> with the proper environment + --as-root ensure -T calls the target with root rights -j[<number>] specify jobs to run simultaneously } passed to debian/rules -k<keyid> the key to use for signing. -sgpg the sign-command is called like GPG. @@ -102,6 +104,8 @@ my $signchanges = 1; my $diffignore = ''; my $binarytarget = 'binary'; my $targetarch = my $targetgnusystem = ''; +my $call_target = ''; +my $call_target_as_root = 0; while (@ARGV) { $_ = shift @ARGV; @@ -112,6 +116,8 @@ while (@ARGV) { } elsif (/^--version$/) { showversion; exit 0; + } elsif (/^--admindir$/) { + $admindir = shift @ARGV; } elsif (/^--admindir=(.*)$/) { $admindir = $1; } elsif (/^-j(\d*)$/) { @@ -149,6 +155,12 @@ while (@ARGV) { $cleansource = 1; } elsif (/^-t(.*)$/) { $targetgnusystem = $1; # Order DOES matter! + } elsif (/^(--target|-T)$/) { + $call_target = shift @ARGV; + } elsif (/^(--target=|-T)(.+)$/) { + $call_target = $2; + } elsif (/^--as-root$/) { + $call_target_as_root = 1; } elsif (/^-nc$/) { $noclean = 1; if ($sourceonly) { @@ -333,6 +345,8 @@ unless ($sourceonly) { $arch = 'source'; } +# Preparation of environment stops here + (my $sversion = $version) =~ s/^\d+://; my $pv = "${pkg}_$sversion"; @@ -356,6 +370,17 @@ if ($checkbuilddep) { } } +if ($call_target) { + if ($call_target_as_root or + $call_target =~ /^(clean|binary(|-arch|-indep))$/) + { + withecho(@rootcommand, @debian_rules, $call_target); + } else { + withecho(@debian_rules, $call_target); + } + exit 0; +} + unless ($noclean) { withecho(@rootcommand, @debian_rules, 'clean'); } |