]> Savannah Git Hosting - gnulib.git/commitdiff
gitlog-to-changelog: Revert 2024-04-12 fix and add documentation.
authorSimon Josefsson <simon@josefsson.org>
Mon, 15 Apr 2024 15:47:52 +0000 (17:47 +0200)
committerSimon Josefsson <simon@josefsson.org>
Mon, 15 Apr 2024 15:54:47 +0000 (17:54 +0200)
* build-aux/gitlog-to-changelog: Use localtime.
* doc/gitlog-to-changelog.texi: Add.
* doc/gnulib.texi (Build Infrastructure Modules): Add.

ChangeLog
build-aux/gitlog-to-changelog
doc/gitlog-to-changelog.texi [new file with mode: 0644]
doc/gnulib.texi

index 5b7b3a36fc9e4cb957c6e41ce2a3b2e09c7a3e32..2ab6e41ae22e35c5bfafb75bdbf7c0d530b3fe7f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2024-04-15  Simon Josefsson  <simon@josefsson.org>
+
+       gitlog-to-changelog: Revert 2024-04-12 fix and add documentation.
+       * build-aux/gitlog-to-changelog: Use localtime.
+       * doc/gitlog-to-changelog.texi: Add.
+       * doc/gnulib.texi (Build Infrastructure Modules): Add.
+
 2024-04-14  Collin Funk  <collin.funk1@gmail.com>
 
        gnulib-tool.py: Fix incorrect type hint.
index e06106490c6ac345e45c1a9040bb49cbcffd2593..16a9405a7cb50200ef5f830dbd61bf29d46178e5 100755 (executable)
@@ -35,7 +35,7 @@
 eval 'exec perl -wSx "$0" "$@"'
      if 0;
 
-my $VERSION = '2024-04-12 15:23'; # UTC
+my $VERSION = '2023-06-24 21:59'; # UTC
 # The definition above must lie within the first 8 lines in order
 # for the Emacs time-stamp write hook (at end) to update it.
 # If you change this file with Emacs, please let the write hook
@@ -360,7 +360,7 @@ sub git_dir_option($)
                   ? '  (tiny change)' : '');
 
       my $date_line = sprintf "%s  %s$tiny\n",
-        strftime ("%Y-%m-%d", gmtime ($1)), $2;
+        strftime ("%Y-%m-%d", localtime ($1)), $2;
 
       my @coauthors = grep /^Co-authored-by:.*$/, @line;
       # Omit meta-data lines we've already interpreted.
diff --git a/doc/gitlog-to-changelog.texi b/doc/gitlog-to-changelog.texi
new file mode 100644 (file)
index 0000000..137b15f
--- /dev/null
@@ -0,0 +1,81 @@
+@node gitlog-to-changelog
+@section gitlog-to-changelog
+
+@c Copyright (C) 2024 Free Software Foundation, Inc.
+
+@c Permission is granted to copy, distribute and/or modify this document
+@c under the terms of the GNU Free Documentation License, Version 1.3 or
+@c any later version published by the Free Software Foundation; with no
+@c Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.  A
+@c copy of the license is at <https://www.gnu.org/licenses/fdl-1.3.en.html>.
+
+@cindex gitlog
+@cindex changelog
+
+Gnulib have a module @code{gitlog-to-changelog} to parse @code{git log}
+output and generate @code{ChangeLog} files, see
+@ifinfo
+@ref{Change Logs,,,standards}.
+@end ifinfo
+@ifnotinfo
+@url{https://www.gnu.org/prep/standards/html_node/Change-Logs.html}.
+@end ifnotinfo
+
+You would typically use it by extending the @code{dist-hook} in the
+top-level @code{Makefile.am} like this:
+
+@example
+dist-hook: gen-ChangeLog
+...
+.PHONY: gen-ChangeLog
+gen-ChangeLog:
+        $(AM_V_GEN)if test -e .git; then                               \
+                $(top_srcdir)/build-aux/gitlog-to-changelog >          \
+                        $(distdir)/cl-t &&                             \
+                @{ rm -f $(distdir)/ChangeLog &&                        \
+                  mv $(distdir)/cl-t $(distdir)/ChangeLog; @}           \
+        fi
+@end example
+
+See @code{gitlog-to-changelog --help} for complete documentation.
+
+The tool prints timestamps using @code{localtime}, so its output may be
+different depending on what locale the developer that runs the tool is
+using.  If your project desire reproducible ChangeLog files that doesn't
+depend on locale settings, use something like the following.
+
+@example
+gen-ChangeLog:
+        $(AM_V_GEN)if test -e .git; then                               \
+                env LC_ALL=en_US.UTF-8 TZ=UTC=0                        \
+                        $(top_srcdir)/build-aux/gitlog-to-changelog >  \
+                        $(distdir)/cl-t &&                             \
+                @{ rm -f $(distdir)/ChangeLog &&                        \
+                  mv $(distdir)/cl-t $(distdir)/ChangeLog; @}           \
+        fi
+@end example
+
+
+If you wish to limit the ChangeLog entries (perhaps for size issues) to
+only contain entries since a particular git tag, use something like the
+following:
+
+@example
+dist-hook: gen-ChangeLog
+...
+gen_start_ver = 8.31
+.PHONY: gen-ChangeLog
+gen-ChangeLog:
+        $(AM_V_GEN)if test -e .git; then                               \
+          log_fix="$(srcdir)/build-aux/git-log-fix";                   \
+          test -e "$$log_fix"                                          \
+            && amend_git_log="--amend=$$log_fix"                       \
+            || amend_git_log=;                                         \
+          $(top_srcdir)/build-aux/gitlog-to-changelog $$amend_git_log  \
+            -- v$(gen_start_ver)~.. > $(distdir)/cl-t &&               \
+            @{ printf '\n\nSee the source repo for older entries\n'     \
+              >> $(distdir)/cl-t &&                                    \
+              rm -f $(distdir)/ChangeLog &&                            \
+              mv $(distdir)/cl-t $(distdir)/ChangeLog; @}               \
+        fi
+@end example
index 45bdf796627e416ddd610878019a72c2bde6d46b..ac8c01d1e172f3b8c3cd3a92a9b01f15bacd16c7 100644 (file)
@@ -7062,6 +7062,7 @@ for use with GNU Automake (in particular).
 * manywarnings::
 * Running self-tests under valgrind::
 * VCS To ChangeLog::
+* gitlog-to-changelog::
 @end menu
 
 @include havelib.texi
@@ -7080,6 +7081,8 @@ for use with GNU Automake (in particular).
 
 @include vcs-to-changelog.texi
 
+@include gitlog-to-changelog.texi
+
 
 @node Build Infrastructure Files
 @chapter Build Infrastructure Files