From: Frank Lichtenheld Date: Mon, 18 Jun 2007 17:14:14 +0000 (+0200) Subject: parse-packages: Move tag parsing code here X-Git-Url: https://git.deb.at/w?a=commitdiff_plain;h=d02a2656068707e6928642c632f553c8c8770ea9;p=deb%2Fpackages.git parse-packages: Move tag parsing code here To be able to use the tags more flexibly, expand the compressed format earlier, i.e. move this code from Packages::DoShow to parse-packages. --- diff --git a/bin/parse-packages b/bin/parse-packages index 1536b81..64a00cd 100755 --- a/bin/parse-packages +++ b/bin/parse-packages @@ -107,6 +107,25 @@ for my $suite (@SUITES) { $src =~ s/\s+.*//o; # strip version info } $data{'source'} = $src; + + # expand tags like devel::{lang:c,lang:c++} + if ($data{'tag'} && $data{'tag'} =~ /\{/) { + my @complete_tags = split(/, /, $data{'tag'}); + my @tags; + foreach (@complete_tags) { + my ($facet, $tag) = split( /::/, $_, 2); + if ($tag =~ s/^\{(.+)\}$/$1/) { + foreach (split( /,/, $tag )) { + push @tags, "${facet}::$_"; + } + } else { + push @tags, "${facet}::$tag"; + } + } + my $old = $data{tag}; + $data{'tag'} = join ", ", @tags; + } + # we add some additional data here my $descr = "$data{'description'}\000$data{'package'}\000" .($data{'tag'}||''); diff --git a/lib/Packages/DoShow.pm b/lib/Packages/DoShow.pm index f808f1f..e47ec6b 100644 --- a/lib/Packages/DoShow.pm +++ b/lib/Packages/DoShow.pm @@ -126,16 +126,9 @@ sub do_show { my @tags; foreach (@complete_tags) { my ($facet, $tag) = split( /::/, $_, 2); - # handle tags like devel::{lang:c,lang:c++} - if ($tag =~ s/^\{(.+)\}$/$1/) { - foreach (split( /,/, $tag )) { - next if $tag =~ /^special:/; - push @tags, [ $facet, $_ ]; - } - } else { - next if $tag =~ /^special:/; - push @tags, [ $facet, $tag ]; - } + next if $facet =~ /^special/; + next if $tag =~ /^special:/; + push @tags, [ $facet, $tag ]; } $contents{tags} = \@tags;