Package: sbuild Version: 0.64.1-1 Severity: wishlist Tags: patch Hi,
it would be useful to have some more sbuild hooks. Specifically it would be useful to have them exactly before the build starts and exactly after it stops. More concretely, exactly before 'Build Start Time' is set and exactly after "Build finished at ..." is written to the log. Attached patch solves this problem. Unfortunately, there already exists hooks called pre-build-commands and post-build-commands even though they capture more than just the build (for example they also include package installation). These hooks are useful for finding unused build dependencies (see https://github.com/josch/findunusedbd which uses a patched sbuild). Thank you for your consideration. cheers, josch -- System Information: Debian Release: jessie/sid APT prefers testing APT policy: (990, 'testing'), (500, 'unstable'), (1, 'experimental') Architecture: amd64 (x86_64) Foreign Architectures: i386 Kernel: Linux 3.14-1-amd64 (SMP w/4 CPU cores) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Versions of packages sbuild depends on: ii adduser 3.113+nmu3 ii apt-utils 1.0.6 ii libsbuild-perl 0.64.1-1 ii perl 5.18.2-6 ii perl-modules 5.18.2-6 Versions of packages sbuild recommends: ii debootstrap 1.0.60 ii fakeroot 1.18.4-2 Versions of packages sbuild suggests: pn deborphan <none> ii wget 1.15-1+b1 -- no debconf information
>From df094f79a67c0835b0fddd73019b09951ed26987 Mon Sep 17 00:00:00 2001 From: josch <[email protected]> Date: Wed, 4 Jun 2014 22:57:36 +0200 Subject: [PATCH] add pre-realbuild-commands and post-realbuild-commands --- lib/Sbuild/Build.pm | 15 +++++++++++++++ lib/Sbuild/Conf.pm | 2 ++ lib/Sbuild/Options.pm | 10 ++++++++++ 3 files changed, 27 insertions(+) diff --git a/lib/Sbuild/Build.pm b/lib/Sbuild/Build.pm index a24b575..c8552de 100644 --- a/lib/Sbuild/Build.pm +++ b/lib/Sbuild/Build.pm @@ -1060,6 +1060,12 @@ sub run_external_commands { } elsif ($stage eq "chroot-setup-commands") { $self->log_subsection("Chroot Setup Commands"); $chroot = 1; + } elsif ($stage eq "pre-realbuild-commands") { + $self->log_subsection("Pre RealBuild Commands"); + $chroot = 1; + } elsif ($stage eq "post-realbuild-commands") { + $self->log_subsection("Post RealBuild Commands"); + $chroot = 1; } elsif ($stage eq "chroot-cleanup-commands") { $self->log_subsection("Chroot Cleanup Commands"); $chroot = 1; @@ -1383,6 +1389,10 @@ sub build { return 0; } + $self->run_external_commands("pre-realbuild-commands", + $self->get_conf('LOG_EXTERNAL_COMMAND_OUTPUT'), + $self->get_conf('LOG_EXTERNAL_COMMAND_ERROR')); + $self->set('Build Start Time', time); $self->set('Build End Time', $self->get('Build Start Time')); @@ -1564,6 +1574,11 @@ sub build { $self->log_sep(); $self->log("Build finished at $finish_date\n"); + + $self->run_external_commands("post-realbuild-commands", + $self->get_conf('LOG_EXTERNAL_COMMAND_OUTPUT'), + $self->get_conf('LOG_EXTERNAL_COMMAND_ERROR')); + my @space_files = ("$dscdir"); $self->log_subsubsection("Finished"); diff --git a/lib/Sbuild/Conf.pm b/lib/Sbuild/Conf.pm index 25ec66d..a396821 100644 --- a/lib/Sbuild/Conf.pm +++ b/lib/Sbuild/Conf.pm @@ -975,6 +975,8 @@ sub setup ($) { DEFAULT => { "pre-build-commands" => [], "chroot-setup-commands" => [], + "pre-realbuild-commands" => [], + "post-realbuild-commands" => [], "chroot-cleanup-commands" => [], "post-build-commands" => [], }, diff --git a/lib/Sbuild/Options.pm b/lib/Sbuild/Options.pm index 4a232bf..fbca939 100644 --- a/lib/Sbuild/Options.pm +++ b/lib/Sbuild/Options.pm @@ -267,6 +267,16 @@ sub set_options { push(@{${$self->get_conf('EXTERNAL_COMMANDS')}{"chroot-setup-commands"}}, \@command); }, + "pre-realbuild-commands=s" => sub { + my @command = split(/\s+/, $_[1]); + push(@{${$self->get_conf('EXTERNAL_COMMANDS')}{"pre-realbuild-commands"}}, + \@command); + }, + "post-realbuild-commands=s" => sub { + my @command = split(/\s+/, $_[1]); + push(@{${$self->get_conf('EXTERNAL_COMMANDS')}{"post-realbuild-commands"}}, + \@command); + }, "chroot-cleanup-commands=s" => sub { my @command = split(/\s+/, $_[1]); push(@{${$self->get_conf('EXTERNAL_COMMANDS')}{"chroot-cleanup-commands"}}, -- 1.9.2

