[OpenWrt-Devel,02/15] metadata: make srcpackage extensible

Message ID 5a3e92806056c07ac818ca2000189e61150e7d29.1515421834.git.mschiffer@universe-factory.net
State Superseded
Headers show
Series
  • Metadata generator refactoring, cleanup and PROVIDES improvements
Related show

Commit Message

Matthias Schiffer Jan. 8, 2018, 2:52 p.m.
Turn the srcpackage values into hashes to allow storing more information
than just binary package names.

Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
---
 scripts/feeds               | 2 +-
 scripts/metadata.pm         | 6 ++++--
 scripts/package-metadata.pl | 2 +-
 3 files changed, 6 insertions(+), 4 deletions(-)

Patch

diff --git a/scripts/feeds b/scripts/feeds
index 55c294ad0a..42f7b3b116 100755
--- a/scripts/feeds
+++ b/scripts/feeds
@@ -525,7 +525,7 @@  sub install_package {
 	};
 
 	# install all dependencies referenced from the source package
-	foreach my $vpkg (@{$feed_src->{$src}}) {
+	foreach my $vpkg (@{$feed_src->{$src}->{packages}}) {
 		foreach my $dep (@{$vpkg->{depends}}, @{$vpkg->{builddepends}}, @{$vpkg->{"builddepends/host"}}) {
 			next if $dep =~ /@/;
 			$dep =~ s/^\+//;
diff --git a/scripts/metadata.pm b/scripts/metadata.pm
index d446892e2b..297abc9f12 100644
--- a/scripts/metadata.pm
+++ b/scripts/metadata.pm
@@ -212,7 +212,9 @@  sub parse_package_metadata($) {
 			$src = $3;
 			$subdir =~ s/^package\///;
 			$subdir{$src} = $subdir;
-			$srcpackage{$src} = [];
+			$srcpackage{$src} = {
+				packages => [],
+			};
 			$override = "";
 			undef $pkg;
 		};
@@ -237,7 +239,7 @@  sub parse_package_metadata($) {
 			$pkg->{tristate} = 1;
 			$pkg->{override} = $override;
 			$package{$1} = $pkg;
-			push @{$srcpackage{$src}}, $pkg;
+			push @{$srcpackage{$src}->{packages}}, $pkg;
 		};
 		/^Feature:\s*(.+?)\s*$/ and do {
 			undef $pkg;
diff --git a/scripts/package-metadata.pl b/scripts/package-metadata.pl
index 46446e994b..3a176c8024 100755
--- a/scripts/package-metadata.pl
+++ b/scripts/package-metadata.pl
@@ -445,7 +445,7 @@  sub gen_package_mk() {
 			print "buildtypes-$pkg->{subdir}$pkg->{src} = ".join(' ', @{$pkg->{buildtypes}})."\n";
 		}
 
-		foreach my $spkg (@{$srcpackage{$pkg->{src}}}) {
+		foreach my $spkg (@{$srcpackage{$pkg->{src}}->{packages}}) {
 			foreach my $dep (@{$spkg->{depends}}, @{$spkg->{builddepends}}) {
 				$dep =~ /@/ or do {
 					$dep =~ s/\+//g;