-sub parse_target_metadata() {
- my $file = shift @ARGV;
- my ($target, @target, $profile);
- open FILE, "<$file" or do {
- warn "Can't open file '$file': $!\n";
- return;
- };
- while (<FILE>) {
- chomp;
- /^Target:\s*(.+)\s*$/ and do {
- $target = {
- id => $1,
- conf => confstr($1),
- profiles => []
- };
- push @target, $target;
- };
- /^Target-Board:\s*(.+)\s*$/ and do {
- $target->{board} = $1;
- $target->{boardconf} = confstr($1);
- };
- /^Target-Kernel:\s*(\d+\.\d+)\s*$/ and $target->{kernel} = $1;
- /^Target-Name:\s*(.+)\s*$/ and $target->{name} = $1;
- /^Target-Path:\s*(.+)\s*$/ and $target->{path} = $1;
- /^Target-Arch:\s*(.+)\s*$/ and $target->{arch} = $1;
- /^Target-Features:\s*(.+)\s*$/ and $target->{features} = [ split(/\s+/, $1) ];
- /^Target-Description:/ and $target->{desc} = get_multiline(*FILE);
- /^Linux-Version:\s*(.+)\s*$/ and $target->{version} = $1;
- /^Linux-Release:\s*(.+)\s*$/ and $target->{release} = $1;
- /^Linux-Kernel-Arch:\s*(.+)\s*$/ and $target->{karch} = $1;
- /^Default-Packages:\s*(.+)\s*$/ and $target->{packages} = [ split(/\s+/, $1) ];
- /^Target-Profile:\s*(.+)\s*$/ and do {
- $profile = {
- id => $1,
- name => $1,
- packages => []
- };
- push @{$target->{profiles}}, $profile;
- };
- /^Target-Profile-Name:\s*(.+)\s*$/ and $profile->{name} = $1;
- /^Target-Profile-Packages:\s*(.*)\s*$/ and $profile->{packages} = [ split(/\s+/, $1) ];
- /^Target-Profile-Description:\s*(.*)\s*/ and $profile->{desc} = get_multiline(*FILE);
- /^Target-Profile-Config:/ and $profile->{config} = get_multiline(*FILE, "\t");
- /^Target-Profile-Kconfig:/ and $profile->{kconfig} = 1;
+ if (defined($str) && $str =~ /^\d+(?:\.\d+)+$/)
+ {
+ my @n = (split(/\./, $str), 0, 0, 0, 0);
+ $num = ($n[0] << 24) | ($n[1] << 16) | ($n[2] << 8) | $n[3];