ports/118720: Update port: sysutils/ipmitool add support for latest freeipmi

Dmitry Frolov frolov at riss-telecom.ru
Sat Dec 15 14:40:04 UTC 2007


>Number:         118720
>Category:       ports
>Synopsis:       Update port: sysutils/ipmitool add support for latest freeipmi
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          maintainer-update
>Submitter-Id:   current-users
>Arrival-Date:   Sat Dec 15 14:40:03 UTC 2007
>Closed-Date:
>Last-Modified:
>Originator:     Dmitry Frolov
>Release:        FreeBSD 6.2-PRERELEASE amd64
>Organization:
RISS-Telecom
>Environment:
System: FreeBSD *******.riss-telecom.ru 6.2-PRERELEASE FreeBSD 6.2-PRERELEASE #1: Mon Sep 25 18:02:20 NOVST 2006     root@*******.riss-telecom.ru:/usr/obj/usr/src/sys/MERCURY  amd64
>Description:
    - Add support for latest sysutils/freeipmi port (allows building
      with latest freeipmi library when WITH_FREEIPMI is specified).
>How-To-Repeat:
>Fix:

diff -u -ruN /usr/ports/sysutils/ipmitool/Makefile ./Makefile
--- /usr/ports/sysutils/ipmitool/Makefile	Wed Jul 25 15:51:57 2007
+++ ./Makefile	Sat Dec 15 20:08:04 2007
@@ -48,6 +48,13 @@
 .if defined(WITH_FREEIPMI) || \
 	(exists(${LOCALBASE}/include/freeipmi/freeipmi.h) && \
 		!defined(WITHOUT_FREEIPMI))
+# Support for FreeIPMI 0.4.x and 0.5.x API
+EXTRA_PATCHES+=	${FILESDIR}/freeipmi-support.patch
+USE_AUTOTOOLS+=	autoconf:261 libtool:15 aclocal:19 automake:19
+# libtool15 installs it's aclocal macros into ${LOCALBASE}/share/aclocal
+ACLOCAL_ARGS+=	--acdir=${ACLOCAL_DIR} -I ${LOCALBASE}/share/aclocal
+# Make automake quiet about missing NEWS and ChangeLog files
+AUTOMAKE_ARGS+=	--foreign
 LIB_DEPENDS+=	freeipmi:${PORTSDIR}/sysutils/freeipmi
 CPPFLAGS+=	-I${LOCALBASE}/include
 LDFLAGS+=	-L${LOCALBASE}/lib
diff -u -ruN /usr/ports/sysutils/ipmitool/files/freeipmi-support.patch ./files/freeipmi-support.patch
--- /usr/ports/sysutils/ipmitool/files/freeipmi-support.patch	Thu Jan  1 07:00:00 1970
+++ ./files/freeipmi-support.patch	Sat Dec 15 19:25:26 2007
@@ -0,0 +1,189 @@
+diff -u -ruN ../ipmitool-1.8.9/configure.in ./configure.in
+--- ../ipmitool-1.8.9/configure.in	Wed Mar  7 04:15:35 2007
++++ ./configure.in	Sat Dec 15 19:22:10 2007
+@@ -239,7 +239,7 @@
+ fi
+ if test "x$enable_intf_free" = "xyes"; then
+ dnl Determine if you got the right FreeIPMI version  
+-    AC_MSG_CHECKING([for good libfreeipmi version])
++    AC_MSG_CHECKING([for libfreeipmi version 0.3.0])
+     AC_TRY_COMPILE([
+ #include <sys/types.h>	/* For size_t */
+ #include <stdio.h>	/* For NULL */
+@@ -253,13 +253,65 @@
+                            0,
+                            NULL,
+                            0);
+-    ], ac_free_version_good=yes,ac_free_version_good=no)
+-    AC_MSG_RESULT($ac_free_version_good)
+-    if test "x$ac_free_version_good" = "xyes"; then
++    ], ac_free_version_0_3_0=yes,ac_free_version_0_3_0=no)
++    AC_MSG_RESULT($ac_free_version_0_3_0)
++    AC_MSG_CHECKING([for libfreeipmi version 0.4.0])
++    AC_TRY_COMPILE([
++#include <sys/types.h>	/* For size_t */
++#include <stdio.h>	/* For NULL */
++#include <freeipmi/freeipmi.h>
++#include <freeipmi/udm/ipmi-udm.h>
++    ], [
++    ipmi_device_t dev = NULL;
++    int rv;
++    dev = ipmi_device_create();
++    rv = ipmi_open_inband(dev,
++                          IPMI_DEVICE_KCS,
++                          0,
++                          0,
++                          0,
++                          NULL,
++                          0);
++    ], ac_free_version_0_4_0=yes,ac_free_version_0_4_0=no)
++    AC_MSG_RESULT($ac_free_version_0_4_0)
++
++    AC_MSG_CHECKING([for libfreeipmi version 0.5.0])
++    AC_TRY_COMPILE([
++#include <sys/types.h>	/* For size_t */
++#include <stdio.h>	/* For NULL */
++#include <freeipmi/freeipmi.h>
++#include <freeipmi/udm/ipmi-udm.h>
++    ], [
++    ipmi_device_t dev = NULL;
++    int rv;
++    dev = ipmi_device_create();
++    rv = ipmi_open_inband(dev,
++                          IPMI_DEVICE_KCS,
++                          0,
++                          0,
++                          0,
++                          NULL,
++                          0,
++                          0);
++    ], ac_free_version_0_5_0=yes,ac_free_version_0_5_0=no)
++    AC_MSG_RESULT($ac_free_version_0_5_0)
++
++    if test "x$ac_free_version_0_3_0" = "xyes" \
++       || test "x$ac_free_version_0_4_0" = "xyes" \
++       || test "x$ac_free_version_0_5_0" = "xyes"; then
+        AC_DEFINE(IPMI_INTF_FREE, [1], [Define to 1 to enable FreeIPMI interface.])
+        AC_SUBST(INTF_FREE, [free])
+        AC_SUBST(INTF_FREE_LIB, [libintf_free.la])
+        IPMITOOL_INTF_LIB="$IPMITOOL_INTF_LIB free/libintf_free.la"
++       if test "x$ac_free_version_0_3_0" = "xyes"; then
++          AC_DEFINE(IPMI_INTF_FREE_VERSION_0_3_0, [1], [Define to 1 for FreeIPMI 0.3.0.])
++       fi
++       if test "x$ac_free_version_0_4_0" = "xyes"; then
++          AC_DEFINE(IPMI_INTF_FREE_VERSION_0_4_0, [1], [Define to 1 for FreeIPMI 0.4.0.])
++       fi
++       if test "x$ac_free_version_0_5_0" = "xyes"; then
++          AC_DEFINE(IPMI_INTF_FREE_VERSION_0_5_0, [1], [Define to 1 for FreeIPMI 0.5.0.])
++       fi
+     else
+        enable_intf_free=no
+     fi
+diff -u -ruN ../ipmitool-1.8.9/src/plugins/free/free.c ./src/plugins/free/free.c
+--- ../ipmitool-1.8.9/src/plugins/free/free.c	Fri Feb 23 00:17:46 2007
++++ ./src/plugins/free/free.c	Sat Dec 15 19:22:10 2007
+@@ -58,6 +58,7 @@
+                 return -1;
+         }
+ 
++#if IPMI_INTF_FREE_VERSION_0_3_0
+         if (!(dev = ipmi_open_inband (IPMI_DEVICE_KCS,
+                                       0,
+                                       0,
+@@ -74,19 +75,80 @@
+                         goto cleanup;
+                 }
+         }
++#elif IPMI_INTF_FREE_VERSION_0_4_0
++        if (!(dev = ipmi_device_create())) {
++                perror("ipmi_open_inband()");
++                goto cleanup;
++        }
++        if (ipmi_open_inband (dev,
++                              IPMI_DEVICE_KCS,
++                              0,
++                              0,
++                              0,
++                              NULL,
++                              IPMI_FLAGS_DEFAULT) < 0) {
++                if (ipmi_open_inband (dev,
++                                      IPMI_DEVICE_SSIF,
++                                      0,
++                                      0,
++                                      0,
++                                      NULL,
++                                      IPMI_FLAGS_DEFAULT) < 0) {
++                       fprintf(stderr, 
++                               "ipmi_open_inband(): %s\n",
++                               ipmi_device_strerror(ipmi_device_errnum(dev)));
++                       goto cleanup;
++                }
++        }
++#elif IPMI_INTF_FREE_VERSION_0_5_0
++        if (!(dev = ipmi_device_create())) {
++                perror("ipmi_open_inband()");
++                goto cleanup;
++        }
++        if (ipmi_open_inband (dev,
++                              IPMI_DEVICE_KCS,
++                              0,
++                              0,
++                              0,
++                              NULL,
++                              0,
++                              IPMI_FLAGS_DEFAULT) < 0) {
++                if (ipmi_open_inband (dev,
++                                      IPMI_DEVICE_SSIF,
++                                      0,
++                                      0,
++                                      0,
++                                      NULL,
++                                      0,
++                                      IPMI_FLAGS_DEFAULT) < 0) {
++                       fprintf(stderr, 
++                               "ipmi_open_inband(): %s\n",
++                               ipmi_device_strerror(ipmi_device_errnum(dev)));
++                       goto cleanup;
++                }
++        }
++#endif
+ 
+ 	intf->opened = 1;
+ 	return 0;
+  cleanup:
+-        if (dev)
++        if (dev) {
+                 ipmi_close_device(dev);
++#if IPMI_INTF_FREE_VERSION_0_4_0
++                ipmi_device_destroy(dev);
++#endif
++        }
+         return -1;
+ }
+ 
+ static void ipmi_free_close(struct ipmi_intf * intf)
+ {
+-        if (dev)
++        if (dev) {
+                 ipmi_close_device(dev);
++#if IPMI_INTF_FREE_VERSION_0_4_0
++                ipmi_device_destroy(dev);
++#endif
++        }
+ 	intf->opened = 0;
+ }
+ 
+@@ -132,7 +194,13 @@
+                                    req->msg.data_len + 1,
+                                    rs_buf, 
+                                    rs_buf_len)) < 0) {
++#if IPMI_INTF_FREE_VERSION_0_3_0
+                 perror("ipmi_cmd_raw");
++#elif IPMI_INTF_FREE_VERSION_0_4_0
++                fprintf(stderr,
++                        "ipmi_cmd_raw: %s\n",
++                        ipmi_device_strerror(ipmi_device_errnum(dev)));
++#endif
+                 return NULL;
+         }
+ 

>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list