metadata: move 'buildtypes' from binary to source packages
authorMatthias Schiffer <mschiffer@universe-factory.net>
Sat, 6 Jan 2018 12:53:42 +0000 (13:53 +0100)
committerMatthias Schiffer <mschiffer@universe-factory.net>
Sat, 13 Jan 2018 18:54:43 +0000 (19:54 +0100)
Build types are a property of source rather than binary packages. This is a
preparation for followup cleanup.

Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
scripts/metadata.pm
scripts/package-metadata.pl

index fdb1fbb433646f95a2c87b8d6739ab1d1021b4f4..d756c7242dcd4fcec2ccaccd117303284b777794 100644 (file)
@@ -214,6 +214,7 @@ sub parse_package_metadata($) {
                        $subdir{$src} = $subdir;
                        $srcpackage{$src} = {
                                packages => [],
+                               buildtypes => [],
                        };
                        $override = "";
                        undef $pkg;
@@ -234,7 +235,6 @@ sub parse_package_metadata($) {
                        $pkg->{depends} = [];
                        $pkg->{mdepends} = [];
                        $pkg->{builddepends} = [];
-                       $pkg->{buildtypes} = [];
                        $pkg->{subdir} = $subdir;
                        $pkg->{tristate} = 1;
                        $pkg->{override} = $override;
@@ -258,6 +258,7 @@ sub parse_package_metadata($) {
                        /^Feature-Description:/ and $feature->{description} = get_multiline(\*FILE, "\t\t\t");
                        next;
                };
+               /^Build-Types:\s*(.+)\s*$/ and $srcpackage{$src}{buildtypes} = [ split /\s+/, $1 ];
                next unless $pkg;
                /^Version: \s*(.+)\s*$/ and $pkg->{version} = $1;
                /^Title: \s*(.+)\s*$/ and $pkg->{title} = $1;
@@ -290,7 +291,6 @@ sub parse_package_metadata($) {
                /^Build-Only: \s*(.+)\s*$/ and $pkg->{buildonly} = 1;
                /^Build-Depends: \s*(.+)\s*$/ and $pkg->{builddepends} = [ split /\s+/, $1 ];
                /^Build-Depends\/(\w+): \s*(.+)\s*$/ and $pkg->{"builddepends/$1"} = [ split /\s+/, $2 ];
-               /^Build-Types:\s*(.+)\s*$/ and $pkg->{buildtypes} = [ split /\s+/, $1 ];
                /^Repository:\s*(.+?)\s*$/ and $pkg->{repository} = $1;
                /^Category: \s*(.+)\s*$/ and do {
                        $pkg->{category} = $1;
index f03547a0d4478ee56be8bc3d0d848bd31fe853e7..22de5b1ba0f33bda4f5315805d7e67ab4304f2c5 100755 (executable)
@@ -421,6 +421,7 @@ sub gen_package_mk() {
        foreach my $name (sort {uc($a) cmp uc($b)} keys %package) {
                my $config;
                my $pkg = $package{$name};
+               my $src = $srcpackage{$pkg->{src}};
                my @srcdeps;
 
                next if defined $pkg->{vdepends};
@@ -441,11 +442,11 @@ sub gen_package_mk() {
                next if $done{$pkg->{src}};
                $done{$pkg->{src}} = 1;
 
-               if (@{$pkg->{buildtypes}} > 0) {
-                       print "buildtypes-$pkg->{subdir}$pkg->{src} = ".join(' ', @{$pkg->{buildtypes}})."\n";
+               if (@{$src->{buildtypes}} > 0) {
+                       print "buildtypes-$pkg->{subdir}$pkg->{src} = ".join(' ', @{$src->{buildtypes}})."\n";
                }
 
-               foreach my $spkg (@{$srcpackage{$pkg->{src}}{packages}}) {
+               foreach my $spkg (@{$src->{packages}}) {
                        foreach my $dep (@{$spkg->{depends}}, @{$spkg->{builddepends}}) {
                                $dep =~ /@/ or do {
                                        $dep =~ s/\+//g;
@@ -453,7 +454,7 @@ sub gen_package_mk() {
                                };
                        }
                }
-               foreach my $type (@{$pkg->{buildtypes}}) {
+               foreach my $type (@{$src->{buildtypes}}) {
                        my @extra_deps;
                        my %deplines;
 
@@ -476,7 +477,7 @@ sub gen_package_mk() {
                                my $idx = "";
                                my $pkg_dep = $package{$dep};
                                if (defined($pkg_dep) && defined($pkg_dep->{src})) {
-                                       unless (!$deptype || grep { $_ eq $deptype } @{$pkg_dep->{buildtypes}}) {
+                                       unless (!$deptype || grep { $_ eq $deptype } @{$srcpackage{$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",
                                                        $pkg->{makefile}, $type, $pkg_dep->{src}, $deptype, $pkg_dep->{makefile}, $deptype;
                                                next;
@@ -530,7 +531,7 @@ sub gen_package_mk() {
                        foreach my $dep (@deps) {
                                $pkg_dep = $package{$deps};
                                if (defined $pkg_dep->{src}) {
-                                       unless (!$deptype || grep { $_ eq $deptype } @{$pkg_dep->{buildtypes}}) {
+                                       unless (!$deptype || grep { $_ eq $deptype } @{$srcpackage{$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",
                                                        $pkg->{makefile}, $pkg_dep->{src}, $deptype, $pkg_dep->{makefile}, $deptype;
                                                next;