Code Search for Developers
 
 
  

pat2bundles.pl from LinuxCOE at Krugle


Show pat2bundles.pl syntax highlighted

#!/usr/bin/perl -w

##
# File:         pat2bundles.pl
# Description:  filter to generate html/bundles file from SuSE .pat
# Author:       Bryan Gartner   < bryan.gartner@hp.com >
#               inspired by Lee Mayes's readsusepat.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 ".pat" pattern 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/*.pat | ./pat2bundles.pl >> @prefix@/html/bundles/<distro>-<version>.html



%patterns = ();
my $package;

while (<>) {

    # snag pattern name
    if( /^=Pat:\s+(.*)\s+.*/ ) {
        (undef, $pattern, undef) = split();
        next;
    }

    # look for Prq markers
    if( /^\+Prq:$/ ) {
        $found_prq = $pattern;
        next;
    } elsif( /^\-Prq:$/ ) {
        undef( $found_prq );
    }

    # look for Prc markers
    if( /^\+Prc:$/ ) {
        $found_prc = $pattern;
        next;
    } elsif( /^\-Prc:$/ ) {
        undef( $found_prc );
    }

    # look for Rec markers
    if( /^\+Rec:$/ ) {
        $found_rec = $pattern;
        next;
    } elsif( /^\-Rec:$/ ) {
        undef( $found_rec );
    }


    # grab content between markers
    if( defined( $found_prq ) || defined( $found_prc ) ) {
        chomp;
        push( @{$patterns{$pattern}}, $_ );
    } elsif( defined( $found_rec ) ) {
        chomp;
        push( @{$patterns{$pattern}}, "<A HREF=\"\#$_\">$_</A>" );
    }

}

# generate simple HTML fragment
print "<DL>\n";
foreach $pattern (sort keys %patterns) {
    print STDERR "$pattern\n";
    print " <br>\n <DT><A NAME=\"$pattern\"><b>$pattern</b></A></DT>\n";
    foreach $package (sort @{$patterns{$pattern}}) {
        print "  <DD>$package</DD>\n";
    }
}
print "</DL>\n";




See more files for this project here

LinuxCOE

The Linux Common Operating Environment (LinuxCOE) facilitates provisioning and lifecycle support of many popular Linux distributions, versions and architectures.

Project homepage: http://sourceforge.net/projects/linuxcoe
Programming language(s): JavaScript,Perl,Shell Script
License: gpl2

  Makefile.am
  Makefile.in
  comps2bundles.pl
  compsxml2bundles.pl
  make-images
  packages2bundles.pl
  pat2bundles.pl
  post-actions.in
  replay.pl
  sel2bundles.pl