1
0
mirror of https://github.com/moparisthebest/curl synced 2024-08-13 17:03:50 -04:00

release-notes: fix the initial reference list output

This commit is contained in:
Daniel Stenberg 2020-04-08 14:51:53 +02:00
parent 6435aaa70b
commit 3f704083bf
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

@ -29,10 +29,10 @@
# #
# $ ./scripts/release-notes.pl # $ ./scripts/release-notes.pl
# #
# 2. Edit RELEASE-NOTES and *remove* entries among the newly added ones that # 2. Edit RELEASE-NOTES and remove all entries that don't belong. Unused
# don't belong. Don't mind leaving unused references below. Make sure to move # references below will be cleaned up in the next step. Make sure to move
# "changes" up to the changes section. All new ones will by default be listed # "changes" up to the changes section. All entries will by default be listed
# under bug-fixes as the script can't know where to put them. # under bug-fixes as this script can't know where to put them.
# #
# 3. Run the cleanup script and let it sort the entries and remove unused # 3. Run the cleanup script and let it sort the entries and remove unused
# references from lines you removed in step (2): # references from lines you removed in step (2):
@ -56,30 +56,30 @@ my $cleanup = ($ARGV[0] eq "cleanup");
my @gitlog=`git log @^{/RELEASE-NOTES:.synced}..` if(!$cleanup); my @gitlog=`git log @^{/RELEASE-NOTES:.synced}..` if(!$cleanup);
my @releasenotes=`cat RELEASE-NOTES`; my @releasenotes=`cat RELEASE-NOTES`;
my $refnum; # the highest number used so far my @o; # the entire new RELEASE-NOTES
my @refused; my @refused; # [num] = [2 bits of use info]
my @refs; # [number] = [URL]
my @o;
my @usedrefs;
for my $l (@releasenotes) { for my $l (@releasenotes) {
if($l =~ /^ o .*\[(\d+)\]/) { if($l =~ /^ o .*\[(\d+)\]/) {
# referenced, set bit 0
$refused[$1]=1; $refused[$1]=1;
} }
elsif($l =~ /^ \[(\d+)\] = (.*)/) { elsif($l =~ /^ \[(\d+)\] = (.*)/) {
# listed in a refernce, set bit 1
$refused[$1] |= 2; $refused[$1] |= 2;
$refnum=$1; $refs[$1] = $2;
$usedrefs[$1] = $2;
} }
} }
# Return a new fresh reference number
sub getref { sub getref {
for my $r (1 .. $refnum) { for my $r (1 .. $#refs) {
if(!$refused[$r] & 1) { if(!$refused[$r] & 1) {
return $r; return $r;
} }
} }
# add at the end # add at the end
return ++$refnum; return $#refs + 1;
} }
my $short; my $short;
@ -170,9 +170,6 @@ for my $l (@releasenotes) {
push @bullets, $l; push @bullets, $l;
next; next;
} }
elsif($l =~ /^ \[(\d+)\] = /) {
next;
}
elsif($bullets[0]) { elsif($bullets[0]) {
# output them case insensitively # output them case insensitively
for my $b (sort { "\L$a" cmp "\L$b" } @bullets) { for my $b (sort { "\L$a" cmp "\L$b" } @bullets) {
@ -182,6 +179,10 @@ for my $l (@releasenotes) {
} }
push @o, $l; push @o, $l;
} }
elsif($l =~ /^ \[(\d+)\] = /) {
# stop now
last;
}
else { else {
push @o, $l; push @o, $l;
} }
@ -189,8 +190,8 @@ for my $l (@releasenotes) {
my @srefs; my @srefs;
my $ln; my $ln;
for my $n (1 .. $#usedrefs) { for my $n (1 .. $#refs) {
my $r = $usedrefs[$n]; my $r = $refs[$n];
if($r && ($refused[$n] & 1)) { if($r && ($refused[$n] & 1)) {
push @o, sprintf " [%d] = %s\n", $n, $r; push @o, sprintf " [%d] = %s\n", $n, $r;
} }
@ -205,7 +206,7 @@ close(O);
exit; exit;
# Debug: show unused references # Debug: show unused references
for my $r (1 .. ($refnum - 1)) { for my $r (1 .. $#refs) {
if($refused[$r] != 3) { if($refused[$r] != 3) {
printf "$r is %d!\n", $refused[$r]; printf "$r is %d!\n", $refused[$r];
} }