From patchwork Mon Jan 8 14:52:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthias Schiffer X-Patchwork-Id: 856846 X-Patchwork-Delegate: mschiffer@universe-factory.net Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=65.50.211.133; helo=bombadil.infradead.org; envelope-from=lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="GTy+DCwF"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zFdnx69KXz9s4s for ; Tue, 9 Jan 2018 02:03:49 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:Subject:References: In-Reply-To:Message-Id:Date:To:From:Reply-To:Cc:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=KXjy0yl0dWxC+eorTY+pVcZ9BvAeS9ZEiLQYNp7N02k=; b=GTy+DCwFz4ctMbxUULL9AHg6By EeKJfLVcxs4ptL7d8P648mW/0JcAA+kCMmeYgPV9/a2LrkrSEtA5MOXDrWVgc/OY0hvZ9vHMpq2DO DzNJV0+zREOWwjULsNfR1m016/s34VQ42aneXugLKoxTiJmK8bOqZghkVUgcrCbBLSQAMZytMsU6t xJ/174B91OSq55MnG4/H0JtPenALXcpsLti/daxynptoNHuE8ABA8spdvP2veyeUigXK/aIF7DzXI 2ivUoOQB3hRhWesEBtc5Pp64djSElglPJpaKP4Oi87gKG4UfUUT2uFr1ZlC9n7c46adH54zyH2kON eTMZOj3Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1eYYxj-0006jx-1E; Mon, 08 Jan 2018 15:03:43 +0000 Received: from orthanc.universe-factory.net ([2001:19f0:6c01:100::1]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1eYYtr-0002xo-MF for lede-dev@lists.infradead.org; Mon, 08 Jan 2018 15:00:36 +0000 Received: from avalon.lan (unknown [IPv6:2001:19f0:6c01:100::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by orthanc.universe-factory.net (Postfix) with ESMTPSA id CCE04204A1; Mon, 8 Jan 2018 15:52:47 +0100 (CET) From: Matthias Schiffer To: lede-dev@lists.infradead.org, openwrt-devel@lists.openwrt.org, jo@mein.io, nbd@nbd.name Date: Mon, 8 Jan 2018 15:52:25 +0100 Message-Id: X-Mailer: git-send-email 2.15.1 In-Reply-To: References: In-Reply-To: References: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180108_065944_846451_30B8D901 X-CRM114-Status: UNSURE ( 9.43 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Subject: [LEDE-DEV] [PATCH 12/15] metadata: simplify generation of build depends from runtime depends X-BeenThere: lede-dev@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "Lede-dev" Errors-To: lede-dev-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Runtime depends cannot have a buildtype suffix, and they never refer to source package names. In addition, this adds warnings about unsatisfiable dependencies. Furthermore, this change fixes the generation of conditional build dependencies for virtual packages provided by different source packages. Signed-off-by: Matthias Schiffer --- scripts/package-metadata.pl | 112 ++++++++++++++++---------------------------- 1 file changed, 41 insertions(+), 71 deletions(-) diff --git a/scripts/package-metadata.pl b/scripts/package-metadata.pl index e492cc8a09..980ad24dc0 100755 --- a/scripts/package-metadata.pl +++ b/scripts/package-metadata.pl @@ -399,18 +399,56 @@ sub get_conditional_dep($$) { } sub gen_package_mk() { - my %conf; - my %dep; my $line; parse_package_metadata($ARGV[0]) or exit 1; foreach my $srcname (sort {uc($a) cmp uc($b)} keys %srcpackage) { my $src = $srcpackage{$srcname}; my $variant_default; - my @srcdeps; my %deplines = ('' => {}); foreach my $pkg (@{$src->{packages}}) { + foreach my $dep (@{$pkg->{depends}}) { + next if ($dep =~ /@/); + + my $condition; + + $dep =~ s/\+//g; + if ($dep =~ /^(.+):(.+)/) { + $condition = $1; + $dep = $2; + } + + my $pkg_dep = $package{$dep}; + unless (defined $pkg_dep) { + warn sprintf "WARNING: Makefile '%s' has a dependency on '%s', which does not exist\n", + $src->{makefile}, $dep; + next; + } + + unless ($pkg_dep->{vdepends}) { + next if $srcname eq $pkg_dep->{src}->{name}; + + my $depstr = "\$(curdir)/$pkg_dep->{src}->{path}/compile"; + my $depline = get_conditional_dep($condition, $depstr); + if ($depline) { + $deplines{''}->{$depline}++; + } + next; + } + + foreach my $vdep (@{$pkg_dep->{vdepends}}) { + my $pkg_vdep = $package{$vdep}; + next if $srcname eq $pkg_vdep->{src}->{name}; + + my $depstr = "\$(if \$(CONFIG_PACKAGE_$vdep),\$(curdir)/$pkg_vdep->{src}->{path}/compile)"; + my $depline = get_conditional_dep($condition, $depstr); + if ($depline) { + $deplines{''}->{$depline}++; + } + } + } + next if defined $pkg->{vdepends}; my $config = ''; @@ -442,12 +480,6 @@ sub gen_package_mk() { print "buildtypes-$src->{path} = ".join(' ', @{$src->{buildtypes}})."\n"; } - foreach my $dep (map { @{$_->{depends}} } @{$src->{packages}}) { - $dep =~ /@/ or do { - $dep =~ s/\+//g; - push @srcdeps, $dep; - }; - } foreach my $type ('', @{$src->{buildtypes}}) { my $suffix = ''; @@ -489,68 +521,6 @@ sub gen_package_mk() { } } - foreach my $deps (@srcdeps) { - my $idx; - my $condition; - my $prefix = ""; - my $suffix = ""; - my $deptype = ""; - - if ($deps =~ /^(.+):(.+)/) { - $condition = $1; - $deps = $2; - } - if ($deps =~ /^(.+)\/(.+)/) { - $deps = $1; - $deptype = $2; - $suffix = "/$2"; - } - - my $pkg_dep = $package{$deps}; - my @deps; - - if ($pkg_dep->{vdepends}) { - @deps = @{$pkg_dep->{vdepends}}; - } else { - @deps = ($deps); - } - - foreach my $dep (@deps) { - $pkg_dep = $package{$deps}; - if (defined $pkg_dep->{src}) { - unless (!$deptype || grep { $_ eq $deptype } @{$pkg_dep->{src}->{buildtypes}}) { - warn sprintf "WARNING: Makefile '%s' has a build dependency on '%s/%s' but '%s' does not implement a '%s' build type\n", - $src->{makefile}, $pkg_dep->{src}->{name}, $deptype, $pkg_dep->{src}->{makefile}, $deptype; - next; - } - $idx = $pkg_dep->{src}->{path}; - } elsif (defined($srcpackage{$dep})) { - $idx = $srcpackage{$dep}->{path}; - } - - if ($idx) { - $idx .= $suffix; - - my $depline; - next if $srcname eq $pkg_dep->{src}->{name}.$suffix; - next if $dep{$condition.":".$srcname."->".$idx}; - next if $dep{$srcname."->($dep)".$idx} and $pkg_dep->{vdepends}; - my $depstr; - - if ($pkg_dep->{vdepends}) { - $depstr = "\$(if \$(CONFIG_PACKAGE_$dep),\$(curdir)/$idx/compile)"; - $dep{$srcname."->($dep)".$idx} = 1; - } else { - $depstr = "\$(curdir)/$idx/compile"; - $dep{$srcname."->".$idx} = 1; - } - $depline = get_conditional_dep($condition, $depstr); - if ($depline) { - $deplines{''}->{$depline}++; - } - } - } - } foreach my $suffix (sort keys %deplines) { my $depline = join(" ", sort keys %{$deplines{$suffix}}); if ($depline) {