Control: retitle -1 pre-approval: unblock elfutils/0.183-2

On Saturday, March 06 2021, I wrote:

> Hi,
>
> Please unblock elfutils/0.183-2.
>
> I have just uploaded this version to address
> <https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=983434>, which is
> about enabling the use of https://debuginfod.debian.net by default if
> the user chooses to do so when presented with a new debconf question.
>
> This is not an upload of a new upstream version, but it adds a new
> binary package (libdebuginfod-common) which holds the debconf
> template for the new question.  The package is currently in NEW.
>
> In all fairness, I am not entirely sure whether this requires an unblock
> bug, but I decided to be safe and file one.

Here's the debdiff.

Thanks,

-- 
Sergio
GPG key ID: 237A 54B1 0287 28BF 00EF  31F4 D0EB 7628 65FC 5E36
Please send encrypted e-mail if possible
https://sergiodj.net/

diff -Nru elfutils-0.183/debian/changelog elfutils-0.183/debian/changelog
--- elfutils-0.183/debian/changelog	2021-02-08 03:56:24.000000000 -0500
+++ elfutils-0.183/debian/changelog	2021-02-28 21:07:16.000000000 -0500
@@ -1,3 +1,33 @@
+elfutils (0.183-2) unstable; urgency=medium
+
+  * d/control:
+    - B-D on lsb-release.
+    - B-D on po-debconf.
+    - Create new libdebuginfod-common package.
+    - Add myself to Uploaders.
+  * d/rules:
+    - Use https://debuginfod.debian.net as our default service.
+      Also, revamp the code responsible for determining libdebuginfod
+      configuration flags.
+    - Invoke dh_installdebconf.
+  * d/libdebuginfod-common.templates: Create a debconf template.
+    Also, create d/po/POTFILES.in and d/po/templates.pot.
+    This template is for the question of whether the user accepts GDB or
+    another debuginfo consumer program to connect to Debian's debuginfod
+    server.
+  * d/libdebuginfod-common.config: Ask if the user accepts to use Debian's
+    debuginfod.
+  * d/libdebuginfod-common.postinst: Act upon the user's answer to the
+    debconf question.
+    If the user has accepted to use Debian's debuginfod, then the script
+    confirms the value of the DEBUGINFOD_URLS environment variable present
+    in the shell excerpts under /etc/profile.d.  Otherwise, the script
+    will set the variable to an empty value, disabling the remote
+    connection to the debuginfod server. (Closes: #983434)
+  * d/libdebuginfod-common.install: Install the profile.d snippets.
+
+ -- Sergio Durigan Junior <sergi...@debian.org>  Sun, 28 Feb 2021 21:07:16 -0500
+
 elfutils (0.183-1) unstable; urgency=medium
 
   * New upstream release. Changes compared to the snapshot:
diff -Nru elfutils-0.183/debian/control elfutils-0.183/debian/control
--- elfutils-0.183/debian/control	2021-02-08 03:56:24.000000000 -0500
+++ elfutils-0.183/debian/control	2021-02-28 21:07:16.000000000 -0500
@@ -2,11 +2,12 @@
 Priority: optional
 Maintainer: Debian Elfutils Maintainers <debian-...@lists.debian.org>
 Uploaders: Kurt Roeckx <k...@roeckx.be>,
-  Matthias Klose <d...@debian.org>
+  Matthias Klose <d...@debian.org>,
+  Sergio Durigan Junior <sergi...@debian.org>,
 Build-Depends: debhelper (>= 11),
-  autoconf, automake,
+  autoconf, automake, lsb-release,
   bzip2, zlib1g-dev, zlib1g-dev:native, libbz2-dev, liblzma-dev,
-  m4, gettext,
+  m4, gettext, po-debconf,
   gawk, dpkg-dev (>= 1.16.1~),
   gcc-multilib [any-amd64 sparc64] <!nocheck>,
   libc6-dbg [powerpc powerpcspe ppc64 ppc64el armel armhf arm64 sparc64 riscv64],
@@ -113,7 +114,8 @@
 Architecture: any
 Multi-Arch: same
 Depends: ${shlibs:Depends}, ${misc:Depends},
-  libelf1 (= ${binary:Version}), libdw1 (= ${binary:Version})
+  libelf1 (= ${binary:Version}), libdw1 (= ${binary:Version}),
+  libdebuginfod-common (= ${source:Version})
 Pre-Depends: ${misc:Pre-Depends}
 Description: library to interact with debuginfod (development files)
  The libdebuginfo1 package provides a library with an interface to interact
@@ -142,3 +144,15 @@
  Server, client tool and library to index and fetch ELF/DWARF files
  addressed by build-id through HTTP.
 
+Package: libdebuginfod-common
+Build-Profiles: <!pkg.elfutils.nodebuginfod>
+Section: devel
+Architecture: all
+Multi-Arch: foreign
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Pre-Depends: ${misc:Pre-Depends}, debconf
+Description: library to interact with debuginfod (common files)
+ The libdebuginfo1 package provides a library with an interface to interact
+ with debuginfod.
+ .
+ This package contains the common files for libdebuginfod.
diff -Nru elfutils-0.183/debian/libdebuginfod-common.config elfutils-0.183/debian/libdebuginfod-common.config
--- elfutils-0.183/debian/libdebuginfod-common.config	1969-12-31 19:00:00.000000000 -0500
+++ elfutils-0.183/debian/libdebuginfod-common.config	2021-02-28 21:07:16.000000000 -0500
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+set -e
+
+. /usr/share/debconf/confmodule
+
+db_version 2.0
+db_capb
+
+# Ask whether the user is OK with using Debian's debuginfod.  We just
+# bother with the question if there is actually a debuginfod profile.d
+# script available.
+if [ -f /etc/profile.d/debuginfod.sh ]; then
+    if grep -qFx "ID=debian" /etc/os-release; then
+	db_input medium libdebuginfod/usedebiandebuginfod || true
+	db_go || true
+    fi
+fi
diff -Nru elfutils-0.183/debian/libdebuginfod-common.install elfutils-0.183/debian/libdebuginfod-common.install
--- elfutils-0.183/debian/libdebuginfod-common.install	1969-12-31 19:00:00.000000000 -0500
+++ elfutils-0.183/debian/libdebuginfod-common.install	2021-02-28 21:07:16.000000000 -0500
@@ -0,0 +1 @@
+usr/etc/profile.d/debuginfod.* etc/profile.d/
diff -Nru elfutils-0.183/debian/libdebuginfod-common.postinst elfutils-0.183/debian/libdebuginfod-common.postinst
--- elfutils-0.183/debian/libdebuginfod-common.postinst	1969-12-31 19:00:00.000000000 -0500
+++ elfutils-0.183/debian/libdebuginfod-common.postinst	2021-02-28 21:07:16.000000000 -0500
@@ -0,0 +1,97 @@
+#!/bin/bash
+
+set -e
+
+. /usr/share/debconf/confmodule
+
+# Change a "generic" shell file according to enable/disable
+# DEBUGINFOD_URLS according.
+#
+# - $1 is the shell file name
+#
+# - $2 is the pattern that we will look for when changing the file.
+#   This pattern will also be used to perform the substitution.
+#
+# - $3 is the action we will perform: set the DEBUGINFOD_URLS
+#   variable, or unset it.
+#
+# By the end of it, the specified shell file will have an extra line
+# which either sets DEBUGINFOD_URLS to have its own value, or sets
+# DEBUGINFOD_URLS to be empty (i.e., unsets any value).
+change_shell_file ()
+{
+    file="$1"
+    pattern="$2"
+
+    if [ "$3" = "set" ]; then
+	finalvar='$DEBUGINFOD_URLS'
+    else
+	finalvar=""
+    fi
+
+    # Check whether the last line of the file already starts with
+    # ${pattern}.  If it does, then we will perform a sed to replace
+    # it according to the action specified.  Otherwise, we will append
+    # a last line containing the set/unset.
+    if tail -n1 "$file" | grep -q "^$pattern"; then
+	sed -i "\$s@${pattern}.*@${pattern}\"${finalvar}\"@" "${file}"
+    else
+	echo "${pattern}\"${finalvar}\"" >> "${file}"
+    fi
+}
+
+# Change the .sh file according to an action specified by $1.  It can
+# be either "set" (meaning that we will be setting DEBUGINFOD_URLS to
+# a valid value), or "unset" (which means that DEBUGINFOD_URLS will be
+# empty).
+change_sh_file ()
+{
+    change_shell_file \
+	/etc/profile.d/debuginfod.sh \
+	"export DEBUGINFOD_URLS=" \
+	"$1"
+}
+
+# Change the .csh file according to an action specified by $1.  The
+# explanation for change_sh_file also applies here.
+change_csh_file ()
+{
+    change_shell_file \
+	/etc/profile.d/debuginfod.csh \
+	"setenv DEBUGINFOD_URLS " \
+	"$1"
+}
+
+case "$1" in
+    configure)
+	if [ -f /etc/profile.d/debuginfod.sh ]; then
+	    RET="false"
+	    if grep -qFx "ID=debian" /etc/os-release; then
+		db_get libdebuginfod/usedebiandebuginfod || RET="false"
+	    fi
+
+	    if [ "$RET" = "true" ]; then
+		action="set"
+	    else
+		action="unset"
+	    fi
+	    change_sh_file "$action"
+	    change_csh_file "$action"
+	fi
+    ;;
+
+    abort-upgrade|abort-remove|abort-deconfigure)
+    ;;
+
+    *)
+        echo "postinst called with unknown argument \`$1'" >&2
+        exit 1
+    ;;
+esac
+
+# dh_installdeb will replace this with shell code automatically
+# generated by other debhelper scripts.
+
+#DEBHELPER#
+
+exit 0
diff -Nru elfutils-0.183/debian/libdebuginfod-common.templates elfutils-0.183/debian/libdebuginfod-common.templates
--- elfutils-0.183/debian/libdebuginfod-common.templates	1969-12-31 19:00:00.000000000 -0500
+++ elfutils-0.183/debian/libdebuginfod-common.templates	2021-02-28 21:07:16.000000000 -0500
@@ -0,0 +1,12 @@
+Template: libdebuginfod/usedebiandebuginfod
+Type: boolean
+Default: false
+_Description: Connect to Debian's debuginfod server to download debug symbols?
+ While debugging programs (with GDB, for example) or using
+ debuginfo-consumer applications, it is possible to connect to
+ Debian's debuginfod server and download the necessary debug
+ information for the program you are debugging on-the-fly, without the
+ need to configure the debian-debug apt repository nor installing
+ any dbgsym packages.  This service is maintained by Debian, and the
+ only information you will have to send to it is the Build-ID hash of
+ the program(s)/library(ies) being debugged.
diff -Nru elfutils-0.183/debian/po/POTFILES.in elfutils-0.183/debian/po/POTFILES.in
--- elfutils-0.183/debian/po/POTFILES.in	1969-12-31 19:00:00.000000000 -0500
+++ elfutils-0.183/debian/po/POTFILES.in	2021-02-28 21:07:16.000000000 -0500
@@ -0,0 +1 @@
+[type: gettext/rfc822deb] libdebuginfod-common.templates
diff -Nru elfutils-0.183/debian/po/templates.pot elfutils-0.183/debian/po/templates.pot
--- elfutils-0.183/debian/po/templates.pot	1969-12-31 19:00:00.000000000 -0500
+++ elfutils-0.183/debian/po/templates.pot	2021-02-28 21:07:16.000000000 -0500
@@ -0,0 +1,37 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the elfutils package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: elfutils\n"
+"Report-Msgid-Bugs-To: elfut...@packages.debian.org\n"
+"POT-Creation-Date: 2021-03-06 18:23-0500\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <l...@li.org>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=CHARSET\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#. Type: boolean
+#. Description
+#: ../libdebuginfod-common.templates:1001
+msgid "Connect to Debian's debuginfod server to download debug symbols?"
+msgstr ""
+
+#. Type: boolean
+#. Description
+#: ../libdebuginfod-common.templates:1001
+msgid ""
+"While debugging programs (with GDB, for example) or using debuginfo-consumer "
+"applications, it is possible to connect to Debian's debuginfod server and "
+"download the necessary debug information for the program you are debugging "
+"on-the-fly, without the need to configure the debian-debug apt repository "
+"nor installing any dbgsym packages.  This service is maintained by Debian, "
+"and the only information you will have to send to it is the Build-ID hash of "
+"the program(s)/library(ies) being debugged."
+msgstr ""
diff -Nru elfutils-0.183/debian/rules elfutils-0.183/debian/rules
--- elfutils-0.183/debian/rules	2021-02-05 13:10:02.000000000 -0500
+++ elfutils-0.183/debian/rules	2021-02-28 21:07:16.000000000 -0500
@@ -12,6 +12,7 @@
 # Uncomment this to turn on verbose mode.
 #export DH_VERBOSE=1
 
+DISTRO = $(shell lsb_release -is)
 
 # These are used for cross-compiling and for saving the configure script
 # from having to guess our platform (since we know it already)
@@ -42,6 +43,23 @@
 CFLAGS := $(patsubst -O%,-O3, $(CFLAGS))
 CXXFLAGS := $(patsubst -O%,-O3, $(CXXFLAGS))
 
+# debuginfod configuration flags.
+ifneq (,$(filter pkg.elfutils.nodebuginfod,$(DEB_BUILD_PROFILES)))
+  conf_debuginfod = \
+	--disable-libdebuginfod \
+	--disable-debuginfod
+else
+  conf_debuginfod = \
+	--enable-libdebuginfod \
+	--enable-debuginfod
+
+  ifeq ($(DISTRO),Debian)
+    conf_debuginfod += \
+	--enable-debuginfod-urls="https://debuginfod.debian.net";
+  endif
+endif
+
+
 stamps/configure:
 	dh_testdir
 	dh_autoreconf
@@ -57,8 +75,7 @@
 		./configure $(confflags) --prefix=/usr \
 		--libdir=/usr/lib/$(DEB_HOST_MULTIARCH) \
 		--program-prefix=eu- --disable-silent-rules \
-		--$(if $(filter pkg.elfutils.nodebuginfod,$(DEB_BUILD_PROFILES)),dis,en)able-libdebuginfod \
-		--$(if $(filter pkg.elfutils.nodebuginfod,$(DEB_BUILD_PROFILES)),dis,en)able-debuginfod
+		$(conf_debuginfod)
 	touch $@
 
 build: stamps/build
@@ -116,9 +133,6 @@
 #	rm -f debian/tmp/usr/share/man/man1/eu-readelf.1
 #	rm -f debian/tmp/usr/share/man/man3/elf_*.3
 
-	: # these are empty envvar settings ...
-	rm -rf debian/tmp/usr/etc/profile.d
-
 	dh_install --sourcedir=debian/tmp
 	rm -f debian/elfutils/usr/bin/debuginfod*
 	dh_missing --fail-missing --sourcedir=debian/tmp
@@ -135,6 +149,7 @@
 	dh_makeshlibs -plibasm1 -V "libasm1 (>= 0.132)"
 	dh_makeshlibs -plibdw1 -V "libdw1 (>= 0.138)"
 	dh_makeshlibs -plibdebuginfod1
+	dh_installdebconf
 	dh_installdeb
 	dh_shlibdeps
 	dh_gencontrol

Attachment: signature.asc
Description: PGP signature

Reply via email to