#!/usr/bin/perl # You *must* run this from the i386/RedHat/base directory! # Directory containing workgroup directories relative to # the current directory $WorkgroupsDir = "../../Fermi/workgroups"; # The main input file, relative to the current directory $MainCompsFile = "comps"; # The individual Workgroup comps files, relative to the # $WorkgroupsDir/WORKGROUPNAME/ directory $WorkgroupCompsFile = "default.rpm.list"; $InBase = 1; $InWorkgroup = 0; open (IN, "$MainCompsFile") or die "Can't open input file: $MainCompsFile\n"; while ($ThisLine = ) { if ($InBase) { if ($ThisLine =~ /# Workgroup-specific groups follow/) { $InBase = 0; } } else { if ( ($Workgroup) = ($ThisLine =~ /^0 --hide (.+)$/) ) { print "Creating file for $Workgroup... "; open (OUT, ">$WorkgroupsDir/$Workgroup/$WorkgroupCompsFile") or die "Can't open output file: $WorkgroupsDir/$Workgroup/$WorkgroupCompsFile\n"; $InWorkgroup = 1; } elsif ($ThisLine =~ /^end$/) { close (OUT); $InWorkgroup = 0; print "Done.\n"; } elsif ($InWorkgroup) { print OUT $ThisLine; } } } close (IN);