]> git.pld-linux.org Git - packages/net-snmp.git/blob - net-snmp-use-rpm-hrmib.patch
Bug 1314610 - snmpd complaining twice "Cannot statfs net:[********]#***: No such...
[packages/net-snmp.git] / net-snmp-use-rpm-hrmib.patch
1 --- net-snmp-5.4.1/agent/mibgroup/host/hr_swinst.c      2008-05-15 13:05:07.575307614 +0300
2 +++ net-snmp-5.4.1.hrmib/agent/mibgroup/host/hr_swinst.c        2008-05-15 13:04:24.676830108 +0300
3 @@ -183,6 +183,10 @@
4  #define        _PATH_HRSW_directory    "/var/db/pkg"
5  #endif
6  
7 +#if defined(RPM_HRMIB_PATH)
8 +#define        _PATH_HRSW_directory    RPM_HRMIB_PATH
9 +#endif
10 +
11  void
12  init_hr_swinst(void)
13  {
14 --- net-snmp-5.6/configure.d/config_os_libs1.orig       2010-10-24 10:37:25.527741043 +0200
15 +++ net-snmp-5.6/configure.d/config_os_libs1    2010-10-24 10:40:56.519744396 +0200
16 @@ -425,20 +425,34 @@
17  #   RPM checks
18  #
19  ##
20 -AC_CHECK_HEADERS(rpm/rpmlib.h rpm/header.h)
21 -
22 -AC_CHECK_HEADER(rpm/rpmlib.h,rpmlib_h=yes,rpmlib_h=no)
23 -AC_CHECK_HEADER(rpm/header.h,rpmheader_h=yes,rpmheader_h=no)
24 -
25 -if test "x$rpmheader_h" = "xno" -o "x$rpmlib_h" = "xno" ; then
26 -  if test "x$with_rpm" = "xyes" ; then
27 -    AC_MSG_ERROR([Could not find either the RPM header files needed and was specifically asked to use RPM support])
28 -  else
29 -    with_rpm=no
30 -  fi
31 +#
32 +# check if we can use rpm hrmib export
33 +if test "$with_rpm" != "no" ; then
34 +       AC_PATH_PROG([RPM], rpm)
35 +       if test -n "$RPM"; then
36 +               changequote(, )
37 +               RPM_HRMIB_PATH=$($RPM -E %{_hrmib_path} | sed -e 's,/[^/]\+$,,')
38 +               changequote([, ])
39 +               if test -n "$RPM_HRMIB_PATH"; then
40 +                       AC_DEFINE_UNQUOTED([RPM_HRMIB_PATH], ["$RPM_HRMIB_PATH"], [Directory where RPM exports packages hrmib information])
41 +               fi
42 +       fi
43  fi
44 +# otherwise try binary linkin
45 +if test -z "$RPM_HRMIB_PATH"; then
46 +       AC_CHECK_HEADERS(rpm/rpmlib.h rpm/header.h)
47 +
48 +       AC_CHECK_HEADER(rpm/rpmlib.h,rpmlib_h=yes,rpmlib_h=no)
49 +       AC_CHECK_HEADER(rpm/header.h,rpmheader_h=yes,rpmheader_h=no)
50 +
51 +       if test "x$rpmheader_h" = "xno" -o "x$rpmlib_h" = "xno" ; then
52 +         if test "x$with_rpm" = "xyes" ; then
53 +               AC_MSG_ERROR([Could not find either the RPM header files needed and was specifically asked to use RPM support])
54 +         else
55 +               with_rpm=no
56 +         fi
57 +       fi
58  
59 -#
60  # rpm libraries only needed for the host resources mib software
61  # installed tables (on linux in particular)
62  #
63 @@ -490,6 +504,12 @@
64      AC_DEFINE([_RPM_4_4_COMPAT], [], [Define if you have RPM 4.6 or newer to turn on legacy API]),
65      [[#include <rpm/rpmlib.h>]]
66    )
67 +
68 +  OLDLIBS=$LIBS
69 +  LIBS=$LMIBLIBS
70 +  AC_CHECK_FUNCS([rpmGetPath])
71 +  LIBS=$OLDLIBS
72 + fi
73  fi
74  
75  ##
76 --- net-snmp-5.5/configure.d/config_os_functions~       2009-07-26 20:20:55.000000000 +0200
77 +++ net-snmp-5.5/configure.d/config_os_functions        2010-05-12 14:35:39.421276242 +0200
78 @@ -114,15 +114,6 @@
79  #           (Agent)
80  ##
81  
82 -#       rpmGetPath check needs clean LIBS environment   (Linux)
83 -#
84 -if test "x$with_rpm" != "xno"; then
85 -    OLDLIBS=$LIBS
86 -    LIBS=$LMIBLIBS
87 -    AC_CHECK_FUNCS(rpmGetPath)
88 -    LIBS=$OLDLIBS
89 -fi
90 -
91  #       statfs( char *, struct fs_data* )               (Ultrix)
92  #
93  AC_MSG_CHECKING([[for two-argument statfs with struct fs_data (Ultrix)]])
94 --- net-snmp-5.6/agent/mibgroup/host/data_access/swinst_pkginfo.c~      2010-01-26 23:24:14.000000000 +0200
95 +++ net-snmp-5.6/agent/mibgroup/host/data_access/swinst_pkginfo.c       2010-12-16 00:13:22.027247692 +0200
96 @@ -52,6 +52,8 @@
97  {
98  #if defined(PKGLOC)
99      snprintf( pkg_directory, SNMP_MAXPATH, "%s", PKGLOC );
100 +#elif defined(RPM_HRMIB_PATH)
101 +    snprintf( pkg_directory, SNMP_MAXPATH, "%s", RPM_HRMIB_PATH);
102  #elif defined(hpux9)
103      snprintf( pkg_directory, SNMP_MAXPATH, "/system" );
104  #elif defined(hpux10) ||  defined(hpux11) 
105 --- net-snmp-5.6/agent/mibgroup/host/data_access/swinst.h       2010-12-16 00:14:13.634392176 +0200
106 +++ net-snmp-5.6/agent/mibgroup/host/data_access/swinst.h       2010-12-16 01:27:48.195543278 +0200
107 @@ -11,6 +11,10 @@
108  #ifndef NETSNMP_ACCESS_SWINST_CONFIG_H
109  #define NETSNMP_ACCESS_SWINST_CONFIG_H
110  
111 +// quick fix: this file is consulted before RPM_HRMIB_PATH check is made in configure, hardcode a define for now
112 +#define RPM_HRMIB_PATH "/var/cache/hrmib"
113 +
114 +
115  /*
116   * all platforms use this generic code
117   */
118 @@ -29,7 +29,7 @@
119      config_require(host/data_access/swinst_apt)
120  #elif defined( HAVE_LIBRPM ) && defined( linux )
121      config_require(host/data_access/swinst_rpm)
122 -#elif defined( HAVE_PKGLOCS_H ) || defined( hpux9 ) || defined( hpux10 ) || defined( hpux11 ) || defined( freebsd2 ) || defined( linux ) || defined( openbsd )
123 +#elif defined( HAVE_PKGLOCS_H ) || defined( RPM_HRMIB_PATH ) || defined( hpux9 ) || defined( hpux10 ) || defined( hpux11 ) || defined( freebsd2 ) || defined( linux ) || defined( openbsd )
124      config_require(host/data_access/swinst_pkginfo)
125  #else
126      config_warning(This platform does not yet support hrSWInstalledTable rewrites)
This page took 0.033322 seconds and 3 git commands to generate.