Home | History | Annotate | Line # | Download | only in mantools
make-relnotes revision 1.1.1.4
      1      1.1      tron #!/usr/bin/perl
      2      1.1      tron 
      3      1.1      tron # Transform RELEASE_NOTES, split into "leader", and "major changes",
      4      1.1      tron # split into major categories, and prepend dates to paragraphs.
      5      1.1      tron #
      6  1.1.1.3  christos # Input format: the leader text is copied verbatim; each section
      7  1.1.1.3  christos # starts with "Incompatible changes with snapshot YYYYMMDD" or "Major
      8  1.1.1.4  christos # changes with snapshot YYYYMMDD" underlined with "=======..."; each
      9  1.1.1.4  christos # paragraph starts with [class, class] where a class specifies one or
     10  1.1.1.4  christos # more categories that the change should be listed under. Adding class
     11  1.1.1.4  christos # info is the only manual processing needed to go from a RELEASE_NOTES
     12  1.1.1.4  christos # file to the transformed representation.
     13  1.1.1.3  christos #
     14  1.1.1.4  christos # Output format: each category is printed with a little header and each
     15  1.1.1.4  christos # paragraph is tagged with [Incompat yyyymmdd] or with [Feature yyyymmdd].
     16      1.1      tron 
     17      1.1      tron %leader = (); %body = ();
     18      1.1      tron $append_to = \%leader;
     19      1.1      tron 
     20      1.1      tron while (<>) {
     21      1.1      tron 
     22  1.1.1.2      tron     if (/^(Incompatible changes|Incompatibility) with/) {
     23      1.1      tron 	die "No date found: $_" unless /(\d\d\d\d\d\d\d\d)/;
     24      1.1      tron 	$append_to = \%body;
     25      1.1      tron 	$prefix = "[Incompat $1] ";
     26      1.1      tron 	while (<>) {
     27      1.1      tron 	    last if /^====/;
     28      1.1      tron 	}
     29      1.1      tron 	next;
     30      1.1      tron     }
     31      1.1      tron 
     32      1.1      tron     if (/^Major changes with/) {
     33      1.1      tron 	die "No date found: $_" unless /(\d\d\d\d\d\d\d\d)/;
     34      1.1      tron 	$append_to = \%body;
     35      1.1      tron 	$prefix = "[Feature $1] ";
     36      1.1      tron 	while (<>) {
     37      1.1      tron 	    last if /^====/;
     38      1.1      tron 	}
     39      1.1      tron 	next;
     40      1.1      tron     }
     41      1.1      tron 
     42      1.1      tron     if (/^\s*\n/) {
     43      1.1      tron 	if ($paragraph) {
     44      1.1      tron 	    for $class (@classes) {
     45      1.1      tron 		${$append_to}{$class} .= $paragraph . $_;
     46      1.1      tron 	    }
     47      1.1      tron 	    $paragraph = "";
     48      1.1      tron 	}
     49      1.1      tron     } else {
     50      1.1      tron 	if ($paragraph eq "") {
     51      1.1      tron 	    if ($append_to eq \%leader) {
     52      1.1      tron 		@classes = ("default");
     53      1.1      tron 		$paragraph = $_;
     54      1.1      tron 	    } elsif (/^\[([^]]+)\]\s*(.*)/s) {
     55      1.1      tron 		$paragraph = $prefix . $2;
     56      1.1      tron 		($junk = $1) =~ s/\s*,\s*/,/g;
     57      1.1      tron 		$junk =~ s/^\s+//;
     58      1.1      tron 		$junk =~ s/\s+$//;
     59      1.1      tron 		#print "junk >$junk<\n";
     60      1.1      tron 		@classes = split(/,+/, $junk);
     61      1.1      tron 		#print "[", join(', ', @classes), "] ", $paragraph;
     62      1.1      tron 	    } else {
     63      1.1      tron 		$paragraph = $_;
     64      1.1      tron 	    }
     65      1.1      tron 	} else {
     66      1.1      tron 	    $paragraph .= $_;
     67      1.1      tron 	}
     68      1.1      tron     }
     69      1.1      tron }
     70      1.1      tron 
     71      1.1      tron if ($paragraph) {
     72      1.1      tron     for $class (@classes) {
     73      1.1      tron 	${$append_to}{$class} .= $prefix . $paragraph . $_;
     74      1.1      tron     }
     75      1.1      tron }
     76      1.1      tron 
     77      1.1      tron print $leader{"default"}; 
     78      1.1      tron 
     79      1.1      tron for $class (sort keys %body) {
     80      1.1      tron     print "Major changes - $class\n";
     81      1.1      tron     ($junk = "Major changes - $class") =~ s/./-/g;
     82      1.1      tron     print $junk, "\n\n";
     83      1.1      tron     print $body{$class};
     84      1.1      tron }
     85