5 our @EXPORT = qw(%package %srcpackage %category %subdir %preconfig %features clear_packages parse_package_metadata get_multiline);
20 $str .= (($_ and $prefix) ? $prefix . $_ : $_);
23 return $str ? $str : "";
26 sub clear_packages() {
35 sub parse_package_metadata($) {
44 open FILE, "<$file" or do {
45 warn "Cannot open '$file': $!\n";
50 /^Source-Makefile: \s*((.+\/)([^\/]+)\/Makefile)\s*$/ and do {
54 $subdir =~ s/^package\///;
55 $subdir{$src} = $subdir;
56 $srcpackage{$src} = [];
60 /^Package:\s*(.+?)\s*$/ and do {
64 $pkg->{makefile} = $makefile;
67 $pkg->{default} = "m if ALL";
69 $pkg->{mdepends} = [];
70 $pkg->{builddepends} = [];
71 $pkg->{buildtypes} = [];
72 $pkg->{subdir} = $subdir;
75 push @{$srcpackage{$src}}, $pkg;
77 /^Feature:\s*(.+?)\s*$/ and do {
80 $feature->{name} = $1;
81 $feature->{priority} = 0;
84 /^Target-Name:\s*(.+?)\s*$/ and do {
85 $features{$1} or $features{$1} = [];
86 push @{$features{$1}}, $feature;
88 /^Target-Title:\s*(.+?)\s*$/ and $feature->{target_title} = $1;
89 /^Feature-Priority:\s*(\d+)\s*$/ and $feature->{priority} = $1;
90 /^Feature-Name:\s*(.+?)\s*$/ and $feature->{title} = $1;
91 /^Feature-Description:/ and $feature->{description} = get_multiline(\*FILE, "\t\t\t");
95 /^Version: \s*(.+)\s*$/ and $pkg->{version} = $1;
96 /^Title: \s*(.+)\s*$/ and $pkg->{title} = $1;
97 /^Menu: \s*(.+)\s*$/ and $pkg->{menu} = $1;
98 /^Submenu: \s*(.+)\s*$/ and $pkg->{submenu} = $1;
99 /^Submenu-Depends: \s*(.+)\s*$/ and $pkg->{submenudep} = $1;
100 /^Source: \s*(.+)\s*$/ and $pkg->{source} = $1;
101 /^Default: \s*(.+)\s*$/ and $pkg->{default} = $1;
102 /^Provides: \s*(.+)\s*$/ and do {
103 my @vpkg = split /\s+/, $1;
104 foreach my $vpkg (@vpkg) {
105 $package{$vpkg} or $package{$vpkg} = {
110 makefile => $makefile
112 push @{$package{$vpkg}->{vdepends}}, $pkg->{name};
115 /^Menu-Depends: \s*(.+)\s*$/ and $pkg->{mdepends} = [ split /\s+/, $1 ];
116 /^Depends: \s*(.+)\s*$/ and $pkg->{depends} = [ split /\s+/, $1 ];
117 /^Build-Variant: \s*([\w\-]+)\s*/ and $pkg->{variant} = $1;
118 /^Build-Only: \s*(.+)\s*$/ and $pkg->{buildonly} = 1;
119 /^Build-Depends: \s*(.+)\s*$/ and $pkg->{builddepends} = [ split /\s+/, $1 ];
120 /^Build-Depends\/(\w+): \s*(.+)\s*$/ and $pkg->{"builddepends/$1"} = [ split /\s+/, $2 ];
121 /^Build-Types:\s*(.+)\s*$/ and $pkg->{buildtypes} = [ split /\s+/, $1 ];
122 /^Category: \s*(.+)\s*$/ and do {
123 $pkg->{category} = $1;
124 defined $category{$1} or $category{$1} = {};
125 defined $category{$1}->{$src} or $category{$1}->{$src} = [];
126 push @{$category{$1}->{$src}}, $pkg;
128 /^Description: \s*(.*)\s*$/ and $pkg->{description} = "\t\t $1\n". get_multiline(*FILE, "\t\t ");
129 /^Type: \s*(.+)\s*$/ and do {
130 $pkg->{type} = [ split /\s+/, $1 ];
131 undef $pkg->{tristate};
132 foreach my $type (@{$pkg->{type}}) {
133 $type =~ /ipkg/ and $pkg->{tristate} = 1;
136 /^Config:\s*(.*)\s*$/ and $pkg->{config} = "$1\n".get_multiline(*FILE, "\t");
137 /^Prereq-Check:/ and $pkg->{prereq} = 1;
138 /^Preconfig:\s*(.+)\s*$/ and do {
139 my $pkgname = $pkg->{name};
140 $preconfig{$pkgname} or $preconfig{$pkgname} = {};
141 if (exists $preconfig{$pkgname}->{$1}) {
142 $preconfig = $preconfig{$pkgname}->{$1};
147 $preconfig{$pkgname}->{$1} = $preconfig;
150 /^Preconfig-Type:\s*(.*?)\s*$/ and $preconfig->{type} = $1;
151 /^Preconfig-Label:\s*(.*?)\s*$/ and $preconfig->{label} = $1;
152 /^Preconfig-Default:\s*(.*?)\s*$/ and $preconfig->{default} = $1;
This page took 0.058213 seconds and 5 git commands to generate.