#!/usr/bin/perl -w # # Remove changelog from official mdv package and # prepare the comment for the commit use strict; use File::Copy; open(FILE, $ARGV[0]) || die "Unable to open $ARGV[0]"; open(OUT, "> $ENV{'MONDOTMP'}/out.spec") || die "Unable to create $ENV{'MONDOTMP'}/out.spec"; open(CMT, "> $ENV{'MONDOTMP'}/cmt.spec") || die "Unable to create $ENV{'MONDOTMP'}/out.spec"; while () { if ($_ !~ /^\%changelog/) { print OUT "$_"; } else { # We found %changelog, that's the end for the spec print OUT "$_"; close(OUT); # Next line is the date + ver => unneeded my $tmp = ; # Get the first changelog set into the comment for SVN while () { if ($_ !~ /^[ ]*$/) { print CMT "$_"; } else { # We found an empty line, that's the end for the cmt close (CMT); close (FILE); move("$ENV{'MONDOTMP'}/out.spec", $ARGV[0]); exit(0); } } } }