#!/usr/bin/perl ############################################################################### # # # Name : clean_cvs_log # # Author : Chris Koeritz # # Rights : Copyright (C) 2001-$now by Author # # # # Purpose: # # # # Takes a log file from checking out cvs and tosses out all the BS. # # # ############################################################################### # 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. See: "http://www.gruntose.com/Info/GNU/GPL.txt" for a # # version of the License. Please send any updates to "fred@gruntose.com". # ############################################################################### require "filename_helper.pl"; #require "importenv.pl"; #require "inc_num.pl"; if ($#ARGV < 0) { &print_instructions; exit 1; } foreach $name (@ARGV) { &process_file($name); } exit 0; ############################################################################ sub test_build_items { local($pattern, $n) = @_; if ($n =~ /$pattern.logs$/i) { return 1; } # if ($n =~ /$pattern.dll$/i) { return 1; } # if ($n =~ /$pattern.exe$/i) { return 1; } if ($n =~ /$pattern.fonts$/i) { return 1; } if ($n =~ /$pattern.include$/i) { return 1; } if ($n =~ /$pattern.install$/i) { return 1; } if ($n =~ /$pattern.lib$/i) { return 1; } if ($n =~ /$pattern.objects$/i) { return 1; } if ($n =~ /$pattern.pdb$/i) { return 1; } if ($n =~ /$pattern.tests$/i) { return 1; } return 0; } sub check_junk_file { local($n) = @_; #print "junk this? $n\n"; if (&test_build_items("hoople", $n)) { return 1; } if (&test_build_items("code_inova", $n)) { return 1; } if ($n =~ /^cvs server:/i) { return 1; } if ($n =~ /^? $USER\/\./i) { return 1; } if ($n =~ /app_src.i_act_mgr.i_act_mgr\.h$/i) { return 1; } if ($n =~ /lib_src.clients.dflst.L\.OUT$/i) { return 1; } if ($n =~ /lib_src.clients.dflst.lex_yy\.cpp$/i) { return 1; } if ($n =~ /lib_src.clients.dflst.LEX_YY\.HPP$/i) { return 1; } if ($n =~ /lib_src.clients.dflst.Y\.OUT$/i) { return 1; } if ($n =~ /lib_src.clients.dflst.ytab\.cpp$/i) { return 1; } if ($n =~ /lib_src.clients.dflst.YTAB\.HPP$/i) { return 1; } if ($n =~ /lib_src.clients.lightlink_messaging.lightlink_messaging\.h$/i) { return 1; } if ($n =~ /lib_src.clients.TLServer.TLServer\.h$/i) { return 1; } if ($n =~ /lib_src.datadir.datadirsrvps.datadirsrv\.h$/i) { return 1; } if ($n =~ /lib_src.datadir.datadirsrvps.datadirsrv_itfs\.h$/i) { return 1; } if ($n =~ /lib_src.firmware.exsupport.EXCommandServer.EXCommandServer\.h/i) { return 1; } if ($n =~ /lib_src.firmware.subsystems.llparse.lex_yy\.cpp$/i) { return 1; } if ($n =~ /lib_src.firmware.subsystems.llparse.LEX_YY\.HPP$/i) { return 1; } if ($n =~ /lib_src.firmware.subsystems.llparse.llparser\.cpp$/i) { return 1; } if ($n =~ /lib_src.firmware.subsystems.llparse.STATES\.OUT$/i) { return 1; } if ($n =~ /lib_src.firmware.subsystems.llparse.YTAB\.HPP$/i) { return 1; } if ($n =~ /lib_src.lightlink.address_list.address_list\.h$/i) { return 1; } if ($n =~ /lib_src.lightlink.address_list.address_list_itfs\.h$/i) { return 1; } if ($n =~ /lib_src.server.data_source.dsmxsrv.DSMXServer\.h$/i) { return 1; } if ($n =~ /lib_src.server.output_channel.ocmxsrv.OCMXServer\.h$/i) { return 1; } if ($n =~ /lib_src.server.output_channel.odms_lib.IEnableOCM\.h$/i) { return 1; } if ($n =~ /lib_src.server.output_channel.odms_lib.IKioskAudio\.h$/i) { return 1; } if ($n =~ /lib_src.server.output_channel.odms_lib.IKioskControl\.h$/i) { return 1; } if ($n =~ /lib_src.server.output_channel.odms_lib.i_odms\.h$/i) { return 1; } # not a bad name if we got to here. return 0; } ############################################################################ sub process_file { local($name)=@_; #print "got a filename of $name\n"; local($new_file)=""; open(FILEY, "<" . $name); foreach $content () { #print "got=$content\n"; local($len) = length($content); while (substr($content, $len - 1, 1) =~ /[\r\n]/) { chop($content); # remove line ending. $len = length($content); } $len = length($content); if (&important_filename($content) && ! &check_junk_file($content)) { #print "not junk! \"$content\"\n"; $new_file .= $content . "\n"; } else { #print "junk! \"$content\"\n"; } } close(FILEY); #print "after, the new file is $new_file\n"; open(FILEY, ">" . $name); print FILEY $new_file; close(FILEY); } #sed -e s/^.*_version.rc$//