Last change
on this file since 646 was 646, checked in by bcornec, 18 years ago |
Changelog reviewed once more
|
-
Property svn:executable
set to
*
|
File size:
1.8 KB
|
Rev | Line | |
---|
[636] | 1 | #!/usr/bin/perl -w
|
---|
| 2 | #
|
---|
| 3 | # Creates changelog for packages from Changelog files in the apps
|
---|
| 4 | #
|
---|
| 5 | # $Id$
|
---|
| 6 | #
|
---|
| 7 | # Syntax : mkchangelog dtype package-name output-file
|
---|
| 8 | #
|
---|
| 9 |
|
---|
| 10 | use strict;
|
---|
| 11 | use Date::Manip;
|
---|
| 12 |
|
---|
| 13 | my $log = "";
|
---|
| 14 | my $dtype = $ARGV[0];
|
---|
| 15 | my $pkg = $ARGV[1];
|
---|
| 16 | my $pkg2;
|
---|
| 17 | my $outfile = $ARGV[2];
|
---|
| 18 | my $TOOLHOME = $ENV{TOOLHOME};
|
---|
| 19 | my $chglog = "";
|
---|
| 20 | my $ndate = "";
|
---|
| 21 | my $tmp = "";
|
---|
| 22 | my $ver = "";
|
---|
| 23 | my $date = "";
|
---|
| 24 |
|
---|
| 25 | # For date handling
|
---|
| 26 | $ENV{LANG}="C";
|
---|
| 27 |
|
---|
| 28 | die "Syntax : mkchangelog dtype package-name output-file"
|
---|
| 29 | if ((not (defined $dtype)) || ($dtype eq "") ||
|
---|
| 30 | (not (defined $pkg)) || ($pkg eq "") ||
|
---|
| 31 | (not (defined $outfile)) || ($outfile eq ""));
|
---|
| 32 |
|
---|
[646] | 33 | die "TOOLHOME doesn't exist" if (not (defined $TOOLHOME));
|
---|
| 34 |
|
---|
[636] | 35 | if (-f "$TOOLHOME/../$pkg/ChangeLog") {
|
---|
| 36 | $chglog = "$TOOLHOME/../$pkg/ChangeLog";
|
---|
| 37 | }
|
---|
| 38 | else {
|
---|
| 39 | $pkg2 = $pkg;
|
---|
| 40 | $pkg2 =~ s/-..*//;
|
---|
| 41 | if (-f "$TOOLHOME/../$pkg2/ChangeLog") {
|
---|
| 42 | $chglog = "$TOOLHOME/../$pkg2/ChangeLog";
|
---|
| 43 | }
|
---|
| 44 | else {
|
---|
| 45 | die "Unable to find a ChangeLog file for $pkg\n";
|
---|
| 46 | }
|
---|
| 47 | }
|
---|
| 48 | print "Using $chglog as input ChangeLog file for $pkg\n";
|
---|
| 49 |
|
---|
| 50 | open(INPUT,"$chglog") || die "Unable to open $chglog (read)";
|
---|
| 51 | open(OUTPUT,"> $outfile") || die "Unable to open $outfile (write)";
|
---|
| 52 | # Skip first 4 lines
|
---|
| 53 | $tmp = <INPUT>;
|
---|
| 54 | $tmp = <INPUT>;
|
---|
| 55 | $tmp = <INPUT>;
|
---|
| 56 | $tmp = <INPUT>;
|
---|
| 57 |
|
---|
| 58 | # Handle each block separated by newline
|
---|
| 59 | while (<INPUT>) {
|
---|
| 60 | ($ver, $date) = split(/ /);
|
---|
| 61 | chomp($date);
|
---|
| 62 | $date =~ s/\(([0-9-]+)\)/$1/;
|
---|
[642] | 63 | #print "**$date**\n";
|
---|
[636] | 64 | $ndate = UnixDate($date,"%a", "%b", "%d", "%Y");
|
---|
[642] | 65 | #print "**$ndate**\n";
|
---|
[636] | 66 | if ($dtype eq "rpm") {
|
---|
[644] | 67 | print OUTPUT "* $ndate Bruno Cornec <bruno\@mondorescue.org> $ver\n";
|
---|
| 68 | print OUTPUT "- Updated to $ver\n";
|
---|
[636] | 69 |
|
---|
| 70 | $tmp = <INPUT>;
|
---|
| 71 | while ($tmp !~ /^$/) {
|
---|
[644] | 72 | print OUTPUT $tmp;
|
---|
[646] | 73 | last if (eof(INPUT));
|
---|
| 74 | $tmp = <INPUT>;
|
---|
[636] | 75 | }
|
---|
[644] | 76 | print OUTPUT "\n";
|
---|
[646] | 77 | last if (eof(INPUT));
|
---|
[636] | 78 | }
|
---|
| 79 | }
|
---|
| 80 | close(OUTPUT);
|
---|
| 81 | close(INPUT);
|
---|
Note:
See
TracBrowser
for help on using the repository browser.