X-Git-Url: http://git.openwrt.org/?p=openwrt%2Fopenwrt.git;a=blobdiff_plain;f=scripts%2Fpackage-metadata.pl;h=c49d132912828531c7125787f4f53d7130323123;hp=09aed96c2be6572a1871d6c40f3ea24ece195084;hb=b616aa6db7a9952c182ab49d7942fb67c09803d5;hpb=6177b649ca8cd11545fe945245b449236ac4bd50 diff --git a/scripts/package-metadata.pl b/scripts/package-metadata.pl index 09aed96c2b..c49d132912 100755 --- a/scripts/package-metadata.pl +++ b/scripts/package-metadata.pl @@ -176,12 +176,25 @@ sub mconf_depends { next if $package{$depend} and $package{$depend}->{buildonly}; if ($flags =~ /\+/) { if ($vdep = $package{$depend}->{vdepends}) { - my @vdeps = @$vdep; - $depend = shift @vdeps; + my @vdeps; + $depend = undef; + + foreach my $v (@$vdep) { + if ($package{$v} && $package{$v}->{variant_default}) { + $depend = $v; + } else { + push @vdeps, $v; + } + } + + if (!$depend) { + $depend = shift @vdeps; + } + if (@vdeps > 1) { - $condition = '!('.join("||", map { "PACKAGE_".$_ } @vdeps).')'; + $condition = ($condition ? "$condition && " : '') . '!('.join("||", map { "PACKAGE_".$_ } @vdeps).')'; } elsif (@vdeps > 0) { - $condition = '!PACKAGE_'.$vdeps[0]; + $condition = ($condition ? "$condition && " : '') . '!PACKAGE_'.$vdeps[0]; } } @@ -202,11 +215,13 @@ sub mconf_depends { $flags =~ /@/ or $depend = "PACKAGE_$depend"; } } + if ($condition) { if ($m =~ /select/) { next if $depend eq $condition; $depend = "$depend if $condition"; } else { + next if $dep->{"$depend if $condition"}; $depend = "!($condition) || $depend" unless $dep->{$condition} eq 'select'; } } @@ -351,7 +366,7 @@ sub print_package_overrides() { keys %overrides > 0 or return; print "\tconfig OVERRIDE_PKGS\n"; print "\t\tstring\n"; - print "\t\tdefault \"".join(" ", keys %overrides)."\"\n\n"; + print "\t\tdefault \"".join(" ", sort keys %overrides)."\"\n\n"; } sub gen_package_config() { @@ -445,20 +460,27 @@ sub gen_package_mk() { next unless $pkg->{"builddepends/$type"}; foreach my $dep (@{$pkg->{"builddepends/$type"}}) { my $suffix = ""; + my $deptype = ""; my $condition; if ($dep =~ /^(.+):(.+)/) { $condition = $1; $dep = $2; } - if ($dep =~ /^(.+)(\/.+)/) { + if ($dep =~ /^(.+)\/(.+)/) { $dep = $1; - $suffix = $2; + $deptype = $2; + $suffix = "/$2"; } my $idx = ""; my $pkg_dep = $package{$dep}; if (defined($pkg_dep) && defined($pkg_dep->{src})) { + unless (!$deptype || grep { $_ eq $deptype } @{$pkg_dep->{buildtypes}}) { + warn sprintf "WARNING: Makefile '%s' has a %s build dependency on '%s/%s' but '%s' does not implement a '%s' build type\n", + $pkg->{makefile}, $type, $pkg_dep->{src}, $deptype, $pkg_dep->{makefile}, $deptype; + next; + } $idx = $pkg_dep->{subdir}.$pkg_dep->{src}; } elsif (defined($srcpackage{$dep})) { $idx = $subdir{$dep}.$dep; @@ -484,14 +506,16 @@ sub gen_package_mk() { my $condition; my $prefix = ""; my $suffix = ""; + my $deptype = ""; if ($deps =~ /^(.+):(.+)/) { $condition = $1; $deps = $2; } - if ($deps =~ /^(.+)(\/.+)/) { + if ($deps =~ /^(.+)\/(.+)/) { $deps = $1; - $suffix = $2; + $deptype = $2; + $suffix = "/$2"; } my $pkg_dep = $package{$deps}; @@ -506,7 +530,17 @@ sub gen_package_mk() { foreach my $dep (@deps) { $pkg_dep = $package{$deps}; if (defined $pkg_dep->{src}) { - ($pkg->{src} ne $pkg_dep->{src}.$suffix) and $idx = $pkg_dep->{subdir}.$pkg_dep->{src}; + unless (!$deptype || grep { $_ eq $deptype } @{$pkg_dep->{buildtypes}}) { + warn sprintf "WARNING: Makefile '%s' has a build dependency on '%s/%s' but '%s' does not implement a '%s' build type\n", + $pkg->{makefile}, $pkg_dep->{src}, $deptype, $pkg_dep->{makefile}, $deptype; + next; + } + unless ($pkg->{src} ne $pkg_dep->{sec}.$suffix) { + warn sprintf "WARNING: Makefile '%s' has a build dependency on itself\n", + $pkg->{makefile}; + next; + } + $idx = $pkg_dep->{subdir}.$pkg_dep->{src}; } elsif (defined($srcpackage{$dep})) { $idx = $subdir{$dep}.$dep; } @@ -558,7 +592,7 @@ ifndef DUMP_TARGET_DB ( \\ $cmds \\ ) > \$@ - + ifneq (\$(IMAGEOPT)\$(CONFIG_IMAGEOPT),) package/preconfig: \$(TARGET_DIR)/etc/uci-defaults/$preconfig endif