From 2d02a12697808b01b360e7ceb52864c0873f7eac Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Sat, 16 Jun 2018 18:33:15 +0200 Subject: Dpkg::Vendor::Debian: Inline _parse_feature_area() into _add_build_flags() This function was being called on each foreach iteration to parse the options within the DEB_BUILD_MAINT_OPTIONS and DEB_BUILD_OPTIONS environment variables, and needed to parse these at construction time every time. Inlining it should make it more performant and in addition reduce line count. --- scripts/Dpkg/Vendor/Debian.pm | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) (limited to 'scripts/Dpkg') diff --git a/scripts/Dpkg/Vendor/Debian.pm b/scripts/Dpkg/Vendor/Debian.pm index 814948e83..2e42a8b86 100644 --- a/scripts/Dpkg/Vendor/Debian.pm +++ b/scripts/Dpkg/Vendor/Debian.pm @@ -86,18 +86,6 @@ sub run_hook { } } -sub _parse_feature_area { - my ($self, $area, $use_feature) = @_; - - require Dpkg::BuildOptions; - - # Adjust features based on user or maintainer's desires. - my $opts = Dpkg::BuildOptions->new(envvar => 'DEB_BUILD_OPTIONS'); - $opts->parse_features($area, $use_feature); - $opts = Dpkg::BuildOptions->new(envvar => 'DEB_BUILD_MAINT_OPTIONS'); - $opts->parse_features($area, $use_feature); -} - sub _add_build_flags { my ($self, $flags) = @_; @@ -141,9 +129,15 @@ sub _add_build_flags { ## Setup + require Dpkg::BuildOptions; + # Adjust features based on user or maintainer's desires. + my $opts_build = Dpkg::BuildOptions->new(envvar => 'DEB_BUILD_OPTIONS'); + my $opts_maint = Dpkg::BuildOptions->new(envvar => 'DEB_BUILD_MAINT_OPTIONS'); + foreach my $area (sort keys %use_feature) { - $self->_parse_feature_area($area, $use_feature{$area}); + $opts_build->parse_features($area, $use_feature{$area}); + $opts_maint->parse_features($area, $use_feature{$area}); } require Dpkg::Arch; -- cgit v1.2.3