public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
* patch PR25583: debuginfod bsdtar for deb
@ 2020-03-25 14:57 Frank Ch. Eigler
  2020-03-27  0:13 ` Mark Wielaard
  0 siblings, 1 reply; 5+ messages in thread
From: Frank Ch. Eigler @ 2020-03-25 14:57 UTC (permalink / raw)
  To: elfutils-devel

Hi -

Author: Frank Ch. Eigler <fche@redhat.com>
Date:   Wed Mar 25 10:55:53 2020 -0400

    PR25583: debuginfod: prefer bsdtar to dpkg for .deb handling
    
    It turns out a bsdtar subshell can do the job of dpkg-deb.
    bsdtar comes from/with libarchive so it should be available
    everywhere.
    
    Signed-off-by: Frank Ch. Eigler <fche@redhat.com>

diff --git a/config/ChangeLog b/config/ChangeLog
index d1050e2c084a..368f959ee0be 100644
--- a/config/ChangeLog
+++ b/config/ChangeLog
@@ -1,3 +1,7 @@
+2020-03-25  Frank Ch. Eigler <fche@redhat.com>
+
+	* elfutils.spec.in: *Require: bsdtar instead of dpkg.
+
 2020-03-04  Mark Wielaard  <mark@klomp.org>
 
 	* elfutils.spec.in (package debuginfod): Remove Requires: rpm.
diff --git a/config/elfutils.spec.in b/config/elfutils.spec.in
index ef7fe31fe1bd..6e2436506b37 100644
--- a/config/elfutils.spec.in
+++ b/config/elfutils.spec.in
@@ -35,9 +35,7 @@ BuildRequires: pkgconfig(libarchive) >= 3.1.2
 BuildRequires: bzip2
 # For the run-debuginfod-find.sh test case in %check for /usr/sbin/ss
 BuildRequires: iproute
-%if 0%{?fedora} >= 20
-BuildRequires: dpkg
-%endif
+BuildRequires: bsdtar
 BuildRequires: curl
 
 %define _gnu %{nil}
@@ -157,9 +155,8 @@ Requires(post):   systemd
 Requires(preun):  systemd
 Requires(postun): systemd
 Requires(pre): shadow-utils
-# To extract .deb files with dpkg-deb --fsys-tarfile
-# Can be Recommends if rpm supports that
-Requires: dpkg
+# To extract .deb files with a bsdtar (= libarchive) subshell
+Requires: bsdtar
 
 %description debuginfod-client
 The elfutils-debuginfod-client package contains shared libraries
diff --git a/debuginfod/ChangeLog b/debuginfod/ChangeLog
index b34b4d2938dd..1cf434bf9fbf 100644
--- a/debuginfod/ChangeLog
+++ b/debuginfod/ChangeLog
@@ -1,3 +1,8 @@
+2020-03-25  Frank Ch. Eigler <fche@redhat.com>
+
+	* debuginfod.cxx (parse_opt): Associate a bsdtar subshell with
+	the .deb & .ddeb extensions, instead of dpkg-deb.
+
 2020-03-24  Frank Ch. Eigler  <fche@redhat.com>
 
 	* debuginfod-client.c (debuginfod_query_server): Print the
diff --git a/debuginfod/debuginfod.cxx b/debuginfod/debuginfod.cxx
index 7c7e85eb6d14..e8364d8c5a24 100644
--- a/debuginfod/debuginfod.cxx
+++ b/debuginfod/debuginfod.cxx
@@ -429,8 +429,9 @@ parse_opt (int key, char *arg,
       scan_archives[".rpm"]="cat"; // libarchive groks rpm natively
       break;
     case 'U':
-      scan_archives[".deb"]="dpkg-deb --fsys-tarfile";
-      scan_archives[".ddeb"]="dpkg-deb --fsys-tarfile";
+      scan_archives[".deb"]="(bsdtar -O -x -f - data.tar.xz)<";
+      scan_archives[".ddeb"]="(bsdtar -O -x -f - data.tar.xz)<";
+      // .udeb too?
       break;
     case 'Z':
       {
diff --git a/tests/ChangeLog b/tests/ChangeLog
index d0d32a87315a..400b64f517e4 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,7 @@
+2020-03-25  Frank Ch. Eigler <fche@redhat.com>
+
+	* run-debuginfod-find.sh: Look for bsdtar instead of dpkg.
+
 2020-03-23  Mark Wielaard  <mark@klomp.org>
 
 	* getphdrnum.c: Include config.h.
diff --git a/tests/run-debuginfod-find.sh b/tests/run-debuginfod-find.sh
index b64130282d86..7f9e9e7ac745 100755
--- a/tests/run-debuginfod-find.sh
+++ b/tests/run-debuginfod-find.sh
@@ -349,7 +349,7 @@ wait_ready $PORT2 'thread_busy{role="scan"}' 0
 # have clients contact the new server
 export DEBUGINFOD_URLS=http://127.0.0.1:$PORT2
 
-if type dpkg-deb 2>/dev/null; then
+if type bsdtar 2>/dev/null; then
     # copy in the deb files
     cp -rvp ${abs_srcdir}/debuginfod-debs/*deb D
     kill -USR1 $PID2


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: patch PR25583: debuginfod bsdtar for deb
  2020-03-25 14:57 patch PR25583: debuginfod bsdtar for deb Frank Ch. Eigler
@ 2020-03-27  0:13 ` Mark Wielaard
  2020-03-27  1:12   ` Frank Ch. Eigler
  0 siblings, 1 reply; 5+ messages in thread
From: Mark Wielaard @ 2020-03-27  0:13 UTC (permalink / raw)
  To: Frank Ch. Eigler, elfutils-devel

Hi Frank,

On Wed, 2020-03-25 at 10:57 -0400, Frank Ch. Eigler via Elfutils-devel wrote:
> Author: Frank Ch. Eigler <fche@redhat.com>
> Date:   Wed Mar 25 10:55:53 2020 -0400
> 
>     PR25583: debuginfod: prefer bsdtar to dpkg for .deb handling
>     
>     It turns out a bsdtar subshell can do the job of dpkg-deb.
>     bsdtar comes from/with libarchive so it should be available
>     everywhere.

The patch itself looks correct. And it is a win for non-deb based
systems since the bsdtar dependencies are already there. But for .deb
based systems it is more likely they already have dpkg installed, while
bsdtar might be a separate install/package. And it still needs to spawn
an external process.

I looked at the buildbot workers and none had bsdtar installed. I have
installed it now on the i386, debian/fedora/centos-x86_64, arm32 and
arm64 workers and have requested it to be installed on the s390x and
ppc64[le] workers.

I am not against this patch, but I do wonder if it should not try to
fall back on dpkg if bsdtar isn't installed.

Cheers,

Mark

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: patch PR25583: debuginfod bsdtar for deb
  2020-03-27  0:13 ` Mark Wielaard
@ 2020-03-27  1:12   ` Frank Ch. Eigler
  2020-03-27  1:32     ` Frank Ch. Eigler
  0 siblings, 1 reply; 5+ messages in thread
From: Frank Ch. Eigler @ 2020-03-27  1:12 UTC (permalink / raw)
  To: Mark Wielaard; +Cc: elfutils-devel

Hi -

> I am not against this patch, but I do wonder if it should not try to
> fall back on dpkg if bsdtar isn't installed.

Good point, will do that.

- FChE


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: patch PR25583: debuginfod bsdtar for deb
  2020-03-27  1:12   ` Frank Ch. Eigler
@ 2020-03-27  1:32     ` Frank Ch. Eigler
  2020-03-27 13:18       ` Frank Ch. Eigler
  0 siblings, 1 reply; 5+ messages in thread
From: Frank Ch. Eigler @ 2020-03-27  1:32 UTC (permalink / raw)
  To: Mark Wielaard, elfutils-devel

Hi -

Like this?
(/usr/bin/dkpg-deb is the usual installation path)


diff --git a/debuginfod/ChangeLog b/debuginfod/ChangeLog
index 5e19db517472..58ba85cf3664 100644
--- a/debuginfod/ChangeLog
+++ b/debuginfod/ChangeLog
@@ -1,3 +1,8 @@
+2020-03-26  Frank Ch. Eigler <fche@redhat.com>
+
+       * debuginfod.cxx (parse_opt): For -U, prefer dpkg-deb
+       after all if access(3)-able, fallback to bsdtar.
+
 2020-03-25  Frank Ch. Eigler <fche@redhat.com>
 
        * debuginfod.cxx (parse_opt): Associate a bsdtar subshell with
diff --git a/debuginfod/debuginfod.cxx b/debuginfod/debuginfod.cxx
index c03bbf922f59..9e8d55609c56 100644
--- a/debuginfod/debuginfod.cxx
+++ b/debuginfod/debuginfod.cxx
@@ -429,8 +429,16 @@ parse_opt (int key, char *arg,
       scan_archives[".rpm"]="cat"; // libarchive groks rpm natively
       break;
     case 'U':
-      scan_archives[".deb"]="(bsdtar -O -x -f - data.tar.xz)<";
-      scan_archives[".ddeb"]="(bsdtar -O -x -f - data.tar.xz)<";
+      if (access("/usr/bin/dpkg-deb", X_OK) == 0)
+        {
+          scan_archives[".deb"]="dpkg-deb --fsys-tarfile";
+          scan_archives[".ddeb"]="dpkg-deb --fsys-tarfile";
+        }
+      else
+        {
+          scan_archives[".deb"]="(bsdtar -O -x -f - data.tar.xz)<";
+          scan_archives[".ddeb"]="(bsdtar -O -x -f - data.tar.xz)<";
+        }
       // .udeb too?
       break;
     case 'Z':


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: patch PR25583: debuginfod bsdtar for deb
  2020-03-27  1:32     ` Frank Ch. Eigler
@ 2020-03-27 13:18       ` Frank Ch. Eigler
  0 siblings, 0 replies; 5+ messages in thread
From: Frank Ch. Eigler @ 2020-03-27 13:18 UTC (permalink / raw)
  To: Frank Ch. Eigler; +Cc: Mark Wielaard, elfutils-devel

Hi -

> Like this?
> (/usr/bin/dkpg-deb is the usual installation path)

pushed to master after testing on f30 with and without dpkg.

- FChE


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-03-27 13:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-25 14:57 patch PR25583: debuginfod bsdtar for deb Frank Ch. Eigler
2020-03-27  0:13 ` Mark Wielaard
2020-03-27  1:12   ` Frank Ch. Eigler
2020-03-27  1:32     ` Frank Ch. Eigler
2020-03-27 13:18       ` Frank Ch. Eigler

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).