]> git.deb.at Git - deb/packages.git/commitdiff
parse-packages: Move tag parsing code here
authorFrank Lichtenheld <frank@lichtenheld.de>
Mon, 18 Jun 2007 17:14:14 +0000 (19:14 +0200)
committerFrank Lichtenheld <frank@lichtenheld.de>
Mon, 18 Jun 2007 17:17:16 +0000 (19:17 +0200)
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.

bin/parse-packages
lib/Packages/DoShow.pm

index 1536b814e70760ec781b7cc129f89510cd51c15e..64a00cdf125d897e2d039f1746dffc94ab43f15b 100755 (executable)
@@ -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'}||'');
index f808f1f7e547b57ea5ac56e1837eafe55c77728f..e47ec6ba791a7d0d8bf3ebd92a8a1d1bf78f6222 100644 (file)
@@ -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;