[packages/systemtap] - add rpm5 support (patch from mandriva)

baggins baggins at pld-linux.org
Mon Sep 10 13:56:37 CEST 2012


commit 6fbeb569e1e7a2e548d89a7963ad424ce76bcc90
Author: Jan Rękorajski <baggins at pld-linux.org>
Date:   Mon Sep 10 13:56:24 2012 +0200

    - add rpm5 support (patch from mandriva)

 systemtap-rpm5-support.patch | 114 +++++++++++++++++++++++++++++++++++++++++++
 systemtap.spec               |   2 +
 2 files changed, 116 insertions(+)
---
diff --git a/systemtap.spec b/systemtap.spec
index 17d4263..22af737 100644
--- a/systemtap.spec
+++ b/systemtap.spec
@@ -15,6 +15,7 @@ Source0:	http://sources.redhat.com/systemtap/ftp/releases/%{name}-%{version}.tar
 # Source0-md5:	5b7ab0ae0efc520f0b19f9dbf11977c9
 Patch0:		%{name}-configure.patch
 Patch1:		%{name}-build.patch
+Patch2:		%{name}-rpm5-support.patch
 URL:		http://sourceware.org/systemtap/
 BuildRequires:	autoconf
 BuildRequires:	automake
@@ -136,6 +137,7 @@ with the optional dtrace-compatibility preprocessor to process related
 %setup -q
 %patch0 -p1
 %patch1 -p1
+%patch2 -p1
 
 %build
 %{__aclocal}
diff --git a/systemtap-rpm5-support.patch b/systemtap-rpm5-support.patch
new file mode 100644
index 0000000..acd39d7
--- /dev/null
+++ b/systemtap-rpm5-support.patch
@@ -0,0 +1,114 @@
+--- systemtap-1.5/configure.ac.rpm5~	2011-05-23 21:21:36.000000000 +0200
++++ systemtap-1.5/configure.ac	2011-09-26 08:22:28.072465175 +0200
+@@ -449,6 +449,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 -lrpm"
+--- systemtap-1.5/rpm_finder.cxx.rpm5~	2011-05-23 21:21:36.000000000 +0200
++++ systemtap-1.5/rpm_finder.cxx	2011-09-26 08:14:28.829226303 +0200
+@@ -20,21 +20,22 @@ using namespace std;
+ 
+ #ifdef HAVE_LIBRPM
+ 
+-extern "C" {
+-
+-#define _RPM_4_4_COMPAT
+-#include <string.h>
+-#include <rpm/rpmlib.h>
+-#include <rpm/rpmts.h>
+-#include <rpm/rpmdb.h>
+-#include <rpm/header.h>
++#include <cstring>
++#include <tr1/cstdint>
++#include <rpmtypes.h>
++#include <rpmiotypes.h>
++#include <rpmtag.h>
++#include <rpmts.h>
++#include <rpmrc.h>
++#include <rpmdb.h>
++#include <rpmmacro.h>
++#include <rpmio.h>
++#include <rpmcli.h>
+ 
+ #ifndef xfree
+ #define xfree free
+ #endif
+ 
+-}
+-
+ #if ! HAVE_LIBRPMIO && HAVE_NSS
+ extern "C" {
+ #include <nss.h>
+@@ -51,7 +52,7 @@ missing_rpm_enlist (systemtap_session& s
+ {
+   static int rpm_init_done = 0;
+   rpmts ts;
+-  rpmdbMatchIterator mi;
++  rpmmi mi;
+   int count = 0;
+ 
+   if (filename == NULL)
+@@ -90,8 +91,8 @@ missing_rpm_enlist (systemtap_session& s
+ 	  errmsg_t err;
+ 	  size_t rpminfolen = strlen(rpm_type);
+ 	  size_t srcrpmlen = sizeof (".src.rpm") - 1;
+-	  rpmdbMatchIterator mi_rpminfo;
+-	  h = rpmdbNextIterator(mi);
++	  rpmmi mi_rpminfo;
++	  h = rpmmiNext(mi);
+ 	  if (h == NULL)
+ 	    break;
+ 	  /* Verify the kernel file is not already installed.  */
+@@ -138,21 +139,23 @@ missing_rpm_enlist (systemtap_session& s
+ 	  /* s = `-debuginfo-%{version}-%{release}.%{arch}' */
+ 
+ 	  /* RPMDBI_PACKAGES requires keylen == sizeof (int).  */
+-	  /* RPMDBI_LABEL is an interface for NVR-based dbiFindByLabel().  */
+-	  mi_rpminfo = rpmtsInitIterator(ts, (rpmTag)  RPMDBI_LABEL,
++	  /* RPMTAG_NVRA is an interface for NVR-based dbiFindByLabel().  */
++	  mi_rpminfo = rpmtsInitIterator(ts, (rpmTag)  RPMTAG_NVRA,
+ 					      rpminfo, 0);
+ 	  if (mi_rpminfo)
+ 	    {
+-	      rpmdbFreeIterator(mi_rpminfo);
++	      rpmmiFree(mi_rpminfo);
+ 	      count = 0;
+ 	      break;
+ 	    }
+ 	  /* The allocated memory gets utilized below for MISSING_RPM_HASH.  */
+           if(strcmp(rpm_type,"-debuginfo")==0){
++	    char *nvra = rpmExpand("%{___NVRA}", NULL);
+ 	    xfree(rpminfo);
+ 	    rpminfo = headerSprintf(h,
+-		      "%{name}-%{version}-%{release}.%{arch}",
++		      nvra,
+ 		      rpmTagTable, rpmHeaderFormats, &err);
++	    free(nvra);
+ 	  }
+ 	  if (!rpminfo)
+ 	    {
+@@ -176,7 +179,7 @@ missing_rpm_enlist (systemtap_session& s
+ 	  sess.rpms_to_install.insert(rpminfo);
+  	}
+       count++;
+-      rpmdbFreeIterator(mi);
++      rpmmiFree(mi);
+     }
+ 
+   rpmtsFree(ts);
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/systemtap.git/commitdiff/6fbeb569e1e7a2e548d89a7963ad424ce76bcc90



More information about the pld-cvs-commit mailing list