PR25461: add /etc/profile.d files for default $DEBUGINFOD_URLS
authorFrank Ch. Eigler <fche@redhat.com>
Thu, 1 Oct 2020 20:56:49 +0000 (16:56 -0400)
committerFrank Ch. Eigler <fche@redhat.com>
Thu, 8 Oct 2020 15:08:12 +0000 (11:08 -0400)
To give distros a simple knob to let their userbase enjoy debuginfod
services, we add a --enable-debuginfod-urls[=URLS] to the configury.
This propagates to $DEBUGINFOD_URLS environment variable settings
in /etc/profile.d/debuginfod.{sh,csh} files.

The default is nothing.  If simply enabled, the current prototype
public server is used.  If enabled with parameters, the builder/distro
can specify a default URL search path of their own.

Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
ChangeLog
config/ChangeLog
config/Makefile.am
config/elfutils.spec.in
config/profile.csh.in [new file with mode: 0644]
config/profile.sh.in [new file with mode: 0644]
configure.ac

index 021b06f..72e8397 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2020-10-01  Frank Ch. Eigler  <fche@redhat.com>
+
+       PR25461
+       * configure.ac: Add --enable-debuginfod-urls[=URLS] option.
+
 2020-09-18  Mark Wielaard  <mark@klomp.org>
 
        * configure.ac: Check availability of libzstd and zstd.
index c8e4fcd..9c31925 100644 (file)
@@ -1,3 +1,11 @@
+2020-10-01  Frank Ch. Eigler  <fche@redhat.com>
+
+       PR25461
+       * profile.sh.in, profile.csh.in: New files for /etc/profiles.d
+       to define $DEBUGINFOD_URLS.
+       * elfutils.spec.in: Configure with --enable-debuginfod-urls.
+       * Makefile.am: Install them.
+
 2020-09-18  Mark Wielaard  <mark@klomp.org>
 
        * elfutils.spec.in: Add BuildRequires for libzstd-devel and zstd.
index 11f17df..ae6ffc9 100644 (file)
@@ -30,7 +30,7 @@
 ##
 EXTRA_DIST = elfutils.spec.in known-dwarf.awk 10-default-yama-scope.conf \
             libelf.pc.in libdw.pc.in libdebuginfod.pc.in \
-            debuginfod.service debuginfod.sysconfig
+            debuginfod.service debuginfod.sysconfig profile.sh.in profile.csh.in
 
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = libelf.pc libdw.pc
@@ -38,6 +38,10 @@ if DEBUGINFOD
 pkgconfig_DATA += libdebuginfod.pc
 endif
 
+install-data-local:
+       $(INSTALL_DATA) profile.sh -D $(DESTDIR)$(sysconfdir)/profile.d/debuginfod.sh
+       $(INSTALL_DATA) profile.csh -D $(DESTDIR)$(sysconfdir)/profile.d/debuginfod.csh
+
 if MAINTAINER_MODE
 $(srcdir)/elfutils.spec.in: $(top_srcdir)/NEWS
        @tmpname=$$(mktemp $${TMPDIR:-/tmp}/elfutils.XXXXXX); \
index 37af1b0..170c95e 100644 (file)
@@ -181,7 +181,7 @@ such servers to download those files on demand.
 %setup -q
 
 %build
-%configure --program-prefix=%{_programprefix} --enable-debuginfod
+%configure --program-prefix=%{_programprefix} --enable-debuginfod --enable-debuginfod-urls
 make -s %{?_smp_mflags}
 
 %install
@@ -296,7 +296,8 @@ fi
 %{_libdir}/libdebuginfod.so.*
 %{_bindir}/debuginfod-find
 %{_mandir}/man1/debuginfod-find.1*
-
+%config(noreplace) %verify(not md5 size mtime) %{_sysconfdir}/profile.d/*
+  
 %files debuginfod-client-devel
 %defattr(-,root,root)
 %{_libdir}/pkgconfig/libdebuginfod.pc
diff --git a/config/profile.csh.in b/config/profile.csh.in
new file mode 100644 (file)
index 0000000..4f25896
--- /dev/null
@@ -0,0 +1,2 @@
+
+setenv DEBUGINFOD_URLS "$DEBUGINFOD_URLS @DEBUGINFOD_URLS@"
diff --git a/config/profile.sh.in b/config/profile.sh.in
new file mode 100644 (file)
index 0000000..8a02248
--- /dev/null
@@ -0,0 +1,3 @@
+
+DEBUGINFOD_URLS="$DEBUGINFOD_URLS @DEBUGINFOD_URLS@"
+export DEBUGINFOD_URLS
index 1b794df..973409f 100644 (file)
@@ -731,6 +731,18 @@ AS_IF([test "x$enable_debuginfod" != "xno"], [
 AS_IF([test "x$enable_debuginfod" != "xno"],AC_DEFINE([ENABLE_DEBUGINFOD],[1],[Build debuginfod]))
 AM_CONDITIONAL([DEBUGINFOD],[test "x$enable_debuginfod" = "xyes"])
 
+dnl for /etc/profile.d/elfutils.{csh,sh}
+default_debuginfod_urls=""
+AC_ARG_ENABLE(debuginfod-urls,
+            [AS_HELP_STRING([--enable-debuginfod-urls@<:@=URLS@:>@],[add URLS to profile.d DEBUGINFOD_URLS])],
+            [if test "x${enableval}" = "xyes";
+             then default_debuginfod_urls="https://debuginfod.elfutils.org/";
+             elif test "x${enableval}" != "xno"; then
+             default_debuginfod_urls="${enableval}";
+             fi],
+            [default_debuginfod_urls=""])
+AC_SUBST(DEBUGINFOD_URLS, $default_debuginfod_urls)                
+AC_CONFIG_FILES([config/profile.sh config/profile.csh])
 
 AC_OUTPUT
 
@@ -764,6 +776,7 @@ AC_MSG_NOTICE([
     Extra Valgrind annotations         : ${use_vg_annotations}
     libdebuginfod client support       : ${enable_libdebuginfod}
     Debuginfod server support          : ${enable_debuginfod}
+    Default DEBUGINFOD_URLS            : ${default_debuginfod_urls}
 
   EXTRA TEST FEATURES (used with make check)
     have bunzip2 installed (required)  : ${HAVE_BUNZIP2}