Show sel2bundles.pl syntax highlighted
#!/usr/bin/perl
##
# File: sel2bundles.pl
# Description: filter to generate html/bundles file from SuSE .sel
# Author: Bryan Gartner < bryan.gartner@hp.com >
# inspired by Paul Telford's readsuse.pl
##
# © Copyright 2000-2007 Hewlett-Packard Development Company, L.P
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 675 Mass Ave, Cambridge, MA 02139, USA.
# This is a simple filter script:
# it reads SuSE-based distribution ".sel" selection content as standard input
# and generates:
# - simple HTML fragments on standard output
# - a bundle list on standard error
# typical usage is to
# cat suse/setup/descr/*.sel | ./sel2bundles.pl >> @prefix@/html/bundles/<distro>-<version>.html
%selections = ();
my $package;
while (<>) {
# snag selection name
if( /^=Sel:\s+(.*)\s+.*/ ) {
(undef, $selection, undef) = split();
next;
}
# look for Ins markers
if( /^\+Ins:$/ ) {
$found_ins = $selection;
next;
} elsif( /^\-Ins:$/ ) {
undef( $found_ins );
}
# grab content between markers
if( defined( $found_ins ) ) {
chomp;
push( @{$selections{$selection}}, $_ );
}
}
# generate simple HTML fragment
print "<DL>\n";
foreach $selection (sort keys %selections) {
print STDERR "$selection\n";
print " <br>\n <DT><A NAME=\"$selection\"><b>$selection</b></A></DT>\n";
foreach $package (sort @{$selections{$selection}}) {
print " <DD>$package</DD>\n";
}
}
print "</DL>\n";
See more files for this project here