[devscripts] 04/18: debuild: Tell dpkg-buildpackage about the hooks we want it to run
James McCoy
jamessan at debian.org
Wed Nov 23 18:11:31 UTC 2016
This is an automated email from the git hooks/post-receive script.
jamessan pushed a commit to branch master
in repository devscripts.
commit 6bf94e623894dc2b7da41f6a45d9b4368d250ce2
Author: James McCoy <jamessan at debian.org>
Date: Thu Nov 17 22:43:45 2016 -0500
debuild: Tell dpkg-buildpackage about the hooks we want it to run
All hooks other than "signing" and "post-buildpackage" will be handled
directly by dpkg-buildpackage. Control then returns to debuild so
signing can be performed by deb(r)sign, which is why debuild needs to
run the "signing" and "post-buildpackage" hooks.
Signed-off-by: James McCoy <jamessan at debian.org>
---
scripts/debuild.pl | 59 ++++++++++++++++++------------------------------------
1 file changed, 19 insertions(+), 40 deletions(-)
diff --git a/scripts/debuild.pl b/scripts/debuild.pl
index b1bd4f6..461d50f 100755
--- a/scripts/debuild.pl
+++ b/scripts/debuild.pl
@@ -715,18 +715,6 @@ if ($command_version eq 'dpkg') {
# We're going to emulate dpkg-buildpackage and possibly lintian.
# This will allow us to run hooks.
- # check hooks
- my @skip_hooks = ();
- for my $hookname (qw(clean dpkg-source build binary dpkg-genchanges
- final-clean)) {
- if ($hook{$hookname}) { push @skip_hooks, $hookname; }
- }
- if (@skip_hooks) {
- $emulate_dpkgbp = 1;
- warn "$progname: emulating dpkg-buildpackage as the following hooks were defined:\n"
- . " " . join(", ", @skip_hooks) . "\n\n";
- }
-
# Our first task is to parse the command line options.
# And before we get too excited, does lintian even exist?
@@ -767,6 +755,25 @@ if ($command_version eq 'dpkg') {
# and one for dpkg-buildpackage if needed
my @dpkg_opts = qw(-us -uc);
+ my %debuild2dpkg = (
+ 'dpkg-buildpackage' => 'init',
+ 'clean' => 'preclean',
+ 'dpkg-source' => 'source',
+ 'build' => 'build',
+ 'binary' => 'binary',
+ 'dpkg-genchanges' => 'changes',
+ 'postclean' => 'final-clean',
+ 'lintian' => 'check',
+ );
+
+ for my $h_name (@hooks) {
+ if (exists $debuild2dpkg{$h_name}) {
+ push(@dpkg_opts,
+ sprintf('--hook-%s=%s', $debuild2dpkg{$h_name}, $hook{$h_name}));
+ delete $hook{$h_name};
+ }
+ }
+
# Parse dpkg-buildpackage options
# First process @dpkg_extra_opts from above
@@ -986,8 +993,6 @@ if ($command_version eq 'dpkg') {
open STDOUT, ">&BUILD" or fatal "can't reopen stdout: $!";
open STDERR, ">&BUILD" or fatal "can't reopen stderr: $!";
- run_hook('dpkg-buildpackage', 1);
-
if (!$emulate_dpkgbp) {
unshift @dpkg_opts, ($checkbuilddep ? "-D" : "-d");
unshift @dpkg_opts, "-r$root_command" if $root_command;
@@ -1070,8 +1075,6 @@ EOT
}
}
- run_hook('clean', ! $noclean);
-
# Next dpkg-buildpackage action: clean
unless ($noclean) {
if ($< == 0) {
@@ -1081,8 +1084,6 @@ EOT
}
}
- run_hook('dpkg-source', ! $binaryonly);
-
# Next dpkg-buildpackage action: dpkg-source
if (! $binaryonly) {
my @cmd = (qw(dpkg-source));
@@ -1097,14 +1098,10 @@ EOT
chdir $dirn or fatal "can't chdir $dirn: $!";
}
- run_hook('build', ! $sourceonly);
-
# Next dpkg-buildpackage action: build and binary targets
if (! $sourceonly) {
system_withecho('debian/rules', 'build');
- run_hook('binary', 1);
-
if ($< == 0) {
system_withecho('debian/rules', $binarytarget);
} else {
@@ -1114,11 +1111,6 @@ EOT
push @warnings, "$progname: not running binary hook '$hook{'binary'}' as -S option used\n";
}
- # We defer the signing the .dsc file until after dpkg-genchanges has
- # been run
-
- run_hook('dpkg-genchanges', 1);
-
# Because of our messing around with STDOUT and wanting to pass
# arguments safely to dpkg-genchanges means that we're gonna have to
# do it manually :(
@@ -1153,8 +1145,6 @@ EOT
unless $ch =~ /Changes:.*(remaining|Ubuntu)(.|\n )*(differen|changes)/is;
}
- run_hook('final-clean', $cleansource);
-
# Final dpkg-buildpackage action: clean target again
if ($cleansource) {
if ($< == 0) {
@@ -1210,17 +1200,6 @@ EOT
chdir '..' or fatal "can't chdir: $!";
} # end of debuild dpkg-buildpackage emulation
- run_hook('lintian', $run_lintian && $lintian_exists);
-
- if ($run_lintian && $lintian_exists) {
- $<=$>=$uid; # Give up on root privileges if we can
- $(=$)=$gid;
- print "Now running lintian...\n";
- # The remaining items in @ARGV, if any, are lintian options
- system('lintian', @lintian_extra_opts, @lintian_opts, $changes);
- print "Finished running lintian.\n";
- }
-
# They've insisted. Who knows why?!
if (($signchanges or $signsource) and $usepause) {
print "Press the return key to start signing process\n";
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/collab-maint/devscripts.git
More information about the devscripts-devel
mailing list