From: Jim Meyering Date: Tue, 25 Feb 2003 19:13:08 +0000 (+0000) Subject: (print_changelog_deltas): New function. X-Git-Tag: COREUTILS-4_5_9~120 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8708902315ef326ad967ca332f86c500ad960ee9;p=platform%2Fupstream%2Fcoreutils.git (print_changelog_deltas): New function. (main): Use it. --- diff --git a/announce-gen b/announce-gen index a98fdff84..b08d3a2b9 100755 --- a/announce-gen +++ b/announce-gen @@ -6,7 +6,7 @@ use Getopt::Long; use Digest::MD5; use Digest::SHA1; -(my $VERSION = '$Revision: 1.10 $ ') =~ tr/[0-9].//cd; +(my $VERSION = '$Revision: 1.11 $ ') =~ tr/[0-9].//cd; (my $ME = $0) =~ s|.*/||; my %valid_release_types = map {$_ => 1} qw (alpha beta major); @@ -46,6 +46,7 @@ sub usage ($) } else { + my @types = sort keys %valid_release_types; print $STREAM < sub {$_ eq 'ChangeLog' && -d 'CVS' + and push @changelog, $File::Find::name}}, + '.'); + + # If there are no ChangeLog files, we're done. + @changelog + or return; + my %changelog = map {$_ => 1} @changelog; + + # Reorder the list of files so that if there are ChangeLog + # files in the specified directories, they're listed first, + # in this order: + my @dir = qw ( . src lib m4 config doc ); + + # A typical @changelog array might look like this: + # ./ChangeLog + # ./po/ChangeLog + # ./m4/ChangeLog + # ./lib/ChangeLog + # ./doc/ChangeLog + # ./config/ChangeLog + my @reordered; + foreach my $d (@dir) + { + my $dot_slash = $d eq '.' ? $d : "./$d"; + my $target = "$dot_slash/ChangeLog"; + delete $changelog{$target} + and push @reordered, $target; + } + + # Append any remaining ChangeLog files. + push @reordered, sort keys %changelog; + + # Remove leading `./'. + @reordered = map { s!^\./!!; $_ } @reordered; + + print "ChangeLog entries:\n"; + # print join ("\n", @reordered), "\n"; + + $prev_version =~ s/\./_/g; + my $prev_cvs_tag = "\U$package_name\E-$prev_version"; + + my $cmd = "cvs -n diff -u -r$prev_cvs_tag -rHEAD @reordered"; + open DIFF, '-|', $cmd + or die "$ME: cannot run `$cmd': $!\n"; + # Print two types of lines, making minor changes: + # Lines starting with `+++ ', e.g., + # +++ ChangeLog 22 Feb 2003 16:52:51 -0000 1.247 + # and those starting with `+'. + # Don't print the others. + while (defined (my $line = )) + { + if ($line =~ /^\+\+\+ /) + { + my $separator = "*"x70 ."\n"; + $line =~ s///; + $line =~ s/\s.*//; + print $separator, $line, $separator; + } + elsif ($line =~ /^\+/) + { + $line =~ s///; + print $line; + } + } + close DIFF; + + # The exit code should be 1. + # Allow in case there are no modified ChangeLog entries. + $? == 256 || $? == 128 + or warn "$ME: warning: `cmd' had unexpected exit code or signal ($?)\n"; +} + { my $release_type; my $package_name; @@ -236,11 +319,8 @@ EOF or die "$ME: $news_file: no matching lines\n"; } - # FIXME: Print ChangeLog entries only for test releases - # echo ChangeLog entries:; - # find . -name ChangeLog -maxdepth 2 - # | xargs $(CVS) diff -up -r$(prev-cvs-tag) -rHEAD - # | sed -n 's/^+//p' - # | perl -ne 'm!^\+\+ (\./)?! or print,next;' - # -e 'print "\n"."*"x70 ."\n"; s///; print; print "*"x70 ."\n"'; + $release_type eq 'major' + or print_changelog_deltas ($package_name, $prev_version); + + exit 0; }