From patchwork Mon Jan 8 14:52:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthias Schiffer X-Patchwork-Id: 856848 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="RXlk7IIZ"; 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 3zFdpZ6dVHz9s7f for ; Tue, 9 Jan 2018 02:04:22 +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=0tJhc7d6ns+xels86JW3ZFahXc4JRdpCwqQCoN6XQxo=; b=RXlk7IIZdvf4iJUA+VpQNreFsG 5D93Wv5wO2PF8nfUmXfAJVqjHlXMUg54HDveC6B+HAaIcj2ZJCYLDXOw9mHovfxqeC5mLb0ZLvevj R35Ce1ViZv0xPKGk9KZyDg54Acwp72ufoUEQWKRu1KVXL+dj6OCKjFLL5H2B60nWFTghXNUqvseMn KeY9uQIey2QOAzkd8qiSoxRDVFTmNjeUP8DETSmzb1b8RsEysvMPkqL/hHBlVD9ebgpjxQIol0iTw /MtGjho5lgfcf2YTXEEDuKha1bFVC2Dk1smI1w53Tab3hEZlbRYb3/xACLDgJmqXQc/7i5Rh3rdKr ynttoXHA==; 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 1eYYyA-00078d-Rn; Mon, 08 Jan 2018 15:04:10 +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-0002yI-NO for lede-dev@lists.infradead.org; Mon, 08 Jan 2018 15:00:43 +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 9E58C2049F; 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:24 +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_957050_72D4FB87 X-CRM114-Status: GOOD ( 11.93 ) 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 11/15] metadata: handle target build depends together with host build 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 Target build depends are similar to host build depends in that they refer to source packages rather than binary packages. Therefore, it makes sense to handle them together, rather than putting them in a list together with runtime depends and trying to figure out if the entries refer to source or to binary packages afterwards. This does lead to PKG_BUILD_DEPENDS entries referring to binary package names not working anymore, which requires some fixes in the package repositories. Signed-off-by: Matthias Schiffer --- scripts/package-metadata.pl | 60 +++++++++++++++++++++------------------------ 1 file changed, 28 insertions(+), 32 deletions(-) diff --git a/scripts/package-metadata.pl b/scripts/package-metadata.pl index 9372191166..e492cc8a09 100755 --- a/scripts/package-metadata.pl +++ b/scripts/package-metadata.pl @@ -408,6 +408,7 @@ sub gen_package_mk() { my $src = $srcpackage{$srcname}; my $variant_default; my @srcdeps; + my %deplines = ('' => {}); foreach my $pkg (@{$src->{packages}}) { next if defined $pkg->{vdepends}; @@ -441,19 +442,23 @@ sub gen_package_mk() { print "buildtypes-$src->{path} = ".join(' ', @{$src->{buildtypes}})."\n"; } - foreach my $dep (@{$src->{builddepends}}, map { @{$_->{depends}} } @{$src->{packages}}) { + foreach my $dep (map { @{$_->{depends}} } @{$src->{packages}}) { $dep =~ /@/ or do { $dep =~ s/\+//g; push @srcdeps, $dep; }; } - foreach my $type (@{$src->{buildtypes}}) { - my @extra_deps; - my %deplines; + foreach my $type ('', @{$src->{buildtypes}}) { + my $suffix = ''; - next unless $src->{"builddepends/$type"}; - foreach my $dep (@{$src->{"builddepends/$type"}}) { - my $suffix = ""; + $suffix = "/$type" if $type; + + next unless $src->{"builddepends$suffix"}; + + defined $deplines{$suffix} or $deplines{$suffix} = {}; + + foreach my $dep (@{$src->{"builddepends$suffix"}}) { + my $depsuffix = ""; my $deptype = ""; my $condition; @@ -464,37 +469,26 @@ sub gen_package_mk() { if ($dep =~ /^(.+)\/(.+)/) { $dep = $1; $deptype = $2; - $suffix = "/$2"; + $depsuffix = "/$2"; } - my $idx = ""; - my $pkg_dep = $package{$dep}; - if (defined($pkg_dep) && defined($pkg_dep->{src})) { - unless (!$deptype || grep { $_ eq $deptype } @{$pkg_dep->{src}->{buildtypes}}) { - warn sprintf "WARNING: Makefile '%s' has a %s build dependency on '%s/%s' but '%s' does not implement a '%s' build type\n", - $src->{makefile}, $type, $pkg_dep->{src}->{name}, $deptype, $pkg_dep->{src}->{makefile}, $deptype; - next; - } - $idx = $pkg_dep->{src}->{path}; - } elsif (defined($srcpackage{$dep})) { - $idx = $srcpackage{$dep}->{path}; - } else { + next if $srcname.$suffix eq $dep.$depsuffix; + + my $src_dep = $srcpackage{$dep}; + unless (defined($src_dep) && (!$deptype || grep { $_ eq $deptype } @{$src_dep->{buildtypes}})) { + warn sprintf "WARNING: Makefile '%s' has a build dependency on '%s%s', which does not exist\n", + $src->{makefile}, $dep, $depsuffix; next; } - my $depstr = "\$(curdir)/$idx$suffix/compile"; + + my $depstr = "\$(curdir)/$src_dep->{path}$depsuffix/compile"; my $depline = get_conditional_dep($condition, $depstr); if ($depline) { - $deplines{$depline}++; + $deplines{$suffix}->{$depline}++; } } - my $depline = join(" ", sort keys %deplines); - if ($depline) { - $line .= "\$(curdir)/$src->{path}/$type/compile += $depline\n"; - } } - my $hasdeps = 0; - my %deplines; foreach my $deps (@srcdeps) { my $idx; my $condition; @@ -552,14 +546,16 @@ sub gen_package_mk() { } $depline = get_conditional_dep($condition, $depstr); if ($depline) { - $deplines{$depline}++; + $deplines{''}->{$depline}++; } } } } - my $depline = join(" ", sort keys %deplines); - if ($depline) { - $line .= "\$(curdir)/$src->{path}/compile += $depline\n"; + foreach my $suffix (sort keys %deplines) { + my $depline = join(" ", sort keys %{$deplines{$suffix}}); + if ($depline) { + $line .= "\$(curdir)/$src->{path}$suffix/compile += $depline\n"; + } } }