[packages/nut] - enable ipmi driver; enable avahi; patches from FC

arekm arekm at pld-linux.org
Sun Jan 13 12:59:40 CET 2013


commit e25b716878fb6f6955ba53980cbcfdc8e005c85d
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date:   Sun Jan 13 12:59:37 2013 +0100

    - enable ipmi driver; enable avahi; patches from FC

 nut-2.6.5-ipmifix.patch     | 138 ++++++++++++++++++++++++++++++++++++++++++++
 nut-2.6.5-pthreadfix.patch  |  32 ++++++++++
 nut-2.6.5-unreachable.patch |  39 +++++++++++++
 nut.spec                    |  17 +++++-
 4 files changed, 225 insertions(+), 1 deletion(-)
---
diff --git a/nut.spec b/nut.spec
index 2a82f81..69c097f 100644
--- a/nut.spec
+++ b/nut.spec
@@ -28,12 +28,18 @@ Patch3:		%{name}-upssched-cmd-sysconf.patch
 Patch4:		%{name}-matrix.patch
 Patch5:		systemd-sysconfig.patch
 Patch6:		bcmxcp-off-by-one.patch
+Patch7:		nut-2.6.5-ipmifix.patch
+Patch8:		nut-2.6.5-pthreadfix.patch
+Patch9:		nut-2.6.5-unreachable.patch
 URL:		http://www.networkupstools.org/
 BuildRequires:	autoconf
 BuildRequires:	automake
+BuildRequires:	avahi-devel
 %{?with_hal:BuildRequires:	dbus-glib-devel}
+BuildRequires:	freeipmi-devel
 %{?with_cgi:BuildRequires:	gd-devel >= 2.0.15}
 %{?with_hal:BuildRequires:	hal-devel >= 0.5.8}
+BuildRequires:	libltdl-devel
 BuildRequires:	libtool
 %{?with_usb:BuildRequires:	libusb-compat-devel}
 BuildRequires:	libwrap-devel
@@ -195,6 +201,9 @@ Pliki do integracji NUT-a z HAL-em.
 %patch4 -p1
 %patch5 -p1
 %patch6 -p1
+%patch7 -p1
+%patch8 -p1
+%patch9 -p1
 
 %build
 cp -f /usr/share/automake/config.sub .
@@ -210,11 +219,14 @@ cp -f /usr/share/automake/config.sub .
 	--with%{!?with_snmp:out}-snmp \
 	--with%{!?with_hal:out}-hal \
 	--with%{!?with_cgi:out}-cgi \
+	--with-avahi \
+	--with-snmp \
+	--with-ipmi \
 	--with-dev \
 	--with%{!?with_neon:out}-neon \
 	--with-ssl \
-	--with-ipv6 \
 	%{?with_usb:--with-udev-dir=/etc/udev} \
+	%{!?with_hal:--without-hal} \
 	%{?with_hal:--with-hal-callouts-path=%{_libdir}/hal} \
 	%{?with_hal:--with-hal-fdi-path=%{_datadir}/hal/fdi/information/20thirdparty} \
 	--with-statepath=%{_var}/lib/ups \
@@ -379,6 +391,7 @@ fi
 %attr(755,root,root) /lib/nut/mge-utalk
 %attr(755,root,root) /lib/nut/microdowell
 %{?with_neon:%attr(755,root,root) /lib/nut/netxml-ups}
+%attr(755,root,root) /lib/nut/nut-ipmipsu
 %attr(755,root,root) /lib/nut/oldmge-shut
 %attr(755,root,root) /lib/nut/oneac
 %attr(755,root,root) /lib/nut/optiups
@@ -427,6 +440,7 @@ fi
 %{_mandir}/man8/mge-utalk.8*
 %{_mandir}/man8/microdowell.8*
 %{?with_neon:%{_mandir}/man8/netxml-ups.8*}
+%{_mandir}/man8/nut-ipmipsu.8*
 %{_mandir}/man8/nutupsdrv.8*
 %{_mandir}/man8/oneac.8*
 %{_mandir}/man8/optiups.8*
@@ -443,6 +457,7 @@ fi
 %{?with_usb:%{_mandir}/man8/usbhid-ups.8*}
 %{_mandir}/man8/victronups.8*
 %{?with_usb:%config(noreplace) %verify(not md5 mtime size) %{_udevrulesdir}/52-nut-usbups.rules}
+%config(noreplace) %verify(not md5 mtime size) %{_udevrulesdir}/52-nut-ipmipsu.rules
 
 %files common
 %defattr(644,root,root,755)
diff --git a/nut-2.6.5-ipmifix.patch b/nut-2.6.5-ipmifix.patch
new file mode 100644
index 0000000..db7bff8
--- /dev/null
+++ b/nut-2.6.5-ipmifix.patch
@@ -0,0 +1,138 @@
+diff -up nut-2.6.5/drivers/nut-libfreeipmi.c.ipmifix nut-2.6.5/drivers/nut-libfreeipmi.c
+--- nut-2.6.5/drivers/nut-libfreeipmi.c.ipmifix	2012-07-31 19:38:59.000000000 +0200
++++ nut-2.6.5/drivers/nut-libfreeipmi.c	2012-09-04 09:42:48.000000000 +0200
+@@ -49,6 +49,36 @@
+ #include "nut-ipmi.h"
+ #include "dstate.h"
+ 
++#ifdef HAVE_FREEIPMI_11X_12X
++#define ipmi_fru_parse_ctx_t ipmi_fru_ctx_t
++#define nut_ipmi_fru_parse_close_device_id nut_ipmi_fru_close_device_id
++#define nut_ipmi_fru_parse_ctx_destroy nut_ipmi_fru_ctx_destroy
++#define nut_ipmi_fru_parse_ctx_create nut_ipmi_fru_ctx_create
++#define nut_ipmi_fru_parse_ctx_set_flags nut_ipmi_fru_ctx_set_flags
++#define nut_ipmi_fru_parse_open_device_id nut_ipmi_fru_open_device_id
++#define nut_ipmi_fru_parse_ctx_errormsg nut_ipmi_fru_ctx_errormsg
++#define nut_ipmi_fru_parse_next nut_ipmi_fru_next
++#define IPMI_FRU_PARSE_AREA_SIZE_MAX IPMI_FRU_AREA_SIZE_MAX
++#define IPMI_FRU_PARSE_FLAGS_SKIP_CHECKSUM_CHECKS IPMI_FRU_FLAGS_SKIP_CHECKSUM_CHECKS
++#define IPMI_FRU_PARSE_AREA_TYPE_MULTIRECORD_POWER_SUPPLY_INFORMATION IPMI_FRU_AREA_TYPE_MULTIRECORD_POWER_SUPPLY_INFORMATION
++#define IPMI_FRU_PARSE_AREA_TYPE_BOARD_INFO_AREA IPMI_FRU_AREA_TYPE_BOARD_INFO_AREA
++#define ipmi_fru_parse_field_t ipmi_fru_field_t
++#define ipmi_fru_parse_ctx_create ipmi_fru_ctx_create
++#define ipmi_fru_parse_ctx_set_flags ipmi_fru_ctx_set_flags
++#define ipmi_fru_parse_ctx_strerror ipmi_fru_ctx_strerror
++#define ipmi_fru_parse_ctx_errnum ipmi_fru_ctx_errnum
++#define ipmi_fru_parse_open_device_id ipmi_fru_open_device_id
++#define ipmi_fru_parse_ctx_errormsg ipmi_fru_ctx_errormsg
++#define ipmi_fru_parse_read_data_area ipmi_fru_read_data_area
++#define ipmi_fru_parse_type_length_field_to_string ipmi_fru_type_length_field_to_string
++#define ipmi_fru_parse_close_device_id ipmi_fru_close_device_id
++#define ipmi_fru_parse_ctx_destroy ipmi_fru_ctx_destroy
++#define ipmi_fru_parse_multirecord_power_supply_information ipmi_fru_multirecord_power_supply_information
++#define ipmi_fru_parse_board_info_area ipmi_fru_board_info_area
++#define ipmi_fru_parse_next ipmi_fru_next
++#define IPMI_FRU_PARSE_AREA_STRING_MAX IPMI_FRU_AREA_STRING_MAX
++#endif
++
+ /* FreeIPMI defines */
+ #define IPMI_FRU_STR_BUFLEN    1024
+ /* haven't seen a motherboard with more than 2-3 so far,
+diff -up nut-2.6.5/m4/nut_check_libfreeipmi.m4.ipmifix nut-2.6.5/m4/nut_check_libfreeipmi.m4
+--- nut-2.6.5/m4/nut_check_libfreeipmi.m4.ipmifix	2012-07-31 19:38:56.000000000 +0200
++++ nut-2.6.5/m4/nut_check_libfreeipmi.m4	2012-09-04 09:45:45.399328962 +0200
+@@ -66,15 +66,23 @@ if test -z "${nut_have_libfreeipmi_seen}
+ 	dnl when version cannot be tested (prior to 1.0.5, with no pkg-config)
+ 	dnl we have to check for some specific functions
+ 	AC_SEARCH_LIBS([ipmi_ctx_find_inband], [freeipmi], [], [nut_have_freeipmi=no])
+-	AC_SEARCH_LIBS([ipmi_fru_parse_ctx_create], [freeipmi], [], [nut_have_freeipmi=no])
+ 
+ 	AC_SEARCH_LIBS([ipmi_monitoring_init], [ipmimonitoring], [nut_have_freeipmi_monitoring=yes], [nut_have_freeipmi_monitoring=no])
+ 	AC_SEARCH_LIBS([ipmi_monitoring_sensor_read_record_id], [ipmimonitoring], [], [nut_have_freeipmi_monitoring=no])
+ 
+ 	dnl Check for FreeIPMI 1.1.X / 1.2.X which implies API changes!
+-	AC_SEARCH_LIBS([ipmi_sdr_cache_ctx_destroy], [freeipmi], [nut_have_freeipmi_11x_12x=no], [])
++	nut_have_freeipmi_old="${nut_have_freeipmi}"
++	AC_SEARCH_LIBS([ipmi_fru_parse_ctx_create], [freeipmi], [nut_have_freeipmi_11x_12x=no], [nut_have_freeipmi_old=no])
++	AC_SEARCH_LIBS([ipmi_sdr_cache_ctx_destroy], [freeipmi], [nut_have_freeipmi_11x_12x=no], [nut_have_freeipmi_old=no])
++	AC_SEARCH_LIBS([ipmi_fru_ctx_create], [freeipmi], [nut_have_freeipmi_11x_12x=yes], [nut_have_freeipmi_11x_12x=no])
+ 	AC_SEARCH_LIBS([ipmi_sdr_ctx_destroy], [freeipmi], [nut_have_freeipmi_11x_12x=yes], [nut_have_freeipmi_11x_12x=no])
+ 
++	if test "${nut_have_freeipmi}${nut_have_freeipmi_11x_12x}" = "yesyes"; then
++		AC_DEFINE(HAVE_FREEIPMI_11X_12X, 1, [Define if FreeIPMI 1.1.X / 1.2.X support is available])
++        elif test "${nut_have_freeipmi_old}" = "no"; then
++		nut_have_freeipmi="no"
++	fi
++
+ 	if test "${nut_have_freeipmi}" = "yes"; then
+ 		nut_with_ipmi="yes"
+ 		nut_ipmi_lib="(FreeIPMI)"
+@@ -84,10 +92,6 @@ if test -z "${nut_have_libfreeipmi_seen}
+ 		LIBIPMI_LIBS="${LIBS}"
+ 	fi
+ 
+-	if test "${nut_have_freeipmi_11x_12x}" = "yes"; then
+-		AC_DEFINE(HAVE_FREEIPMI_11X_12X, 1, [Define if FreeIPMI 1.1.X / 1.2.X support is available])
+-	fi
+-
+ 	if test "${nut_have_freeipmi_monitoring}" = "yes"; then
+ 		AC_DEFINE(HAVE_FREEIPMI_MONITORING, 1, [Define if FreeIPMI monitoring support is available])
+ 	fi
+diff -up nut-2.6.5/tools/nut-scanner/scan_ipmi.c.ipmifix nut-2.6.5/tools/nut-scanner/scan_ipmi.c
+--- nut-2.6.5/tools/nut-scanner/scan_ipmi.c.ipmifix	2012-07-31 19:38:58.000000000 +0200
++++ nut-2.6.5/tools/nut-scanner/scan_ipmi.c	2012-09-04 09:42:35.000000000 +0200
+@@ -34,24 +34,50 @@ static char * libname = "libfreeipmi";
+ static lt_dlhandle dl_handle = NULL;
+ static const char *dl_error = NULL;
+ 
+-static int (*nut_ipmi_fru_parse_close_device_id) (ipmi_fru_parse_ctx_t ctx);
+-static void (*nut_ipmi_fru_parse_ctx_destroy) (ipmi_fru_parse_ctx_t ctx);
+ #ifdef HAVE_FREEIPMI_11X_12X
+ static void (*nut_ipmi_sdr_ctx_destroy) (ipmi_sdr_ctx_t ctx);
++static int (*nut_ipmi_fru_close_device_id) (ipmi_fru_ctx_t ctx);
++static void (*nut_ipmi_fru_ctx_destroy) (ipmi_fru_ctx_t ctx);
++static ipmi_fru_ctx_t (*nut_ipmi_fru_ctx_create) (ipmi_ctx_t ipmi_ctx);
++static int (*nut_ipmi_fru_ctx_set_flags) (ipmi_fru_ctx_t ctx, unsigned int flags);
++static int (*nut_ipmi_fru_open_device_id) (ipmi_fru_ctx_t ctx, uint8_t fru_device_id);
++static char * (*nut_ipmi_fru_ctx_errormsg) (ipmi_fru_ctx_t ctx);
++static int (*nut_ipmi_fru_next) (ipmi_fru_ctx_t ctx);
+ #else /* HAVE_FREEIPMI_11X_12X */
++static int (*nut_ipmi_fru_parse_close_device_id) (ipmi_fru_parse_ctx_t ctx);
++static void (*nut_ipmi_fru_parse_ctx_destroy) (ipmi_fru_parse_ctx_t ctx);
+ static void (*nut_ipmi_sdr_cache_ctx_destroy) (ipmi_sdr_cache_ctx_t ctx);
+ static void (*nut_ipmi_sdr_parse_ctx_destroy) (ipmi_sdr_parse_ctx_t ctx);
+-#endif /* HAVE_FREEIPMI_11X_12X */
+ static ipmi_fru_parse_ctx_t (*nut_ipmi_fru_parse_ctx_create) (ipmi_ctx_t ipmi_ctx);
+ static int (*nut_ipmi_fru_parse_ctx_set_flags) (ipmi_fru_parse_ctx_t ctx, unsigned int flags);
+ static int (*nut_ipmi_fru_parse_open_device_id) (ipmi_fru_parse_ctx_t ctx, uint8_t fru_device_id);
+ static char * (*nut_ipmi_fru_parse_ctx_errormsg) (ipmi_fru_parse_ctx_t ctx);
++static int (*nut_ipmi_fru_parse_next) (ipmi_fru_parse_ctx_t ctx);
++#endif /* HAVE_FREEIPMI_11X_12X */
++
++#ifndef ipmi_fru_parse_ctx_t
++#define ipmi_fru_parse_ctx_t ipmi_fru_ctx_t
++#endif
++
++#ifndef nut_ipmi_fru_parse_close_device_id
++#define nut_ipmi_fru_parse_close_device_id nut_ipmi_fru_close_device_id
++#endif
++
++#define nut_ipmi_fru_parse_ctx_destroy nut_ipmi_fru_ctx_destroy
++#define nut_ipmi_fru_parse_ctx_create nut_ipmi_fru_ctx_create
++#define nut_ipmi_fru_parse_ctx_set_flags nut_ipmi_fru_ctx_set_flags
++#define nut_ipmi_fru_parse_open_device_id nut_ipmi_fru_open_device_id
++#define nut_ipmi_fru_parse_ctx_errormsg nut_ipmi_fru_ctx_errormsg
++#define nut_ipmi_fru_parse_next nut_ipmi_fru_next
++#define IPMI_FRU_PARSE_AREA_SIZE_MAX IPMI_FRU_AREA_SIZE_MAX
++#define IPMI_FRU_PARSE_FLAGS_SKIP_CHECKSUM_CHECKS IPMI_FRU_FLAGS_SKIP_CHECKSUM_CHECKS
++#define IPMI_FRU_PARSE_AREA_TYPE_MULTIRECORD_POWER_SUPPLY_INFORMATION IPMI_FRU_AREA_TYPE_MULTIRECORD_POWER_SUPPLY_INFORMATION
++
+ static int (*nut_ipmi_fru_parse_read_data_area) (ipmi_fru_parse_ctx_t ctx,
+                                    unsigned int *area_type,
+                                    unsigned int *area_length,
+                                    void *areabuf,
+                                    unsigned int areabuflen);
+-static int (*nut_ipmi_fru_parse_next) (ipmi_fru_parse_ctx_t ctx);
+ static ipmi_ctx_t (*nut_ipmi_ctx_create) (void);
+ static int (*nut_ipmi_ctx_find_inband) (ipmi_ctx_t ctx,
+                           ipmi_driver_type_t *driver_type,
diff --git a/nut-2.6.5-pthreadfix.patch b/nut-2.6.5-pthreadfix.patch
new file mode 100644
index 0000000..9aca92b
--- /dev/null
+++ b/nut-2.6.5-pthreadfix.patch
@@ -0,0 +1,32 @@
+diff -up nut-2.6.5/tools/nut-scanner/nut-scanner.c.pthreadfix nut-2.6.5/tools/nut-scanner/nut-scanner.c
+--- nut-2.6.5/tools/nut-scanner/nut-scanner.c.pthreadfix	2012-09-06 13:25:03.856936357 +0200
++++ nut-2.6.5/tools/nut-scanner/nut-scanner.c	2012-09-06 13:25:03.881936493 +0200
+@@ -434,22 +434,22 @@ display_help:
+ 	}
+ 
+ #ifdef HAVE_PTHREAD
+-	if( allow_usb && nutscan_avail_usb ) {
++	if( allow_usb && nutscan_avail_usb && thread[TYPE_USB]) {
+ 		pthread_join(thread[TYPE_USB],NULL);
+ 	}
+-	if( allow_snmp && nutscan_avail_snmp ) {
++	if( allow_snmp && nutscan_avail_snmp && thread[TYPE_SNMP]) {
+ 		pthread_join(thread[TYPE_SNMP],NULL);
+ 	}
+-	if( allow_xml && nutscan_avail_xml_http ) {
++	if( allow_xml && nutscan_avail_xml_http && thread[TYPE_XML]) {
+ 		pthread_join(thread[TYPE_XML],NULL);
+ 	}
+-	if( allow_oldnut && nutscan_avail_nut ) {
++	if( allow_oldnut && nutscan_avail_nut && thread[TYPE_NUT]) {
+ 		pthread_join(thread[TYPE_NUT],NULL);
+ 	}
+-	if( allow_avahi && nutscan_avail_avahi ) {
++	if( allow_avahi && nutscan_avail_avahi && thread[TYPE_AVAHI]) {
+ 		pthread_join(thread[TYPE_AVAHI],NULL);
+ 	}
+-	if( allow_ipmi && nutscan_avail_ipmi ) {
++	if( allow_ipmi && nutscan_avail_ipmi && thread[TYPE_IPMI]) {
+ 		pthread_join(thread[TYPE_IPMI],NULL);
+ 	}
+ #endif /* HAVE_PTHREAD */
diff --git a/nut-2.6.5-unreachable.patch b/nut-2.6.5-unreachable.patch
new file mode 100644
index 0000000..3c9db41
--- /dev/null
+++ b/nut-2.6.5-unreachable.patch
@@ -0,0 +1,39 @@
+diff -up nut-2.6.5/scripts/python/app/NUT-Monitor.unreachable nut-2.6.5/scripts/python/app/NUT-Monitor
+--- nut-2.6.5/scripts/python/app/NUT-Monitor.unreachable	2012-07-31 19:38:56.000000000 +0200
++++ nut-2.6.5/scripts/python/app/NUT-Monitor	2013-01-07 18:04:26.532531441 +0100
+@@ -674,6 +674,11 @@ class interface :
+             self.gui_status_notification( _("Device '%s' not found on server") % self.__current_ups, "warning.png" )
+             return
+ 
++        if not self.__ups_handler.CheckUPSAvailable( self.__current_ups ): 
++            self.gui_status_message( _("UPS '{0}' is not reachable").format( self.__current_ups ) )
++            self.gui_status_notification( _("UPS '{0}' is not reachable").format( self.__current_ups ), "warning.png" )
++            return
++
+         self.__connected = True
+         self.__widgets["ups_connect"].hide()
+         self.__widgets["ups_disconnect"].show()
+diff -up nut-2.6.5/scripts/python/module/PyNUT.py.unreachable nut-2.6.5/scripts/python/module/PyNUT.py
+--- nut-2.6.5/scripts/python/module/PyNUT.py.unreachable	2012-07-31 19:38:56.000000000 +0200
++++ nut-2.6.5/scripts/python/module/PyNUT.py	2013-01-07 17:41:26.548440712 +0100
+@@ -158,6 +158,20 @@ available vars.
+ 
+         return( ups_vars )
+ 
++    def CheckUPSAvailable( self, ups="") :
++        """ Check whether UPS is reachable
++
++Just tries to contact UPS with safe command.
++The result is True (rechable) or False (unreachable)
++        """
++        self.__srv_handler.write( "LIST CMD %s\n" % ups )
++        result = self.__srv_handler.read_until( "\n" )
++        if result != "BEGIN LIST CMD %s\n" % ups :
++            return False
++
++        self.__srv_handler.read_until( "END LIST CMD %s\n" % ups )
++        return True
++
+     def GetUPSCommands( self, ups="" ) :
+         """ Get all available commands for the specified UPS
+ 
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/nut.git/commitdiff/e25b716878fb6f6955ba53980cbcfdc8e005c85d



More information about the pld-cvs-commit mailing list