]> TLD Linux GIT Repositories - packages/systemtap.git/blob - systemtap-rpm5-support.patch
- drop R: kernel-module-build
[packages/systemtap.git] / systemtap-rpm5-support.patch
1 --- systemtap-1.5/configure.ac.rpm5~    2011-05-23 21:21:36.000000000 +0200
2 +++ systemtap-1.5/configure.ac  2011-09-26 08:22:28.072465175 +0200
3 @@ -449,6 +449,19 @@ AC_ARG_WITH([rpm],
4    [AS_HELP_STRING([--with-rpm],
5                    [query rpm database for missing debuginfos])], [], [with_rpm="auto"])
6  if test "$with_rpm" != "no"; then
7 +  PKG_CHECK_MODULES([RPM], [rpm], [
8 +      AC_DEFINE_UNQUOTED([HAVE_RPM],1,[Define if RPM backend is available])
9 +      CPPFLAGS="$RPM_CFLAGS $CPPFLAGS"
10 +      stap_LIBS="$stap_LIBS $RPM_LIBS"
11 +   ], [
12 +      AC_PATH_PROG(RPM_PATH,rpm,none)
13 +      if test "$RPM_PATH" = "none"; then
14 +         AC_MSG_ERROR([RPM executable was not found in your system])
15 +      else
16 +         AC_DEFINE_UNQUOTED([HAVE_RPM],1,[Define if RPM backend is available])
17 +      fi
18 +   ]
19 +)
20    AC_CHECK_LIB(rpm, rpmtsInitIterator, [
21                      AC_DEFINE([HAVE_LIBRPM],[1],[have librpm])
22                      stap_LIBS="$stap_LIBS -lrpm"
23 --- systemtap-1.5/rpm_finder.cxx.rpm5~  2011-05-23 21:21:36.000000000 +0200
24 +++ systemtap-1.5/rpm_finder.cxx        2011-09-26 08:14:28.829226303 +0200
25 @@ -20,21 +20,22 @@ using namespace std;
26  
27  #ifdef HAVE_LIBRPM
28  
29 -extern "C" {
30 -
31 -#define _RPM_4_4_COMPAT
32 -#include <string.h>
33 -#include <rpm/rpmlib.h>
34 -#include <rpm/rpmts.h>
35 -#include <rpm/rpmdb.h>
36 -#include <rpm/header.h>
37 +#include <cstring>
38 +#include <tr1/cstdint>
39 +#include <rpmtypes.h>
40 +#include <rpmiotypes.h>
41 +#include <rpmtag.h>
42 +#include <rpmts.h>
43 +#include <rpmrc.h>
44 +#include <rpmdb.h>
45 +#include <rpmmacro.h>
46 +#include <rpmio.h>
47 +#include <rpmcli.h>
48  
49  #ifndef xfree
50  #define xfree free
51  #endif
52  
53 -}
54 -
55  #if ! HAVE_LIBRPMIO && HAVE_NSS
56  extern "C" {
57  #include <nss.h>
58 @@ -51,7 +52,7 @@ missing_rpm_enlist (systemtap_session& s
59  {
60    static int rpm_init_done = 0;
61    rpmts ts;
62 -  rpmdbMatchIterator mi;
63 +  rpmmi mi;
64    int count = 0;
65  
66    if (filename == NULL)
67 @@ -90,8 +91,8 @@ missing_rpm_enlist (systemtap_session& s
68           errmsg_t err;
69           size_t rpminfolen = strlen(rpm_type);
70           size_t srcrpmlen = sizeof (".src.rpm") - 1;
71 -         rpmdbMatchIterator mi_rpminfo;
72 -         h = rpmdbNextIterator(mi);
73 +         rpmmi mi_rpminfo;
74 +         h = rpmmiNext(mi);
75           if (h == NULL)
76             break;
77           /* Verify the kernel file is not already installed.  */
78 @@ -138,21 +139,23 @@ missing_rpm_enlist (systemtap_session& s
79           /* s = `-debuginfo-%{version}-%{release}.%{arch}' */
80  
81           /* RPMDBI_PACKAGES requires keylen == sizeof (int).  */
82 -         /* RPMDBI_LABEL is an interface for NVR-based dbiFindByLabel().  */
83 -         mi_rpminfo = rpmtsInitIterator(ts, (rpmTag)  RPMDBI_LABEL,
84 +         /* RPMTAG_NVRA is an interface for NVR-based dbiFindByLabel().  */
85 +         mi_rpminfo = rpmtsInitIterator(ts, (rpmTag)  RPMTAG_NVRA,
86                                               rpminfo, 0);
87           if (mi_rpminfo)
88             {
89 -             rpmdbFreeIterator(mi_rpminfo);
90 +             rpmmiFree(mi_rpminfo);
91               count = 0;
92               break;
93             }
94           /* The allocated memory gets utilized below for MISSING_RPM_HASH.  */
95            if(strcmp(rpm_type,"-debuginfo")==0){
96 +           char *nvra = rpmExpand("%{___NVRA}", NULL);
97             xfree(rpminfo);
98             rpminfo = headerSprintf(h,
99 -                     "%{name}-%{version}-%{release}.%{arch}",
100 +                     nvra,
101                       rpmTagTable, rpmHeaderFormats, &err);
102 +           free(nvra);
103           }
104           if (!rpminfo)
105             {
106 @@ -176,7 +179,7 @@ missing_rpm_enlist (systemtap_session& s
107           sess.rpms_to_install.insert(rpminfo);
108         }
109        count++;
110 -      rpmdbFreeIterator(mi);
111 +      rpmmiFree(mi);
112      }
113  
114    rpmtsFree(ts);