diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2015-01-06 09:36:00 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2015-01-06 09:37:28 +0200 |
commit | d2964dda42f601c514d3e822dc5efd75ef456a40 (patch) | |
tree | 5512e76e96b1b2e009f6beeefc2ba3a323a7e2d1 | |
parent | a42a0428deade09f9ac9755f9596ccf08f34dfc4 (diff) | |
download | ellinika-d2964dda42f601c514d3e822dc5efd75ef456a40.tar.gz ellinika-d2964dda42f601c514d3e822dc5efd75ef456a40.tar.bz2 |
Build ChangeLog.
* Makefile.am (ChangeLog): New goal.
* git2chg.awk: New file (from grecs).
-rw-r--r-- | Makefile.am | 10 | ||||
-rw-r--r-- | git2chg.awk | 82 |
2 files changed, 91 insertions, 1 deletions
diff --git a/Makefile.am b/Makefile.am index 2c075fc..2e4dd7e 100644 --- a/Makefile.am +++ b/Makefile.am | |||
@@ -1,5 +1,5 @@ | |||
1 | # This file is part of Ellinika project. | 1 | # This file is part of Ellinika project. |
2 | # Copyright (C) 2004, 2007, 2008, 2010 Sergey Poznyakoff | 2 | # Copyright (C) 2004, 2007, 2008, 2010, 2015 Sergey Poznyakoff |
3 | # | 3 | # |
4 | # Ellinika is free software; you can redistribute it and/or modify | 4 | # Ellinika is free software; you can redistribute it and/or modify |
5 | # it under the terms of the GNU General Public License as published by | 5 | # it under the terms of the GNU General Public License as published by |
@@ -48,3 +48,11 @@ install-html: | |||
48 | done | 48 | done |
49 | 49 | ||
50 | install-data-local: install-html | 50 | install-data-local: install-html |
51 | |||
52 | .PHONY: ChangeLog | ||
53 | ChangeLog: | ||
54 | $(AM_V_GEN)if test -d .git; then \ | ||
55 | git log --pretty='format:%ct %an <%ae>%n%n%s%n%n%b%n' | \ | ||
56 | awk -f $(top_srcdir)/git2chg.awk \ | ||
57 | -v append=$(top_srcdir)/ChangeLog.svn > ChangeLog; \ | ||
58 | fi | ||
diff --git a/git2chg.awk b/git2chg.awk new file mode 100644 index 0000000..76881b5 --- /dev/null +++ b/git2chg.awk | |||
@@ -0,0 +1,82 @@ | |||
1 | # This file is part of grecs | ||
2 | # Copyright (C) 2007, 2009-2015 Sergey Poznyakoff | ||
3 | # | ||
4 | # Grecs is free software; you can redistribute it and/or modify | ||
5 | # it under the terms of the GNU General Public License as published by | ||
6 | # the Free Software Foundation; either version 3, or (at your option) | ||
7 | # any later version. | ||
8 | # | ||
9 | # Grecs is distributed in the hope that it will be useful, | ||
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | # GNU General Public License for more details. | ||
13 | # | ||
14 | # You should have received a copy of the GNU General Public License | ||
15 | # along with Grecs. If not, see <http://www.gnu.org/licenses/>. | ||
16 | |||
17 | BEGIN { | ||
18 | if (since) | ||
19 | split(since,since_a,"-") | ||
20 | } | ||
21 | |||
22 | function timeok(t, a) { | ||
23 | if (!since) | ||
24 | return 1 | ||
25 | split(t,a,"-") | ||
26 | if (a[1] < since_a[1]) | ||
27 | return 0 | ||
28 | if (a[1] > since_a[1]) | ||
29 | return 1 | ||
30 | if (a[2] < since_a[2]) | ||
31 | return 0 | ||
32 | if (a[2] > since_a[2]) | ||
33 | return 1 | ||
34 | return a[3] > since_a[3] | ||
35 | } | ||
36 | |||
37 | /^[0-9]+ .* +<[^>]+>/ { | ||
38 | s = strftime("%F", $1) | ||
39 | if (!timeok(s)) | ||
40 | exit | ||
41 | sub(/^[0-9]+ +/,"") | ||
42 | if (s == datestr && author == $0) | ||
43 | next | ||
44 | datestr = s | ||
45 | author = $0 | ||
46 | if (runlen) { runlen = 0; print "" } | ||
47 | printf("%s %s\n", datestr, author) | ||
48 | next | ||
49 | } | ||
50 | /^Signed-off-by:/ { next } | ||
51 | /^<unknown>$/ { next } | ||
52 | NF==0 { | ||
53 | runlen++ | ||
54 | next | ||
55 | } | ||
56 | { if (runlen) { runlen = 0; print "" } | ||
57 | print "\t" $0 } | ||
58 | |||
59 | END { | ||
60 | if (append) { | ||
61 | print "" | ||
62 | init = 1 | ||
63 | while ((getline < append) > 0) { | ||
64 | if (init) { | ||
65 | if (match($0, /^#/)) | ||
66 | continue; | ||
67 | else | ||
68 | init = 0 | ||
69 | } | ||
70 | if (match($0, /^Local *Variables:/)) | ||
71 | break | ||
72 | |||
73 | } | ||
74 | } | ||
75 | print "\f" | ||
76 | # Make sure Emacs won't recognize this line: | ||
77 | print "Local", "Variables:" | ||
78 | print "mode: change-log" | ||
79 | print "version-control: never" | ||
80 | print "buffer-read-only: t" | ||
81 | print "End:" | ||
82 | } | ||