bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2] version-etc: extend for packagers


From: Jim Meyering
Subject: Re: [PATCH v2] version-etc: extend for packagers
Date: Wed, 03 Jun 2009 11:41:05 +0200

Mike Frysinger wrote:
> On Monday 01 June 2009 20:04:22 Bruno Haible wrote:
>> Mike Frysinger wrote:
>> > actually i just tried this and it didnt work.  config.h ended up with:
>> > /* Packager info for bug reports (URL/e-mail/...) */
>> > #undef AS_TR_CPP
>>
>> Oops, you're right. Sorry. I had looked only at the generated 'configure'
>> file.
>
> np.  so i guess there isnt anything left here for me to do ? :)

If no one else comments, I'll push the following shortly, extracting
the ChangeLog directly from this commit log.  It'd be good to add your
example to the documentation, but that needn't hold up the change.

>From e8f301d3a4c0ba6aef8f168592e673684c7ed2a6 Mon Sep 17 00:00:00 2001
From: Mike Frysinger <address@hidden>
Date: Sun, 31 May 2009 23:13:38 -0400
Subject: [PATCH] version-etc: extend for packagers

Add three new configure options, intended for packagers:
  --with-packager="packager name"
  --with-packager-version="packager-specific version"
  --with-packager-bug-reports="packager bug reporting"

An example with coreutils:

  $ ./configure \
    --with-packager=Gentoo \
    --with-packager-bug-report=http://bugs.gentoo.org/ \
    --with-packager-version="patchset 1.6"

  $ ./src/ls --version | head -n3
  ls (GNU coreutils) 7.1-dirty
  Packaged by Gentoo (patchset 1.6)
  Copyright (C) 2009 Free Software Foundation, Inc.

Note that the bug reporting info via --help doesn't show up because
coreutils uses its own custom emit_bug_reporting_address() implementation
in src/system.h.  If it didn't, it'd look like:

  $ ./src/ls --help | tail -n4
  Report bugs to <address@hidden>.
  Report Gentoo bugs to <http://bugs.gentoo.org/>.
  GNU coreutils home page: <http://www.gnu.org/software/coreutils/>.
  General help using GNU software: <http://www.gnu.org/gethelp/>.

* lib/version-etc.c: Print new information, if provided.
* m4/version-etc.m4: New file.
* modules/version-etc (Files): Add m4/version-etc.m4.
(configure.ac): Add gl_VERSION_ETC.

Signed-off-by: Mike Frysinger <address@hidden>
---
 lib/version-etc.c   |   13 +++++++++++++
 m4/version-etc.m4   |   33 +++++++++++++++++++++++++++++++++
 modules/version-etc |    2 ++
 3 files changed, 48 insertions(+), 0 deletions(-)
 create mode 100644 m4/version-etc.m4

diff --git a/lib/version-etc.c b/lib/version-etc.c
index 2258c2e..c3b0289 100644
--- a/lib/version-etc.c
+++ b/lib/version-etc.c
@@ -59,6 +59,15 @@ version_etc_va (FILE *stream,
   else
     fprintf (stream, "%s %s\n", package, version);

+#ifdef PACKAGE_PACKAGER
+# ifdef PACKAGE_PACKAGER_VERSION
+  fprintf (stream, _("Packaged by %s (%s)\n"), PACKAGE_PACKAGER,
+          PACKAGE_PACKAGER_VERSION);
+# else
+  fprintf (stream, _("Packaged by %s\n"), PACKAGE_PACKAGER);
+# endif
+#endif
+
   /* TRANSLATORS: Translate "(C)" to the copyright symbol
      (C-in-a-circle), if this symbol is available in the user's
      locale.  Otherwise, do not translate "(C)"; leave it as-is.  */
@@ -179,6 +188,10 @@ emit_bug_reporting_address (void)
      "Report translation bugs to <...>\n" with the address for translation
      bugs (typically your translation team's web or email address).  */
   printf (_("\nReport bugs to <%s>.\n"), PACKAGE_BUGREPORT);
+#ifdef PACKAGE_PACKAGER_BUG_REPORTS
+  printf (_("Report %s bugs to <%s>.\n"), PACKAGE_PACKAGER,
+         PACKAGE_PACKAGER_BUG_REPORTS);
+#endif
   printf (_("%s home page: <http://www.gnu.org/software/%s/>.\n"),
          PACKAGE_NAME, PACKAGE);
   fputs (_("General help using GNU software: 
<http://www.gnu.org/gethelp/>.\n"),
diff --git a/m4/version-etc.m4 b/m4/version-etc.m4
new file mode 100644
index 0000000..14d6eb6
--- /dev/null
+++ b/m4/version-etc.m4
@@ -0,0 +1,33 @@
+# version-etc.m4 serial 1
+# Copyright (C) 2009 Free Software Foundation, Inc.
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+dnl $1 - configure flag and define name
+dnl $2 - human readable description
+m4_define([gl_VERSION_ETC_FLAG],
+[dnl
+  AC_ARG_WITH([$1], [AS_HELP_STRING([--with-$1], [$2])],
+    [dnl
+      case $withval in
+       yes|no) ;;
+       *) AC_DEFINE_UNQUOTED(AS_TR_CPP([PACKAGE_$1]), ["$withval"], [$2]) ;;
+      esac
+    ])
+])
+
+AC_DEFUN([gl_VERSION_ETC],
+[dnl
+  gl_VERSION_ETC_FLAG([packager],
+                     [String identifying the packager of this software])
+  gl_VERSION_ETC_FLAG([packager-version],
+                     [Packager-specific version information])
+  gl_VERSION_ETC_FLAG([packager-bug-reports],
+                     [Packager info for bug reports (URL/e-mail/...)])
+  if test "X$with_packager" = "X" && \
+     test "X$with_packager_version$with_packager_bug_reports" != "X"
+  then
+    AC_MSG_ERROR([The --with-packager-{bug-reports,version} options require 
--with-packager])
+  fi
+])
diff --git a/modules/version-etc b/modules/version-etc
index aac2311..589c8c9 100644
--- a/modules/version-etc
+++ b/modules/version-etc
@@ -4,12 +4,14 @@ Print --version and bug-reporting information in a consistent 
format.
 Files:
 lib/version-etc.h
 lib/version-etc.c
+m4/version-etc.m4

 Depends-on:
 gettext-h
 stdarg

 configure.ac:
+gl_VERSION_ETC

 Makefile.am:
 lib_SOURCES += version-etc.h version-etc.c
--
1.6.3.1.308.g426b5




reply via email to

[Prev in Thread] Current Thread [Next in Thread]