From cb050fe0c89945ca2a4eaa00488752d55db327fb Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Tue, 20 May 2008 20:26:24 +0200 Subject: [PATCH] Add a ChangeLog to the compiled Perl script --- .gitignore | 2 ++ Makefile | 15 +++++++++++---- dowkd.compile | 19 +++++++++++++++++++ dowkd.in | 6 +++++- 4 files changed, 37 insertions(+), 5 deletions(-) create mode 100644 dowkd.compile diff --git a/.gitignore b/.gitignore index e1a2135..664f75c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ +/ChangeLog /dowkd /dowkd.db +/dowkd.new /dowkd.blacklist* diff --git a/Makefile b/Makefile index b9a2a13..1e57a62 100644 --- a/Makefile +++ b/Makefile @@ -9,12 +9,10 @@ export LC_ALL=C all: dowkd -dowkd: dowkd.in dowkd.blacklist dowkd.blacklist.md5 force +dowkd: dowkd.in dowkd.blacklist dowkd.blacklist.md5 ChangeLog force -rm $@ 2> /dev/null || true perl -c dowkd.in - (sed -e s/@PROGRAM_VERSION@/$$(git describe)/ \ - -e s/@DB_VERSION@/$$(cat dowkd.blacklist.md5)/ < dowkd.in ; \ - cat dowkd.blacklist) > dowkd + bash dowkd.compile dowkd.blacklist: $(BLACKLIST_FILES) -rm $@ 2> /dev/null || true @@ -24,4 +22,13 @@ dowkd.blacklist.md5: dowkd.blacklist -rm $@ 2> /dev/null || true md5sum $^ | awk '{print $$1}' > $@ +# Generate the ChangeLog from the GIT metadata +ChangeLog : force + -rm $@ 2> /dev/null || true + git log --pretty=oneline | while read sha text ; do \ + t=$$(git describe "$$sha" --exact-match --match 'v[0-9]*' 2>/dev/null) ; \ + test -z "$$t" || echo "$$t" ; \ + echo " $$text" ; \ + done > $@ + force: diff --git a/dowkd.compile b/dowkd.compile new file mode 100644 index 0000000..ea3b635 --- /dev/null +++ b/dowkd.compile @@ -0,0 +1,19 @@ +#! /bin/bash + +set -e + +rm -f dowkd.new || true + +(sed -e s/@PROGRAM_VERSION@/$(git describe)/ \ + -e s/@DB_VERSION@/$(cat dowkd.blacklist.md5)/ \ + < dowkd.in | \ + sed -e '/^@CHANGELOG@$/{ +x +r ChangeLog +p +x +d +}' + cat dowkd.blacklist) > dowkd.new + +mv dowkd.new dowkd diff --git a/dowkd.in b/dowkd.in index 185168b..84915b1 100644 --- a/dowkd.in +++ b/dowkd.in @@ -70,6 +70,10 @@ use IO::Handle; my $db_version = '@DB_VERSION@'; my $program_version = '@PROGRAM_VERSION@'; +my $changelog = <<'EOF'; +ChangeLog: +@CHANGELOG@ +EOF my $db_file = 'dowkd.db'; @@ -450,7 +454,7 @@ if (@ARGV) { help; exit 0; } elsif ($cmd eq 'version') { - print "dowkd $program_version (database $db_version)\n"; + print "dowkd $program_version (database $db_version)\n\n$changelog"; exit 0; } else { die "error: invalid command, use \"help\" to get help\n"; -- 2.11.4.GIT