Home | History | Annotate | Download | only in livemedia
      1   0  dave #
      2   0  dave # CDDL HEADER START
      3   0  dave #
      4   0  dave # The contents of this file are subject to the terms of the
      5   0  dave # Common Development and Distribution License (the "License").
      6   0  dave # You may not use this file except in compliance with the License.
      7   0  dave #
      8   0  dave # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
      9   0  dave # or http://www.opensolaris.org/os/licensing.
     10   0  dave # See the License for the specific language governing permissions
     11   0  dave # and limitations under the License.
     12   0  dave #
     13   0  dave # When distributing Covered Code, include this CDDL HEADER in each
     14   0  dave # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
     15   0  dave # If applicable, add the following below this CDDL HEADER, with the
     16   0  dave # fields enclosed by brackets "[]" replaced with your own identifying
     17   0  dave # information: Portions Copyright [yyyy] [name of copyright owner]
     18   0  dave #
     19   0  dave # CDDL HEADER END
     20   0  dave #
     21   0  dave 
     22   0  dave #
     23   0  dave # Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
     24   0  dave # Use is subject to license terms.
     25   0  dave #
     26   0  dave # ident	"%Z%%M%	%I%	%E% SMI"
     27   0  dave #
     28   0  dave my $cluster = $ARGV[0];
     29   0  dave my $wos = $ARGV[1];
     30  46  dave my $toc = "$wos/Solaris_11/Product/.clustertoc";
     31   0  dave my (@lines);
     32   0  dave my ($product_prefix) = "$wos/Solaris_11/Product";
     33   0  dave 
     34   0  dave #print "Processing $cluster from $wos\n";
     35   0  dave #print "Cluster TOC: $toc \n";
     36   0  dave 
     37   0  dave open(TOC, "<$toc") || die "Unable to open $toc";
     38   0  dave 
     39   0  dave while (my $line=<TOC>) {
     40   0  dave 	chomp($line);
     41   0  dave 	$lines[++$#lines] = $line;
     42   0  dave }
     43   0  dave close(TOC);
     44   0  dave 
     45   0  dave #print "Loaded TOC\n";
     46   0  dave 
     47   0  dave sub scan_depends($) {
     48   0  dave 	my ($name1) = shift(@_);
     49   0  dave 	my ($dcount) = 0;
     50   0  dave 
     51   0  dave 	if ( -e "$product_prefix/$name1/install/depend" ) {
     52   0  dave 		open(DEP, "<$product_prefix/$name1/install/depend") || die "Unable to open $product_prefix/$name1/install/depend";
     53   0  dave 		while ( my $dep=<DEP> ) {
     54   0  dave 			chomp($dep);
     55   0  dave 
     56   0  dave 			if ($dep =~ /^P/) {
     57   0  dave 				my ($d, $pkg) = split(/\s+/, $dep);
     58   0  dave 				$pkg =~ s/\s+//g;
     59   0  dave 				print "$name1 $pkg\n";
     60   0  dave 				$dcount++;
     61   0  dave 
     62   0  dave 			} elsif ($dep =~ /^R/) {
     63   0  dave 				my ($d, $pkg) = split(/\s+/, $dep);
     64   0  dave 				$pkg =~ s/\s+//g;
     65   0  dave 				print "$pkg $name1\n";
     66   0  dave 				$dcount++;
     67   0  dave 			}
     68   0  dave 		}
     69   0  dave 		close (DEP);
     70   0  dave 		if ($dcount == 0) {
     71   0  dave 			print "$name1 SUNWdummy\n";
     72   0  dave 		}
     73   0  dave 	} else {
     74   0  dave 		print "$name1 SUNWdummy\n";
     75   0  dave 	}
     76   0  dave }
     77   0  dave 
     78   0  dave sub scan_toc($) {
     79   0  dave 	my ($name) = @_;
     80   0  dave 	my ($state) = 1;
     81   0  dave 	my ($tag, $value);
     82   0  dave 
     83   0  dave 	for $line (@lines) {
     84   0  dave 		if ($state == 1) {
     85   0  dave 			# Searching for given cluster/metacluster name
     86   0  dave 			if ($line =~ /=$name$/) {
     87   0  dave 				($tag, $value) = split(/=/, $line);
     88   0  dave 				if ($tag eq "CLUSTER" || $tag eq "METACLUSTER") {
     89   0  dave 					$state = 2;
     90   0  dave 
     91   0  dave 				} elsif ($tag eq "SUNW_CSRMEMBER") {
     92   0  dave 					# Found a leaf package.
     93   0  dave 					# Print it along with partial dependencies.
     94   0  dave 					scan_depends($value);
     95   0  dave 					return;
     96   0  dave 
     97   0  dave 				} else {
     98   0  dave 					die "Invalid entry $line";	
     99   0  dave 				}
    100   0  dave 			}
    101   0  dave 		} elsif ($state == 2) {
    102   0  dave 			# Scanning for SUNW_CSRMEMBER entries in current cluster/metacluster
    103   0  dave 			if ($line =~ /^END/) {
    104   0  dave 				return;
    105   0  dave 
    106   0  dave 			} elsif ($line =~ /SUNW_CSRMEMBER=/) {
    107   0  dave 				($tag, $value) = split(/=/,$line);
    108   0  dave 				scan_toc($value);
    109   0  dave 			}
    110   0  dave 		}
    111   0  dave 	}
    112   0  dave }
    113   0  dave 
    114   0  dave #print "Dumping TOC\n";
    115   0  dave scan_toc($cluster);
    116   0  dave 
    117