[LEDE-DEV] [PATCH] metadata: compile dependencies only when the package is selected

Alexandru Ardelean ardeleanalex at gmail.com
Tue Feb 27 23:28:07 PST 2018


On Wed, Feb 28, 2018 at 7:07 AM, Yousong Zhou <yszhou4tech at gmail.com> wrote:
> This is intended to reduce build time for situations like the following
> where python and python-six and their dependencies could still be built
> as long as any subpackage within the srcpackage was selected regardless
> of the selection state of openvswitch-python
>
>     define Package/openvswitch-python
>       ...
>       DEPENDS:=+python +python-six
>     endef
>
> Previously we work around this by specifying the dependency as
> +PACKAGE_openvswitch-python:python, which is unintuitive

This is pretty cool actually.
I never thought of changing this logic ; I just took this behavior as
a given behavior for packages.

Thanks for this
Alex

>
> Signed-off-by: Yousong Zhou <yszhou4tech at gmail.com>
> ---
>  scripts/package-metadata.pl | 13 ++++++++++---
>  1 file changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/scripts/package-metadata.pl b/scripts/package-metadata.pl
> index 53bb45a..b827154 100755
> --- a/scripts/package-metadata.pl
> +++ b/scripts/package-metadata.pl
> @@ -382,6 +382,7 @@ sub gen_package_mk() {
>                 my %deplines = ('' => {});
>
>                 foreach my $pkg (@{$src->{packages}}) {
> +                       my @pkgdeplines;
>                         foreach my $dep (@{$pkg->{depends}}) {
>                                 next if ($dep =~ /@/);
>
> @@ -410,10 +411,17 @@ sub gen_package_mk() {
>                                         }
>                                         my $depline = get_conditional_dep($condition, $depstr);
>                                         if ($depline) {
> -                                               $deplines{''}{$depline}++;
> +                                               push @pkgdeplines, $depline;
>                                         }
>                                 }
>                         }
> +                       if (@pkgdeplines) {
> +                               my $depstr = join(' ', @pkgdeplines);
> +                               if ($depstr) {
> +                                       my $depline = get_conditional_dep('PACKAGE_'.$pkg->{name}, $depstr);
> +                                       $deplines{''}{$depline}++;
> +                               }
> +                       }
>
>                         my $config = '';
>                         $config = sprintf '$(CONFIG_PACKAGE_%s)', $pkg->{name} unless $pkg->{buildonly};
> @@ -486,8 +494,7 @@ sub gen_package_mk() {
>                 }
>
>                 foreach my $suffix (sort keys %deplines) {
> -                       my $depline = join(" ", sort keys %{$deplines{$suffix}});
> -                       if ($depline) {
> +                       for my $depline (sort keys %{$deplines{$suffix}}) {
>                                 $line .= sprintf "\$(curdir)/%s/compile += %s\n", $src->{path}.$suffix, $depline;
>                         }
>                 }
> --
> 1.8.3.1
>



More information about the Lede-dev mailing list