Control: tag -1 patch Hi,
On Thu, 01 Jan 2015 14:57:19 +0100 Johannes Schauer <j.scha...@email.de> wrote: > the sbuild man page says that the %SBUILD_CHROOT_DIR percentage escape is set > for external commands that are run outside the chroot. Indeed, the > corresponding code in lib/Sbuild/Build.pm sets "$percent{SBUILD_CHROOT_DIR} = > $chroot_dir" whenever "$chroot == 0" which is the case for "$stage eq > 'pre-build-commands'". > > But this remains without effect because "$self->get('Chroot Dir')" is not set > at the point when "$self->run_external_commands("pre-build-commands"...)" is > executed. > > So either move the execution of the pre-build-commands hook to after setting > of the 'Chroot Dir' variable or define that variable earlier so that it is > available for the pre-build-commands hook. the easiest solution is to just move the execution of the pre-build-commands hook to a bit later. The attached patch does exactly that. Please make sure that this cannot break any existing script relying on the functionality. cheers, josch
From 373f56e0ff69b0975c5a69d08382a09e7fc9b0eb Mon Sep 17 00:00:00 2001 From: josch <j.scha...@email.de> Date: Thu, 1 Jan 2015 15:12:46 +0100 Subject: [PATCH] Move running of pre-build-commands until after 'Chroot Dir' is defined - this prevents the %SBUILD_CHROOT_DIR percentage escape being empty when running the pre-build-commands hook --- debian/changelog | 5 +++++ lib/Sbuild/Build.pm | 12 ++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/debian/changelog b/debian/changelog index 46cca0d..6aeef32 100644 --- a/debian/changelog +++ b/debian/changelog @@ -6,6 +6,11 @@ sbuild (0.65.1-1) UNRELEASED; urgency=medium are present in the arch list (Closes: #771235). Thanks to Lennart Sorensen for this patch. + [ Johannes Schauer ] + * Move running of pre-build-commands until after 'Chroot Dir' is defined + - this prevents the %SBUILD_CHROOT_DIR percentage escape being empty + when running the pre-build-commands hook (Closes: #774359) + -- Roger Leigh <rle...@debian.org> Sun, 30 Nov 2014 22:44:47 +0000 sbuild (0.65.0-1) unstable; urgency=medium diff --git a/lib/Sbuild/Build.pm b/lib/Sbuild/Build.pm index 155e4fc..56d9f59 100644 --- a/lib/Sbuild/Build.pm +++ b/lib/Sbuild/Build.pm @@ -365,12 +365,6 @@ sub run_chroot_session { $self->get_conf('CHROOT'), $self->get_conf('HOST_ARCH')); - # Run pre build external commands - $self->check_abort(); - $self->run_external_commands("pre-build-commands", - $self->get_conf('LOG_EXTERNAL_COMMAND_OUTPUT'), - $self->get_conf('LOG_EXTERNAL_COMMAND_ERROR')); - $self->check_abort(); if (!$session->begin_session()) { Sbuild::Exception::Build->throw(error => "Error creating chroot session: skipping " . @@ -401,6 +395,12 @@ sub run_chroot_session { $self->set('Build Dir', $session->strip_chroot_path($self->get('Chroot Build Dir'))); + # Run pre build external commands + $self->check_abort(); + $self->run_external_commands("pre-build-commands", + $self->get_conf('LOG_EXTERNAL_COMMAND_OUTPUT'), + $self->get_conf('LOG_EXTERNAL_COMMAND_ERROR')); + # Log colouring $self->build_log_colour('red', '^E: '); $self->build_log_colour('yellow', '^W: '); -- 2.0.1