5 our @EXPORT = qw(%package %srcpackage %category %subdir %preconfig clear_packages parse_package_metadata get_multiline);
20 $str .= (($_ and $prefix) ? $prefix . $_ : $_);
23 return $str ? $str : "";
26 sub clear_packages() {
34 sub parse_package_metadata($) {
42 open FILE, "<$file" or do {
43 warn "Cannot open '$file': $!\n";
48 /^Source-Makefile: \s*((.+\/)([^\/]+)\/Makefile)\s*$/ and do {
52 $subdir =~ s/^package\///;
53 $subdir{$src} = $subdir;
54 $srcpackage{$src} = [];
58 /^Package:\s*(.+?)\s*$/ and do {
61 $pkg->{makefile} = $makefile;
64 $pkg->{default} = "m if ALL";
66 $pkg->{builddepends} = [];
67 $pkg->{buildtypes} = [];
68 $pkg->{subdir} = $subdir;
71 push @{$srcpackage{$src}}, $pkg;
73 /^Version: \s*(.+)\s*$/ and $pkg->{version} = $1;
74 /^Title: \s*(.+)\s*$/ and $pkg->{title} = $1;
75 /^Menu: \s*(.+)\s*$/ and $pkg->{menu} = $1;
76 /^Submenu: \s*(.+)\s*$/ and $pkg->{submenu} = $1;
77 /^Submenu-Depends: \s*(.+)\s*$/ and $pkg->{submenudep} = $1;
78 /^Source: \s*(.+)\s*$/ and $pkg->{source} = $1;
79 /^Default: \s*(.+)\s*$/ and $pkg->{default} = $1;
80 /^Provides: \s*(.+)\s*$/ and do {
81 my @vpkg = split /\s+/, $1;
82 foreach my $vpkg (@vpkg) {
83 $package{$vpkg} or $package{$vpkg} = {
90 push @{$package{$vpkg}->{vdepends}}, $pkg->{name};
93 /^Depends: \s*(.+)\s*$/ and $pkg->{depends} = [ split /\s+/, $1 ];
94 /^Build-Only: \s*(.+)\s*$/ and $pkg->{buildonly} = 1;
95 /^Build-Depends: \s*(.+)\s*$/ and $pkg->{builddepends} = [ split /\s+/, $1 ];
96 /^Build-Depends\/(\w+): \s*(.+)\s*$/ and $pkg->{"builddepends/$1"} = [ split /\s+/, $2 ];
97 /^Build-Types:\s*(.+)\s*$/ and $pkg->{buildtypes} = [ split /\s+/, $1 ];
98 /^Category: \s*(.+)\s*$/ and do {
99 $pkg->{category} = $1;
100 defined $category{$1} or $category{$1} = {};
101 defined $category{$1}->{$src} or $category{$1}->{$src} = [];
102 push @{$category{$1}->{$src}}, $pkg;
104 /^Description: \s*(.*)\s*$/ and $pkg->{description} = "\t\t $1\n". get_multiline(*FILE, "\t\t ");
105 /^Type: \s*(.+)\s*$/ and do {
106 $pkg->{type} = [ split /\s+/, $1 ];
107 undef $pkg->{tristate};
108 foreach my $type (@{$pkg->{type}}) {
109 $type =~ /ipkg/ and $pkg->{tristate} = 1;
112 /^Config:\s*(.*)\s*$/ and $pkg->{config} = "$1\n".get_multiline(*FILE, "\t");
113 /^Prereq-Check:/ and $pkg->{prereq} = 1;
114 /^Preconfig:\s*(.+)\s*$/ and do {
115 my $pkgname = $pkg->{name};
116 $preconfig{$pkgname} or $preconfig{$pkgname} = {};
117 if (exists $preconfig{$pkgname}->{$1}) {
118 $preconfig = $preconfig{$pkgname}->{$1};
123 $preconfig{$pkgname}->{$1} = $preconfig;
126 /^Preconfig-Type:\s*(.*?)\s*$/ and $preconfig->{type} = $1;
127 /^Preconfig-Label:\s*(.*?)\s*$/ and $preconfig->{label} = $1;
128 /^Preconfig-Default:\s*(.*?)\s*$/ and $preconfig->{default} = $1;
This page took 0.073624 seconds and 5 git commands to generate.