From db79e2eb795f8e9d8bc79629b9ee06be9bdd19cafe8b33e4fcfa86081fe85f47 Mon Sep 17 00:00:00 2001
From: Thomas Renninger <trenn@suse.com>
Date: Wed, 26 Sep 2018 14:29:13 +0000
Subject: [PATCH] - Update to 3.8.0 (fate#325975) - Remove ipmi plugin, it is
 deprecated for long time, does not build   anymore because selector_t changed
 to struct selector_s in   openIPMI-devel since 2.0.24. ipmidirect is compiled
 in and should   be used anyway. - Patch mainline: D
 openhpi-3.6.0_fix_net-snmp_disable_MD5.patch - Used spec-cleaner

OBS-URL: https://build.opensuse.org/package/show/systemsmanagement/openhpi?expand=0&rev=36
---
 _service                                   |  16 +++
 fix_openipmi_typedef_selector_change.patch |  29 +++++
 openhpi-3.4.0-systemd.patch                |  29 ++---
 openhpi-3.6.1.tar.gz                       |   3 -
 openhpi-3.8.0.tar.xz                       |   3 +
 openhpi.changes                            |  12 +++
 openhpi.spec                               | 117 +++++++--------------
 unlink-pidfile-on-error.patch              |   9 +-
 8 files changed, 119 insertions(+), 99 deletions(-)
 create mode 100644 _service
 create mode 100644 fix_openipmi_typedef_selector_change.patch
 delete mode 100644 openhpi-3.6.1.tar.gz
 create mode 100644 openhpi-3.8.0.tar.xz

diff --git a/_service b/_service
new file mode 100644
index 0000000..046d6c3
--- /dev/null
+++ b/_service
@@ -0,0 +1,16 @@
+<services>
+  <service name="tar_scm" mode="disabled">
+    <param name="scm">git</param>
+    <param name="url">https://github.com/open-hpi/openhpi.git</param>
+    <!--param name="revision">3.8.0</param-->
+    <param name="version">3.8.0</param>
+    <param name="exclude">.git</param>
+    <param name="filename">openhpi</param>
+    <param name="changesgenerate">disable</param>
+  </service>
+  <service name="recompress" mode="disabled">
+    <param name="file">*.tar</param>
+    <param name="compression">xz</param>
+  </service>
+  <service name="set_version" mode="disabled"/>
+</services>
diff --git a/fix_openipmi_typedef_selector_change.patch b/fix_openipmi_typedef_selector_change.patch
new file mode 100644
index 0000000..635d68a
--- /dev/null
+++ b/fix_openipmi_typedef_selector_change.patch
@@ -0,0 +1,29 @@
+Author: Thomas Renninger <trenn@suse.de>
+
+typedef selector_t changed in OpenIPMI to selector_s
+
+From https://github.com/cminyard/openipmi.git:
+
+commit f36a1158f7be667f5cf64c5db8e3fc9e1f8859b1
+Author: Corey Minyard <cminyard@mvista.com>
+Date:   Mon Jul 31 11:26:05 2017 -0500
+
+    Remove selector_t type
+    
+    The selector_t type was conflicting with something on SmartOS, and
+    it's really a bad idea to use _t on types outside of the OS.
+...
+
+Index: openhpi-3.8.0/plugins/ipmi/ipmi.h
+===================================================================
+--- openhpi-3.8.0.orig/plugins/ipmi/ipmi.h	2018-09-19 22:47:00.000000000 +0200
++++ openhpi-3.8.0/plugins/ipmi/ipmi.h	2018-09-26 15:44:45.246542510 +0200
+@@ -82,7 +82,7 @@ struct ohoi_handler {
+ 	ipmi_con_t *cons[2];
+ 	unsigned int num_cons;
+ 
+-	selector_t *ohoi_sel;
++	selector_s *ohoi_sel;
+ 
+ 	char *entity_root;
+ 	int connected;
diff --git a/openhpi-3.4.0-systemd.patch b/openhpi-3.4.0-systemd.patch
index 9814528..69dd981 100644
--- a/openhpi-3.4.0-systemd.patch
+++ b/openhpi-3.4.0-systemd.patch
@@ -12,10 +12,11 @@ it means that systemd service file will be installed instead of the classis init
  3 files changed, 30 insertions(+)
  create mode 100644 openhpid/openhpid.service.in
 
-diff -wruN -x '*~' -x '*.o' -x '*.a' -x '*.so' -x '*.so.[0-9]' -x autom4te.cache -x .deps -x .libs ../orig-openhpi-3.6.0/configure.ac ./configure.ac
---- ../orig-openhpi-3.6.0/configure.ac	2015-08-27 02:34:49.000000000 +0200
-+++ ./configure.ac	2015-09-07 13:51:26.152236573 +0200
-@@ -715,6 +715,17 @@
+Index: openhpi-3.8.0/configure.ac
+===================================================================
+--- openhpi-3.8.0.orig/configure.ac	2018-09-19 22:47:00.000000000 +0200
++++ openhpi-3.8.0/configure.ac	2018-09-25 11:47:35.199528830 +0200
+@@ -775,6 +775,17 @@ AC_ARG_ENABLE([man],
          AC_SUBST(MAN,"")
      fi])
  
@@ -33,7 +34,7 @@ diff -wruN -x '*~' -x '*.o' -x '*.a' -x '*.so' -x '*.so.[0-9]' -x autom4te.cache
  AC_CONFIG_FILES([openhpi.spec
          openhpi.pc
          rt-env.sh
-@@ -757,6 +768,7 @@
+@@ -818,6 +829,7 @@ AC_CONFIG_FILES([openhpi.spec
          docs/man/Makefile
          openhpid/Makefile
          openhpid/openhpid.sh
@@ -41,10 +42,11 @@ diff -wruN -x '*~' -x '*.o' -x '*.a' -x '*.so' -x '*.so.[0-9]' -x autom4te.cache
          openhpid/t/Makefile
          openhpid/t/ohpi/Makefile
          hpi_shell/Makefile
-diff -wruN -x '*~' -x '*.o' -x '*.a' -x '*.so' -x '*.so.[0-9]' -x autom4te.cache -x .deps -x .libs ../orig-openhpi-3.6.0/openhpid/Makefile.am ./openhpid/Makefile.am
---- ../orig-openhpi-3.6.0/openhpid/Makefile.am	2015-08-27 02:34:59.000000000 +0200
-+++ ./openhpid/Makefile.am	2015-09-07 13:51:26.152236573 +0200
-@@ -28,6 +28,7 @@
+Index: openhpi-3.8.0/openhpid/Makefile.am
+===================================================================
+--- openhpi-3.8.0.orig/openhpid/Makefile.am	2018-09-19 22:47:00.000000000 +0200
++++ openhpi-3.8.0/openhpid/Makefile.am	2018-09-25 11:47:35.199528830 +0200
+@@ -28,6 +28,7 @@ DIST_SUBDIRS = t
  
  EXTRA_DIST		= \
      openhpid.sh.in \
@@ -52,7 +54,7 @@ diff -wruN -x '*~' -x '*.o' -x '*.a' -x '*.so' -x '*.so.[0-9]' -x autom4te.cache
      Makefile.mingw32 \
      openhpid-win32.cpp \
      version.rc
-@@ -83,11 +84,17 @@
+@@ -83,11 +84,17 @@ endif
  
  
  install-data-local:
@@ -70,9 +72,10 @@ diff -wruN -x '*~' -x '*.o' -x '*.a' -x '*.so' -x '*.so.[0-9]' -x autom4te.cache
  	
  clean-local:
  	rm -f *~ core core.* 
-diff -wruN -x '*~' -x '*.o' -x '*.a' -x '*.so' -x '*.so.[0-9]' -x autom4te.cache -x .deps -x .libs ../orig-openhpi-3.6.0/openhpid/openhpid.service.in ./openhpid/openhpid.service.in
---- ../orig-openhpi-3.6.0/openhpid/openhpid.service.in	1970-01-01 01:00:00.000000000 +0100
-+++ ./openhpid/openhpid.service.in	2015-09-07 13:51:26.152236573 +0200
+Index: openhpi-3.8.0/openhpid/openhpid.service.in
+===================================================================
+--- /dev/null	1970-01-01 00:00:00.000000000 +0000
++++ openhpi-3.8.0/openhpid/openhpid.service.in	2018-09-25 11:47:35.199528830 +0200
 @@ -0,0 +1,11 @@
 +[Unit]
 +Description=Daemon providing access to the SAF Hardware Platform Interface
diff --git a/openhpi-3.6.1.tar.gz b/openhpi-3.6.1.tar.gz
deleted file mode 100644
index 71c9312..0000000
--- a/openhpi-3.6.1.tar.gz
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:e0a810cb401c4bdcfc9551f2e6afd5a8ca4b411f5ee3bc60c19f82fd6e84a3dc
-size 7718590
diff --git a/openhpi-3.8.0.tar.xz b/openhpi-3.8.0.tar.xz
new file mode 100644
index 0000000..3a7a81a
--- /dev/null
+++ b/openhpi-3.8.0.tar.xz
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:059c168a41a38128e9d99c62a3998f102ed1b9351ae0828a77e6f3abd428dadc
+size 9511504
diff --git a/openhpi.changes b/openhpi.changes
index 49e6323..1ff73ca 100644
--- a/openhpi.changes
+++ b/openhpi.changes
@@ -1,3 +1,15 @@
+-------------------------------------------------------------------
+Wed Sep 26 14:25:38 UTC 2018 - trenn@suse.de
+
+- Update to 3.8.0 (fate#325975)
+- Remove ipmi plugin, it is deprecated for long time, does not build
+  anymore because selector_t changed to struct selector_s in
+  openIPMI-devel since 2.0.24. ipmidirect is compiled in and should
+  be used anyway.
+- Patch mainline:
+D openhpi-3.6.0_fix_net-snmp_disable_MD5.patch
+- Used spec-cleaner
+
 -------------------------------------------------------------------
 Fri Feb 24 16:32:49 UTC 2017 - kkaempf@suse.com
 
diff --git a/openhpi.spec b/openhpi.spec
index 983142d..0945122 100644
--- a/openhpi.spec
+++ b/openhpi.spec
@@ -1,7 +1,7 @@
 #
 # spec file for package openhpi
 #
-# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -12,20 +12,25 @@
 # license that conforms to the Open Source Definition (Version 1.9)
 # published by the Open Source Initiative.
 
-# Please submit bugfixes or comments via http://bugs.opensuse.org/
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
 #
 
 
 %if 0%{?suse_version} > 1140
 %define has_systemd 1
 %endif
-
 Name:           openhpi
-Version:        3.6.1
+Version:        3.8.0
 Release:        0
-#
-#
-BuildRequires:  OpenIPMI-devel
+Summary:        Implementation of SA Forum's Hardware Platform Interface (HPI)
+License:        BSD-3-Clause
+Group:          System/Monitoring
+URL:            https://github.com/open-hpi/openhpi
+Source:         openhpi-%{version}.tar.xz
+#Source1:        openhpi-rpmlintrc
+Source2:        AUTHORS
+Patch0:         unlink-pidfile-on-error.patch
+Patch2:         openhpi-3.4.0-systemd.patch
 BuildRequires:  autoconf
 BuildRequires:  automake
 BuildRequires:  docbook-toys
@@ -39,23 +44,7 @@ BuildRequires:  libxml2-devel
 BuildRequires:  ncurses-devel
 BuildRequires:  net-snmp-devel
 BuildRequires:  tcpd-devel
-%if 0%{?has_systemd}
 BuildRequires:  pkgconfig(systemd)
-%endif
-BuildRoot:      %{_tmppath}/%{name}-%{version}-build
-#
-Url:            http://sourceforge.net/projects/openhpi/
-# http://sourceforge.net/projects/openhpi/files/openhpi-stable/3.6.0/openhpi-3.6.0.tar.gz/download
-Source:         openhpi-%{version}.tar.gz
-Source1:        openhpi-rpmlintrc
-Source2:        AUTHORS
-Patch:          unlink-pidfile-on-error.patch
-Patch2:         openhpi-3.4.0-systemd.patch
-Patch3:         openhpi-3.6.0_fix_net-snmp_disable_MD5.patch
-#
-Summary:        Implementation of SA Forum's Hardware Platform Interface (HPI)
-License:        BSD-3-Clause
-Group:          System/Monitoring
 
 %description
 OpenHPI is an open source project created with the intent of providing
@@ -75,6 +64,8 @@ data via sysfs. For up-to-date status on these components, check out
 the status page.
 
 %package devel
+Summary:        Development Files for HPI
+Group:          Development/Libraries/C and C++
 Requires:       OpenIPMI-devel
 Requires:       bzip2
 Requires:       e2fsprogs-devel
@@ -90,19 +81,16 @@ Requires:       openhpi-daemon
 Requires:       openssl-devel
 Requires:       popt-devel
 Requires:       zlib-devel
-Summary:        Development Files for HPI
-Group:          Development/Libraries/C and C++
 
 %description devel
 Contains additional files needed for a developer to create applications
 and/or middleware that use the Service Availability Forum's HPI
 specification
 
-
 %package clients
-Requires:       openhpi = %{version}
 Summary:        HPI Command-line Applications
 Group:          System/Monitoring
+Requires:       openhpi = %{version}
 
 %description clients
 This package contains HPI command-line utilities
@@ -113,14 +101,10 @@ managing computer hardware, typically for chassis and rack based
 servers.
 
 %package daemon
-Requires:       openhpi = %{version}
 Summary:        Implementation of SA Forum's Hardware Platform Interface (HPI)
 Group:          System/Monitoring
-%if 0%{?has_systemd}
+Requires:       openhpi = %{version}
 %{?systemd_requires}
-%else
-PreReq:         %insserv_prereq %fillup_prereq
-%endif
 
 %description daemon
 OpenHPI is an open source project created with the intent of providing
@@ -139,17 +123,12 @@ limited to, IPMI based servers, Blade Center, and machines which export
 data via sysfs. For up-to-date status on these components, please check
 out the status page.
 
-
 %prep
 %setup -q
-%patch -p1
-%if 0%{?has_systemd}
-%patch2 -p1
-%endif
-%patch3 -p1
+%autopatch -p1
 
 %build
-cp %{S:2} .
+#cp %{S:2} .
 autoreconf -fiv
 
 # fix permissions
@@ -160,97 +139,77 @@ export CFLAGS="%{optflags} -fno-strict-aliasing -DGLIB_DISABLE_DEPRECATION_WARNI
 export CXXFLAGS="${CFLAGS}"
 %configure \
     --disable-static \
-    --enable-ipmi --disable-sysfs --enable-daemon \
-    --enable-ipmidirect--enable-simulator --enable-clients \
+    --disable-ipmi --disable-sysfs --enable-daemon \
+    --enable-ipmidirect --enable-simulator --enable-clients \
     --enable-ilo2_ribcl --enable-oa_soap \
-%if 0%{?has_systemd}
     --with-systemdsystemunitdir=%{_unitdir} \
-%endif
-    --with-varpath=/var/lib/%{name}
-%{__make}
-%{__make} documentation
+    --with-varpath=%{_localstatedir}/lib/%{name}
+make %{?_smp_mflags}
+make %{?_smp_mflags} documentation
 ###################################################
 
 %install
 ###################################################
-%makeinstall
-%{__install} -Dd -m 0755 \
+%make_install
+install -Dd -m 0755 \
     %{buildroot}%{_sysconfdir}/openhpi \
-    %{buildroot}/var/lib/openhpi
-%{__install} -m 0644 openhpi.conf.example %{buildroot}%{_sysconfdir}/openhpi/openhpi.conf
+    %{buildroot}%{_localstatedir}/lib/openhpi
+install -m 0644 openhpi.conf.example %{buildroot}%{_sysconfdir}/openhpi/openhpi.conf
 #%{__cp} -a README COPYING docs/hld/openhpi-manual %{buildroot}%{_docdir}/%{name}/
-%{__rm} -rv %{buildroot}%{_datadir}/doc/%{name}
-%{__rm} -v %{buildroot}%{_libdir}/{,openhpi/}*.la
+rm -rv %{buildroot}%{_datadir}/doc/%{name}
+find %{buildroot} -type f -name "*.la" -delete -print
 
 %post -p /sbin/ldconfig
-
 %postun -p /sbin/ldconfig
 
-%if 0%{?has_systemd}
 %pre daemon
 %service_add_pre openhpid.service
-%endif
 
 %preun daemon
-%if 0%{?has_systemd}
 %service_del_preun openhpid.service
-%else
-%stop_on_removal openhpid
-%endif
 
 %post daemon
 /sbin/ldconfig
-%if 0%{?has_systemd}
 %service_add_post openhpid.service
-%else
-%fillup_and_insserv -f openhpid
-%endif
-echo "Check OPENHPI_UNCONFIGURED in /etc/openhpi/openhpi.conf !"
+echo "Check OPENHPI_UNCONFIGURED in %{_sysconfdir}/openhpi/openhpi.conf"
 
 %postun daemon
 /sbin/ldconfig
-%if 0%{?has_systemd}
 %service_del_postun openhpid.service
-%else
-%insserv_cleanup
-%restart_on_update openhpid
-%endif
 
 %files
 %defattr(-,root,root,0755)
 %dir %attr(0750,root,root) %{_sysconfdir}/openhpi
 %config(noreplace) %attr(0640,root,root) %{_sysconfdir}/openhpi/*
-%doc ChangeLog COPYING AUTHORS README README.daemon *.example
+%license COPYING
+%doc ChangeLog AUTHORS README README.daemon *.example
 #%doc %{_docdir}/%{name}/
-%dir /var/lib/openhpi
+%dir %{_localstatedir}/lib/openhpi
 %dir %{_libdir}/openhpi
 %{_libdir}/libopen*.so.*
 %{_libdir}/openhpi/lib*.so*
-%{_mandir}/man7/openhpi.7*
+%{_mandir}/man7/openhpi.7%{?ext_man}
 
 %files devel
-%defattr(-,root,root)
 %{_includedir}/openhpi
 %{_libdir}/pkgconfig/openhpi.pc
 %{_libdir}/pkgconfig/openhpiutils.pc
 %{_libdir}/libopen*.so
 
 %files clients
-%defattr(-,root,root)
 %{_bindir}/hpi*
-%{_mandir}/man1/hpi*.1*
+%{_mandir}/man1/hpi*.1%{?ext_man}
 %{_bindir}/oh*
-%{_mandir}/man1/oh*.1*
+%{_mandir}/man1/oh*.1%{?ext_man}
 
 %files daemon
-%defattr(-,root,root)
 %doc README.daemon
 %if 0%{?has_systemd}
 %{_unitdir}/openhpid.service
 %else
-/etc/init.d/openhpid
+%{_initddir}/openhpid
 %endif
 %{_sbindir}/openhpid
-%{_mandir}/man8/openhpid.8*
+%{_mandir}/man8/openhpid.8%{?ext_man}
 
 %changelog
diff --git a/unlink-pidfile-on-error.patch b/unlink-pidfile-on-error.patch
index d0e8b1f..908a148 100644
--- a/unlink-pidfile-on-error.patch
+++ b/unlink-pidfile-on-error.patch
@@ -1,7 +1,8 @@
-diff -wruN -x '*~' -x '*.o' -x '*.a' -x '*.so' -x '*.so.[0-9]' -x autom4te.cache -x .deps -x .libs ../orig-openhpi-3.6.0/openhpid/openhpid-posix.cpp ./openhpid/openhpid-posix.cpp
---- ../orig-openhpi-3.6.0/openhpid/openhpid-posix.cpp	2015-08-27 02:34:59.000000000 +0200
-+++ ./openhpid/openhpid-posix.cpp	2015-09-07 13:50:10.880957904 +0200
-@@ -432,6 +432,7 @@
+Index: openhpi-3.8.0/openhpid/openhpid-posix.cpp
+===================================================================
+--- openhpi-3.8.0.orig/openhpid/openhpid-posix.cpp	2018-09-19 22:47:00.000000000 +0200
++++ openhpi-3.8.0/openhpid/openhpid-posix.cpp	2018-09-25 11:47:01.165511254 +0200
+@@ -439,6 +439,7 @@ int main(int argc, char *argv[])
      INFO("Socket timeout(sec): %d.", sock_timeout);
  
      if (oh_init()) { // Initialize OpenHPI