maint: generate full and correct ChangeLog.

* gnulib: Updated to pick up gitlog-to-changelog multi-author
support.
* gl/build-aux/gitlog-to-changelog.diff: Use gnulib-rejected
patch for '(tiny change)' support.
* Makefile.am (ChangeLog): Use gitlog-to-changelog --amend=F
option.
* libltdl/config/git-hooks/commit-msg: New commit message hook
for git.
* libltdl/config/git-log-fix: New file, with ChangeLog fixes.
* HACKING (Using git): Update.

Signed-off-by: Gary V. Vaughan <gary@gnu.org>
This commit is contained in:
Gary V. Vaughan 2011-11-17 12:26:39 +07:00
parent de4c35b810
commit 3e7c10eb67
6 changed files with 245 additions and 11 deletions

31
HACKING
View File

@ -92,15 +92,30 @@ and is not part of a release distribution.
5. Using git
============
* Preferably, let the git commit message mirror the ChangeLog entry,
without the leading TABs. Use --author for the (first, main) author
of patches from others, sign patches you have reviewed. If the
ChangeLog entry is longer than a line, use a one line summary, then an
empty line, then the rest of the log entry; this makes for nice output
of `git log'.
* ChangeLog is generated from git log messages, so you have to format
the git log carefully. Use --author for the (first, main) author
of changesets from others, and sign patches you have reviewed. If the
changeset has additional authors that need to be mentioned in the
generated ChangeLog, then add them to the git log message with:
* You may find it useful to install the git-merge-changelog merge driver:
<http://git.sv.gnu.org/gitweb/?p=gnulib.git;a=blob;f=lib/git-merge-changelog.c>
Co-authored-by: A U Thor <email@example.com>
Similarly, if the ChangeLog will need a '(tiny change)' annotation,
then you should indicate that in the git log message with:
Copyright-paperwork-exempt: Yes
Start the git log message with a short one line summary, then an empty
line, then the rest of the log entry.
If you forgot to annotate correctly in the git log message, or made
any other mistake that needs correcting in the distributed ChangeLog
file, make an amendment against the SHA1 of the errored commit in
$aux_dir/git-log-fix.
* You may find it useful to install the $aux_dir/git-hooks/commit-msg
script to .git/hooks in your libtool working directory to help you
make the best use of git log message metadata.
* Do not ever rewind the public master branch nor any public release
branch on savannah, neither any release tags once they have been

View File

@ -532,6 +532,7 @@ install-data-local: $(lt_Makefile_in)
edit_readme_alpha = $(srcdir)/$(aux_dir)/edit-readme-alpha
gitlog_to_changelog = $(srcdir)/$(aux_dir)/gitlog-to-changelog
git_log_fix = $(srcdir)/$(aux_dir)/git-log-fix
dotserial = $(distdir)/.serial
dotversion = $(srcdir)/.version
@ -543,8 +544,9 @@ changelog = $(distdir)/ChangeLog
# date is updated to the following year.
changelog_start_date = 2011-01-01
$(changelog): FORCE
$(AM_V_GEN)if test -d .git; then \
$(gitlog_to_changelog) --since=$(changelog_start_date) > '$@T'; \
$(AM_V_GEN)if test -d $(srcdir)/.git; then \
$(gitlog_to_changelog) --amend=$(git_log_fix) \
--since=$(changelog_start_date) > '$@T'; \
rm -f '$@'; mv '$@T' '$@'; \
fi

View File

@ -0,0 +1,26 @@
--- gnulib/build-aux/gitlog-to-changelog 2011-11-17 12:22:02.000000000 +0700
+++ gl/build-aux/gitlog-to-changelog 2011-11-17 12:19:01.000000000 +0700
@@ -251,6 +251,11 @@
my $date_line = sprintf "%s $2\n", strftime ("%F", localtime ($1));
+ # Format 'Copyright-paperwork-exempt: Yes' as a standard ChangeLog
+ # `(tiny change)' annotation.
+ my $tiny_change = grep /^Copyright-paperwork-exempt:\s+[Yy]es$/, @line;
+ $date_line =~ s/$/ (tiny change)/ if $tiny_change;
+
# Format 'Co-authored-by: A U Thor <email@example.com>' lines in
# standard multi-author ChangeLog format.
my @coauthors = grep /^Co-authored-by:.*$/, @line;
@@ -277,9 +282,10 @@
$prev_date_line = $date_line;
@prev_coauthors = @coauthors;
- # Omit "Co-authored-by..." and "Signed-off-by..." lines.
+ # Omit meta-data lines we've already interpreted.
@line = grep !/^Signed-off-by: .*>$/, @line;
@line = grep !/^Co-authored-by: /, @line;
+ @line = grep !/^Copyright-paperwork-exempt: /, @line;
# Remove leading and trailing blank lines.
if (@line)

2
gnulib

@ -1 +1 @@
Subproject commit fb6de052bace5b26346c1624b57d87326a97c7b6
Subproject commit f51babfaf400eb509f854cad509f5e649b9182b1

View File

@ -0,0 +1,111 @@
#!/bin/sh
# An example hook script for catching duplicate or malformed
# Co-authored-by or Copyright-paperwork-exempt lines in the
# commit message.
: ${SED="sed"}
test set = ${ECHO+'set'} = set || ECHO='printf %s\n'
basename="$SED -e "'s|^.*/||'
nl='
'
progpath="$0"
progname=`$ECHO "$progpath" |$basename`
log_file=$1
export log_file
fn_error ()
{
prefix="$progname: error: "
save_IFS=$IFS
IFS=$nl
for line in $*; do
IFS=$save_IFS
$ECHO "$prefix$line" 1>&2
prefix="$progname: "
done
IFS=$save_IFS
}
fn_re_edit ()
{
$ECHO 'Press return to edit. Ctrl-C to abort...' >&2
read v
${EDITOR-'vi'} "$log_file"
}
fn_rewrite ()
{
# Output once to stderr
fn_error "$*"
# And again as a comment in the log_file ready for re-editing
$ECHO "$*" |$SED 's,^,# ,'
echo
cat "$log_file"
}
fn_check_msg ()
{
return_status=0
CAB_re='^Co-authored-by: '
CPR_re='^Copyright-paperwork-exempt: '
# Flag duplicated Co-authored-by lines.
dups=`grep "$CAB_re" "$log_file" 2>/dev/null \
|sort |uniq -c |sed -e '/^[ ]*1[ ]/d'`
test -n "$dups" && {
$ECHO 'Duplicate Co-authored-by lines:
'"$dups"
return_status=1
}
# Make sure each Co-authored-by line contains a valid email.
email_re='<.*@.*\..*>'
grep "$CAB_re" "$log_file" 2>/dev/null \
|while read CAB; do
test 0 -eq `expr "$CAB" : ".*$email_re"` && {
echo "Malformed or missing email in \`$CAB'"
return_status=1
}
done
# Flag duplicated Copyright-paperwork-exempt lines.
count=`grep "$CPR_re" "$log_file" 2>/dev/null \
|wc |sed -e 's,^[ ]*,,;s,[ ].*$,,'`
test 2 -gt "$count" || {
$ECHO 'More than one Copyright-paperwork-exempt line.'
return_status=1
}
# Make sure Copyright-paperwork-exempt line is valid.
if grep "${CPR_re}[Nn]" "$log_file" >/dev/null 2>&1; then
$ECHO "\
\`Copyright-paperwork-exempt: No' is redundant, please remove."
return_status=1
else
not_yes=`grep "${CPR_re}" "$log_file" 2>/dev/null \
|grep -v "${CPR_re}Yes\$"`
test -n "$not_yes" && {
$ECHO "\`Copyright-paperwork-exempt' setting must be \`Yes'."
return_status=1
}
fi
return $return_status
}
while :; do
err=`fn_check_msg` && break
fn_rewrite "$err" > "${log_file}T" && mv "${log_file}T" "$log_file"
fn_re_edit
done

View File

@ -0,0 +1,80 @@
# This file is expected to be used via gitlog-to-changelog's --amend=FILE
# option. It specifies what changes to make to each given SHA1's commit
# log and metadata, using Perl-eval'able expressions.
a5ef08182ce0fb80b8adcff5872f190afd915908
# Date: Wed Nov 16 12:13:55 2011 +0700
# Fix a typo.
s,bootstraps,bootstrap's,
88224124e4f57166cdcc78be29730372762a147e
# Date: Tue Nov 15 16:44:15 2011 +0700
# Fix a typo.
s,todays,today's,
e8db92c345b99acd9c6984a321fc241ed1d01d23
# Date: Tue Nov 15 13:26:53 2011 +0700
# Email address of Reporters is in THANKS.
s,(Reported by .*?) *<.*>,$1.,
0fe4d0740effaec9d08ee9683fb493d8ad0bd8b5
# Date: Mon Oct 17 16:43:18 2011 +0700
# No empty lines in a single commit.
s,\n\n,\n,g;
# Fix a typo.
s,soure,source,
789817d512111d063981446efc7493ce87696bb3
# Date: Mon Oct 17 12:40:55 2011 +0700
# No empty lines in a single commit.
s,\n\n,\n,g
49ae2888b43cad358e2ff60a69722341116e7b40
# Date: Sun Oct 2 10:02:18 2011 -0500
# No leading tabs in git log message.
s,\n\t,\n,g
920da81be698974faa50bd36a60248e2c18c4fd5
# Date: Sun Sep 25 17:39:04 2011 -0500
# No leading tabs in git log message.
s,\n\t,\n,g;
# No empty lines in a single commit.
s,\n\n,\n,g
dc28c2bfbcb4879bc04a73186d72ec0e7ef2ad4c
# Date: Thu Sep 1 18:45:03 2011 -0500
# Typo in name.
s,Davd,David,
1ea9302bd1eadf25b466fcd7e8697e4bef111493
# Date: Sun Apr 10 10:17:21 2011 +0200
# Add back missing annotation:
s,$,\nCopyright-paperwork-exempt: Yes,
1b76054f4763a28ae1b01fbeee86ba0c524d1923
# Date: Mon Mar 14 08:40:50 2011 +0100
# Refill to 64 columns (72 in ChangeLog including leading \t):
s,to add all\nnecessary,to\nadd all necessary,;
s,support\. Currently,support.\nCurrently,;
s,filters\n,filters ,;
s,the case with,the\ncase with,;
s,This change\nhandles,This change handles,;
s,the situation for,the situation\nfor,;
s,thread\nsupport was,thread support\nwas,;
# Indent urls slightly:
s,\nhttp://,\n http://,g;
# No empty lines in a single commit:
s,\n\n,\n,g;
# Add back missing annotation, and co-author:
s,$,\nCopyright-paperwork-exempt: Yes,;
s,$,\nCo-authored-by: Rhys Ulerich <rhys.ulerich\@gmail.com>,;
e94c6d6e0359d92f08f491f57e0ef3371e978952
# Date: Thu Jan 20 19:35:14 2011 +0100
# Add back missing annotation:
s,$,\nCopyright-paperwork-exempt: Yes,
9167aecabd12c5afe7a65d45dc73f8c92ab42f05
# Date: Sun Jan 9 19:51:28 2011 +0100
# Add back missing annotation:
s,$,\nCopyright-paperwork-exempt: Yes,