#!/bin/awk -f
# remove smp, BOOT, BOOTsmp entry from kernel.spec
#                                 by Jun Nishii <jun@vinelinux.org>
#
# $Id: parsespec,v 1.9 2001/02/20 14:33:02 sagami Exp $

BEGIN { status=0; fileflag=0;
#  NREV=ARGV[1];     delete ARGV[1];
#  SRPMNAME=ARGV[2]; delete ARGV[2];
#  DISTRIBUTION=ARGV[3]; delete ARGV[3];
#  PACKAGER=ARGV[4]; delete ARGV[4];
}

#$1 ~ /^Release/      { print "Release: " NREV; next }
#$1 ~ /^Vendor/       { print "Vendor: mkkpkg (" SRPMNAME ")"; next }
#$1 ~ /^Distribution/ { print "Distribution: " DISTRIBUTION; next }
#$1 ~ /^Packager/     { print "Packager: " PACKAGER; next}


$1 ~ /^%description/ || /^%package/ {
   if ( $2 != "smp" && $2 != "BOOT" && $2 != "BOOTsmp" ) {
	    status=0; print;
	} else {
	    status=1;
	}
	next;
}

$1 ~ /^%prep/{ status=0; print; next; }

$1 ~ /^BuildKernel/ || /^BuildiBCS/ || /^SaveHeaders/ || /^BuildPCMCIA/ || /^BuildALSA/ {
	if ( $3 != "smp" && $2 != "smp" && $2 != "BOOT" && $2 != "BOOTsmp" ) {
	    { print; }
	}
	next;
}

$1 ~ /^%if/ || /%endif/ || /%else/{ print; next; }

$1 ~ /^%pre/ || /^%preun/ || /^%post/ || /^%postun/ {
   if ( $2 != "smp" && $2 != "BOOT" && $2 != "BOOTsmp" ) {
	    status=0; print;
	} else {
	    status=1;
	}
	next;
}

$1 ~ /^%files/ {
	if ( $2 != "smp" && $2 != "BOOT" && $2 != "BOOTsmp" ) {
	  status=0; print;
	} else {
	  status=1;
	}
	next;
}

{ if ( status == 0 ) { print; }
}
