scripts/feeds: properly handle virtual packages as well, use the first available...
[openwrt/svn-archive/archive.git] / scripts / metadata.pm
index f90446298af1841f741ed14caeacaa0078b45ded..fd18b18a29c039315f492cb938d392777f553071 100644 (file)
@@ -63,6 +63,7 @@ sub parse_package_metadata($) {
                        $pkg->{depends} = [];
                        $pkg->{builddepends} = [];
                        $pkg->{subdir} = $subdir;
                        $pkg->{depends} = [];
                        $pkg->{builddepends} = [];
                        $pkg->{subdir} = $subdir;
+                       $pkg->{tristate} = 1;
                        $package{$1} = $pkg;
                        push @{$srcpackage{$src}}, $pkg;
                };
                        $package{$1} = $pkg;
                        push @{$srcpackage{$src}}, $pkg;
                };
@@ -75,7 +76,13 @@ sub parse_package_metadata($) {
                /^Provides: \s*(.+)\s*$/ and do {
                        my @vpkg = split /\s+/, $1;
                        foreach my $vpkg (@vpkg) {
                /^Provides: \s*(.+)\s*$/ and do {
                        my @vpkg = split /\s+/, $1;
                        foreach my $vpkg (@vpkg) {
-                               $package{$vpkg} or $package{$vpkg} = { vdepends => [] };
+                               $package{$vpkg} or $package{$vpkg} = {
+                                       name => $vpkg,
+                                       vdepends => [],
+                                       src => $src,
+                                       subdir => $subdir,
+                                       makefile => $makefile
+                               };
                                push @{$package{$vpkg}->{vdepends}}, $pkg->{name};
                        }
                };
                                push @{$package{$vpkg}->{vdepends}}, $pkg->{name};
                        }
                };
@@ -88,7 +95,14 @@ sub parse_package_metadata($) {
                        push @{$category{$1}->{$src}}, $pkg;
                };
                /^Description: \s*(.*)\s*$/ and $pkg->{description} = "\t\t $1\n". get_multiline(*FILE, "\t\t ");
                        push @{$category{$1}->{$src}}, $pkg;
                };
                /^Description: \s*(.*)\s*$/ and $pkg->{description} = "\t\t $1\n". get_multiline(*FILE, "\t\t ");
-               /^Config: \s*(.*)\s*$/ and $pkg->{config} = "$1\n".get_multiline(*FILE);
+               /^Type: \s*(.+)\s*$/ and do {
+                       $pkg->{type} = [ split /\s+/, $1 ];
+                       undef $pkg->{tristate};
+                       foreach my $type (@{$pkg->{type}}) {
+                               $type =~ /ipkg/ and $pkg->{tristate} = 1;
+                       }
+               };
+               /^Config: \s*(.*)\s*$/ and $pkg->{config} = "$1\n".get_multiline(*FILE, "\t");
                /^Prereq-Check:/ and $pkg->{prereq} = 1;
                /^Preconfig:\s*(.+)\s*$/ and do {
                        my $pkgname = $pkg->{name};
                /^Prereq-Check:/ and $pkg->{prereq} = 1;
                /^Preconfig:\s*(.+)\s*$/ and do {
                        my $pkgname = $pkg->{name};
@@ -107,7 +121,7 @@ sub parse_package_metadata($) {
                /^Preconfig-Default:\s*(.*?)\s*$/ and $preconfig->{default} = $1;
        }
        close FILE;
                /^Preconfig-Default:\s*(.*?)\s*$/ and $preconfig->{default} = $1;
        }
        close FILE;
-       return %category;
+       return 1;
 }
 
 1;
 }
 
 1;