]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
Make all commands print git version and improve version string.
authorAndre Noll <maan@systemlinux.org>
Tue, 26 Mar 2013 23:30:49 +0000 (23:30 +0000)
committerAndre Noll <maan@systemlinux.org>
Thu, 13 Jun 2013 16:29:03 +0000 (18:29 +0200)
Currently the format of the first line of the help output varies
between executables, for example:

para_afh git (0.4.12.12.g15a4: spectral gravity)
para_audioc git

This difference comes from the fact that para_afh has its own
->print_help method which uses the VERSION_SINGLE_LINE macro of
version.h while para_audioc relies on gengetopt's help output.

The latter uses the make variable PACKAGE_VERSION which gets
initialized at configure time through the second argument in AC_INIT
of configure.ac. This value is either the version number for or the
string "git".

It's a good thing to have the abbreviated git version encoded in
all executables, so this commit changes the argument of gengetopt's
--set-version to the git version string including the codename. With
the patch applied, the output of all commands looks like this if
--version was given:

para_filter 0.4.12.12.g11d7 (spectral gravity)

To make sure things stay consistent, the patch introduces the
VERSION_SINGLE_LINE macro and changes all commands to use it instead
of open coding the version string.

audiod.c
filter.c
m4/gengetopt/makefile
play.c
recv.c
version.h
write.c

index e3e3bd9acd9b2ccd771fc359f4e57ae24dbe5cce..e0ca15ef8512376759099cfcd2cb83e5dda833e2 100644 (file)
--- a/audiod.c
+++ b/audiod.c
@@ -1305,8 +1305,7 @@ __noreturn static void print_help_and_die(void)
        const char **p = d? audiod_args_info_detailed_help
                : audiod_args_info_help;
 
-       printf_or_die("%s\n\n", AUDIOD_CMDLINE_PARSER_PACKAGE "-"
-               AUDIOD_CMDLINE_PARSER_VERSION);
+       printf_or_die("%s\n\n", VERSION_SINGLE_LINE("audiod"));
        printf_or_die("%s\n\n", audiod_args_info_usage);
        for (; *p; p++)
                printf_or_die("%s\n", *p);
index c6af586df8cc4451413749664dd45630856d9bfa..65d6c64be353aa10809e0e4fd6b639c61500c946 100644 (file)
--- a/filter.c
+++ b/filter.c
@@ -51,8 +51,7 @@ __noreturn static void print_help_and_die(void)
        const char **p = d? filter_args_info_detailed_help
                : filter_args_info_help;
 
-       printf_or_die("%s\n\n", FILTER_CMDLINE_PARSER_PACKAGE "-"
-               FILTER_CMDLINE_PARSER_VERSION);
+       printf_or_die("%s\n\n", VERSION_SINGLE_LINE("filter"));
        printf_or_die("%s\n\n", filter_args_info_usage);
        for (; *p; p++)
                printf_or_die("%s\n", *p);
index 05be1379c4f665314e402849b1ecefba680dfa74..7e1d10b584bbbcb199141199b5bc9ca12ab0d69a 100644 (file)
@@ -1,6 +1,6 @@
 define ggo_opts
        --output-dir=$(cmdline_dir) \
-       --set-version="$(PACKAGE_VERSION)" \
+       --set-version="$(GIT_VERSION) ($(codename))" \
        --arg-struct-name=$(*F)_args_info \
        --file-name=$(*F).cmdline \
        --func-name=$(*F)_cmdline_parser \
@@ -9,7 +9,7 @@ endef
 
 .PRECIOUS: $(cmdline_dir)/%.cmdline.c $(cmdline_dir)/%.cmdline.h $(ggo_dir)/%.ggo
 
-$(cmdline_dir)/%.cmdline.h $(cmdline_dir)/%.cmdline.c: $(ggo_dir)/%.ggo | $(cmdline_dir)
+$(cmdline_dir)/%.cmdline.h $(cmdline_dir)/%.cmdline.c: $(ggo_dir)/%.ggo git-version.h | $(cmdline_dir)
        @[ -z "$(Q)" ] || echo 'GGO $<'
        $(Q) $(GENGETOPT) $(ggo_opts) < $<
 
diff --git a/play.c b/play.c
index 814ec16a5288cd7ba4be5c0bbea275a9fc812ef6..9204792d0f5607a17d05a812dc83b0ff62bec49c 100644 (file)
--- a/play.c
+++ b/play.c
@@ -153,9 +153,7 @@ __noreturn static void print_help_and_die(void)
        const char **p = d? play_args_info_detailed_help
                : play_args_info_help;
 
-//     printf_or_die("%s\n\n", PLAY_CMDLINE_PARSER_PACKAGE "-"
-//             PLAY_CMDLINE_PARSER_VERSION);
-
+       printf_or_die("%s\n\n", VERSION_SINGLE_LINE("play"));
        printf_or_die("%s\n\n", play_args_info_usage);
        if (d)
                printf_or_die("%s\n", PP_DESC);
diff --git a/recv.c b/recv.c
index bc727de0cb65a102c8f1861d75d31c713b748a19..f8b5847cc436c164765b8f783894f4a3b3faee23 100644 (file)
--- a/recv.c
+++ b/recv.c
@@ -43,8 +43,7 @@ __noreturn static void print_help_and_die(void)
        const char **p = d? recv_args_info_detailed_help
                : recv_args_info_help;
 
-       printf_or_die("%s\n\n", RECV_CMDLINE_PARSER_PACKAGE "-"
-               RECV_CMDLINE_PARSER_VERSION);
+       printf_or_die("%s\n\n", VERSION_SINGLE_LINE("recv"));
        printf_or_die("%s\n\n", recv_args_info_usage);
        for (; *p; p++)
                printf_or_die("%s\n", *p);
index 3d865211788ac1ad516035af5c625dd2e24bd624..6309fd024c429ac1da6a195d8bc29760ff45a7ac 100644 (file)
--- a/version.h
+++ b/version.h
@@ -2,9 +2,11 @@
 
 #include "git-version.h"
 
+#define VERSION_SINGLE_LINE(prefix) "para_" prefix \
+       " " GIT_VERSION " (" CODENAME ")"
+
 /** Version text printed by all executables if -V was given. */
-#define VERSION_TEXT(prefix) "para_" prefix " " PACKAGE_VERSION \
-       " (" GIT_VERSION ": " CODENAME ")" "\n" \
+#define VERSION_TEXT(prefix) VERSION_SINGLE_LINE(prefix) "\n" \
        "Copyright (C) 2013 Andre Noll\n" \
        "This is free software with ABSOLUTELY NO WARRANTY." \
        " See COPYING for details.\n" \
diff --git a/write.c b/write.c
index f4f757fff2957f75876df33a83b41fd91aad3571..0f04fe5295942357fa69a27d25dceb715299075f 100644 (file)
--- a/write.c
+++ b/write.c
@@ -39,8 +39,7 @@ __noreturn static void print_help_and_die(void)
        const char **p = d? write_args_info_detailed_help
                : write_args_info_help;
 
-       printf_or_die("%s\n\n", WRITE_CMDLINE_PARSER_PACKAGE "-"
-               WRITE_CMDLINE_PARSER_VERSION);
+       printf_or_die("%s\n\n", VERSION_SINGLE_LINE("write"));
        printf_or_die("%s\n\n", write_args_info_usage);
        for (; *p; p++)
                printf_or_die("%s\n", *p);