aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2020-04-08 14:51:53 +0200
committerDaniel Stenberg <daniel@haxx.se>2020-04-08 14:54:20 +0200
commit3f704083bf8417ceedc478f40bbea34bf60bdb36 (patch)
treeff53377efaf32284f499c4dd5d75d2981b7f8cb0 /scripts
parent6435aaa70b646faf60047261fa4ed7fa86747612 (diff)
release-notes: fix the initial reference list output
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/release-notes.pl39
1 files changed, 20 insertions, 19 deletions
diff --git a/scripts/release-notes.pl b/scripts/release-notes.pl
index df97ba9ef..83ff4d75f 100755
--- a/scripts/release-notes.pl
+++ b/scripts/release-notes.pl
@@ -29,10 +29,10 @@
#
# $ ./scripts/release-notes.pl
#
-# 2. Edit RELEASE-NOTES and *remove* entries among the newly added ones that
-# don't belong. Don't mind leaving unused references below. Make sure to move
-# "changes" up to the changes section. All new ones will by default be listed
-# under bug-fixes as the script can't know where to put them.
+# 2. Edit RELEASE-NOTES and remove all entries that don't belong. Unused
+# references below will be cleaned up in the next step. Make sure to move
+# "changes" up to the changes section. All entries will by default be listed
+# 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
# 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 @releasenotes=`cat RELEASE-NOTES`;
-my $refnum; # the highest number used so far
-my @refused;
-
-my @o;
-my @usedrefs;
+my @o; # the entire new RELEASE-NOTES
+my @refused; # [num] = [2 bits of use info]
+my @refs; # [number] = [URL]
for my $l (@releasenotes) {
if($l =~ /^ o .*\[(\d+)\]/) {
+ # referenced, set bit 0
$refused[$1]=1;
}
elsif($l =~ /^ \[(\d+)\] = (.*)/) {
+ # listed in a refernce, set bit 1
$refused[$1] |= 2;
- $refnum=$1;
- $usedrefs[$1] = $2;
+ $refs[$1] = $2;
}
}
+# Return a new fresh reference number
sub getref {
- for my $r (1 .. $refnum) {
+ for my $r (1 .. $#refs) {
if(!$refused[$r] & 1) {
return $r;
}
}
# add at the end
- return ++$refnum;
+ return $#refs + 1;
}
my $short;
@@ -170,9 +170,6 @@ for my $l (@releasenotes) {
push @bullets, $l;
next;
}
- elsif($l =~ /^ \[(\d+)\] = /) {
- next;
- }
elsif($bullets[0]) {
# output them case insensitively
for my $b (sort { "\L$a" cmp "\L$b" } @bullets) {
@@ -182,6 +179,10 @@ for my $l (@releasenotes) {
}
push @o, $l;
}
+ elsif($l =~ /^ \[(\d+)\] = /) {
+ # stop now
+ last;
+ }
else {
push @o, $l;
}
@@ -189,8 +190,8 @@ for my $l (@releasenotes) {
my @srefs;
my $ln;
-for my $n (1 .. $#usedrefs) {
- my $r = $usedrefs[$n];
+for my $n (1 .. $#refs) {
+ my $r = $refs[$n];
if($r && ($refused[$n] & 1)) {
push @o, sprintf " [%d] = %s\n", $n, $r;
}
@@ -205,7 +206,7 @@ close(O);
exit;
# Debug: show unused references
-for my $r (1 .. ($refnum - 1)) {
+for my $r (1 .. $#refs) {
if($refused[$r] != 3) {
printf "$r is %d!\n", $refused[$r];
}