]> TLD Linux GIT Repositories - packages/systemtap.git/blobdiff - systemtap-rpm-4.5-support.patch
- merged 3.2 from PLD, added rpm 4.5 fix
[packages/systemtap.git] / systemtap-rpm-4.5-support.patch
diff --git a/systemtap-rpm-4.5-support.patch b/systemtap-rpm-4.5-support.patch
new file mode 100644 (file)
index 0000000..5e3c462
--- /dev/null
@@ -0,0 +1,58 @@
+diff -urpa systemtap-3.2.orig/configure.ac systemtap-3.2/configure.ac
+--- systemtap-3.2.orig/configure.ac    2017-10-18 17:59:37.000000000 +0000
++++ systemtap-3.2/configure.ac 2018-03-14 12:27:03.557939628 +0000
+@@ -465,6 +465,19 @@ AC_ARG_WITH([rpm],
+   [AS_HELP_STRING([--with-rpm],
+                   [query rpm database for missing debuginfos])], [], [with_rpm="auto"])
+ if test "$with_rpm" != "no"; then
++  PKG_CHECK_MODULES([RPM], [rpm], [
++      AC_DEFINE_UNQUOTED([HAVE_RPM],1,[Define if RPM backend is available])
++      CPPFLAGS="$RPM_CFLAGS $CPPFLAGS"
++      stap_LIBS="$stap_LIBS $RPM_LIBS"
++   ], [
++      AC_PATH_PROG(RPM_PATH,rpm,none)
++      if test "$RPM_PATH" = "none"; then
++         AC_MSG_ERROR([RPM executable was not found in your system])
++      else
++         AC_DEFINE_UNQUOTED([HAVE_RPM],1,[Define if RPM backend is available])
++      fi
++   ]
++)
+   AC_CHECK_LIB(rpm, rpmtsInitIterator, [
+                     AC_DEFINE([HAVE_LIBRPM],[1],[have librpm])
+                     stap_LIBS="$stap_LIBS -lc -lrpm"
+diff -urpa systemtap-3.2.orig/rpm_finder.cxx systemtap-3.2/rpm_finder.cxx
+--- systemtap-3.2.orig/rpm_finder.cxx  2017-10-18 17:59:37.000000000 +0000
++++ systemtap-3.2/rpm_finder.cxx       2018-03-14 12:24:39.000000000 +0000
+@@ -24,6 +24,7 @@ extern "C" {
+ #include <string.h>
+ #include <rpm/rpmlib.h>
++#include <rpm/rpmmacro.h>
+ #include <rpm/rpmts.h>
+ #include <rpm/rpmdb.h>
+ #include <rpm/header.h>
+@@ -99,7 +100,9 @@ missing_rpm_enlist (systemtap_session& s
+           break;
+         /* Verify the kernel file is not already installed.  */
+-        rpminfo = headerFormat(h, header, &err);
++        char *nvra = rpmExpand("%{___NVRA}", NULL);
++        rpminfo = headerSprintf(h, header, rpmTagTable, rpmHeaderFormats, &err);
++        free(nvra);
+         if (!rpminfo)
+           {
+@@ -151,9 +154,10 @@ missing_rpm_enlist (systemtap_session& s
+           }
+         /* The allocated memory gets utilized below for MISSING_RPM_HASH.  */
+           if(strcmp(rpm_type,"-debuginfo")==0){
++          char *nvra = rpmExpand("%{___NVRA}", NULL);
+           xfree(rpminfo);
+-          rpminfo = headerFormat(h, "%{name}-%{version}-%{release}.%{arch}",
+-                                 &err);
++          rpminfo = headerSprintf(h, nvra, rpmTagTable, rpmHeaderFormats, &err);
++          free(nvra);
+         }
+         if (!rpminfo)
+           {