File openwbem-smash-providers.spec of Package omc-smash

#
# spec file for package openwbem-smash-providers (Version 1.0.8)
#
# Copyright (c) 2006 SUSE LINUX Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself.
#
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#

# norootforbuild
# usedforbuild    aaa_base acl attr audit-libs autoconf automake bash bind-libs bind-utils binutils bison blocxx bzip2 cim-schema coreutils cpio cpp cracklib cvs cyrus-sasl db dbus-1 dbus-1-glib diffutils e2fsprogs expat file filesystem fillup findutils flex gawk gcc gcc-c++ gdbm gdbm-devel gettext gettext-devel glib2 glibc glibc-devel glibc-locale gnome-filesystem gpm grep groff gzip hal hwinfo hwinfo-devel info insserv iproute2 klogd less libacl libattr libcom_err libgcc libltdl libnscd libstdc++ libstdc++-devel libtool libusb libvolume_id libxcrypt libxml2 libzio limal limal-runlevel m4 make man mktemp module-init-tools ncurses ncurses-devel net-tools netcfg openldap2-client openslp openslp-devel openssl openssl-devel openwbem openwbem-base-providers openwbem-base-providers-devel openwbem-devel pam pam-devel pam-modules patch pcre perl perl-XML-Parser perl-XML-Writer permissions popt procinfo procps psmisc pwdutils rcs readline rpm sed strace sysfsutils sysvinit tar tcpd texinfo timezone udev unzip util-linux vim wireless-tools zlib zlib-devel

Name:           openwbem-smash-providers
BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  libtool
BuildRequires:  gcc-c++
BuildRequires:  hwinfo-devel
BuildRequires:  iproute
BuildRequires:  libstdc++-devel
BuildRequires:  openssl-devel
BuildRequires:  openwbem-devel
BuildRequires:  pam-devel
BuildRequires:  openwbem-base-providers-devel
%if 0%{?rhel_version} == 0 && 0%{?centos_version} == 0
BuildRequires:  openslp-devel
%endif
URL:            https://forge.provo.novell.com/modules/xfmod/project/?nim
%define omcprefix /usr
%define omclocalstatedir /var/lib/openwbem
%define omcsysconfdir /etc/openwbem
# Increment the version every time the source code changes. 
Version:        1.0.8
Release:        1
Group:          System/Management
Summary:        Instrumentation of DMTF SMASH profiles providers used by the OpenWBEM CIMOM
PreReq:         /usr/bin/loadmof.sh, coreutils
License:        Commercial, Other License(s), see package
# This is necessary to build the RPM as a non-root user. 
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
# "yes" is the default, but we put it here explicitly to avoid someone
# setting it to "no"
AutoReqProv: yes
Requires:       openwbem
Requires:       cim-schema >= 2.11
Source0:        %{name}-%{version}.tar.bz2
Source1:        %{name}-mof.tar.bz2
# more includes (kkaempf@suse.de)
# pass class, not constructor to providerIF macro (GCC 4.7+), kkaempf@suse.de
Patch1:         gcc4.patch
# false is invalid return from String function, kkaempf@suse.de
Patch2:         gcc6.patch

%package devel
Group:          System/Management
Summary:        Instrumentation of DMTF SMASH profiles providers used by the OpenWBEM CIMOM
Requires:       openwbem, %{name}
Requires:       glibc-devel
Requires:       cim-schema >= 2.11

%description
An open-source Linux instrumentation of the Distributed Management Task Force
(DMTF) Systems Managements Architecture for Server Hardware (SMASH)
profile providers used	by the OpenWBEM (Web Based Enterprise
Management) Common Information Model Object Manager (CIMOM) for
OpenWBEM (Web Based Enterprise Management).

This suite of specifications delivers architectural semantics, along
with industry standard protocols and profiles, to unify management of
the data center.



Authors:
--------
    Norm Paxton
    Jon Carey
    Bart Whiteley
    Bart Wise
    J.B. Gill


%description devel
An open-source Linux instrumentation of the Distributed Management Task Force
(DMTF) Systems Managements Architecture for Server Hardware (SMASH)
profile providers used	by the OpenWBEM (Web Based Enterprise
Management) Common Information Model Object Manager (CIMOM) for
OpenWBEM (Web Based Enterprise Management).

This suite of specifications delivers architectural semantics, along
with industry standard protocols and profiles, to unify management of
the data center.



Authors:
--------
    Norm Paxton
    Jon Carey
    Bart Whiteley
    Bart Wise
    J.B. Gill

%prep
# Untar the sources. 
%setup 
%patch1 -p1
%patch2 -p1

%build
# If the LD_RUN_PATH environment variable is set at link time, 
# it's value is embedded in the resulting binary.  At run time, 
# The binary will look here first for shared libraries.  This way
# we link against the libraries we want at run-time even if libs
# by the same name are in /usr/lib or some other path in /etc/ld.so.conf
autoreconf --force --install
%if 0%{?suse_version} >= 1120
LIBS="-lpthread" \
%endif
CFLAGS="$RPM_OPT_FLAGS -fstack-protector" \
%if 0%{?suse_version}
CXXFLAGS="$RPM_OPT_FLAGS -fstack-protector -fno-strict-aliasing" ./configure --prefix=%{omcprefix} \
%else
CXXFLAGS="$RPM_OPT_FLAGS -fstack-protector" ./configure --prefix=%{omcprefix} --disable-ipmi \
%endif
		--libdir=%_libdir \
		--sysconfdir=/etc
#make %{?jobs:-j%jobs}
make

%install
%{__rm} -rf $RPM_BUILD_ROOT
%{__mkdir} -p $RPM_BUILD_ROOT
# Tell 'make install' to install into the BuildRoot
make DESTDIR=$RPM_BUILD_ROOT install
MOFDIR=$RPM_BUILD_ROOT/%{omcprefix}/share/mof/%{name}
install -d $MOFDIR
tar jxv -C $MOFDIR -f %{S:1}
mv $MOFDIR/mof/* $MOFDIR/
rmdir $MOFDIR/mof
%{__rm} -f $RPM_BUILD_ROOT%{omcprefix}/%_lib/openwbem/c++providers/*.{a,la}

%clean
%{__rm} -rf $RPM_BUILD_ROOT

%post
# Any RPM that installs a shared library into any directory
# listed in /etc/ld.so.conf (or into /usr/lib if it hasn't been
# fixed yet to install into the correct FHS compliant paths) 
# must run ldconfig in its post install script. 
/sbin/ldconfig
# load MOF 
MOFDIR=%{omcprefix}/share/mof/%{name}
NPBMOFDIR=%{omcprefix}/share/mof/openwbem-base-providers
####################################################################
# The following is a script to add the namespaces to the openwbem.conf
# and to call loadmof for each of the namespaces
#
# TODO: Do I need to also loadmof for the interop namespace?
####################################################################
# This should point to where smashNs is put down
SMASHNS=%{omcprefix}/bin/smashNs
# This should point directly to the wbem conf file (/etc/openwbem.conf)
WBEM_CONF=%{omcsysconfdir}/openwbem.conf
# This is a temp file that will be created during the modification.
# This should probably be put in /tmp/openwbem.conf---modified or something similar
WBEM_CONF_OUT=/tmp/openwbem.conf--modified
# This function appends $2 onto the end of $1 if $2 doesn't
# exist anywhere inside of $1
function AppendToString()
{
	if [ $# -gt 1 ]
	then 
		if ! echo "$1" | grep -we "$2" > /dev/null
		then
			# Append $2 to the end of $1
			echo "$1 $2"
		else
			# $2 is found somewhere inside of $1
			# so, just output $1 (don't append $2)
			echo "$1"
		fi
	else
		echo "$1"
	fi
}
# This function takes the values in $3 - $@ and adds them to the key in $1
# as long as they don't already exist in $1.
# $2 is the comment to add if the key is missing from the file
# if the KEY is commented out, then it adds a line below the comment
# if the KEY is not in the file, it appends it to the end, along with 
function AddValuesToKeyInConfFile()
{
	if [ $# -gt 2 ]
	then
		KEY="$1"
		COMMENT="$2"
		shift 2
		VALUES="$@"
		if grep -e "^[ ]*$KEY[ ]*=" $WBEM_CONF > /dev/null
		then 
			# KEY is _NOT_ commented out
			# adding our namespaces to the list
	
			# If multiple in file, only take namespaces from the last one
			REPLACE_STR=$(grep -e "^[ ]*$KEY[ ]*=" $WBEM_CONF|tail -1)
			for IX in $VALUES
			do
				REPLACE_STR=$(AppendToString "$REPLACE_STR" "$IX")
			done
		
			SED_EXP='s#^[ ]*'$KEY'[ ]*=.*$#'$REPLACE_STR'#'
			cat $WBEM_CONF | sed -e "$SED_EXP" > $WBEM_CONF_OUT || /bin/true
		
		elif grep -e "^[ ]*[;\#][ ]*$KEY[ ]*=" $WBEM_CONF > /dev/null
		then
			# KEY _IS_ commented out
			# So, add our line below the commented out one
		
			SED_EXP='s#^[ ]*\([;\#]\)[ ]*'$KEY'[ ]*=\(.*\)$#\1'$KEY'= \2\n'$KEY' = '$VALUES'#'
			cat $WBEM_CONF | sed -e "$SED_EXP" > $WBEM_CONF_OUT || /bin/true
		else
			cp $WBEM_CONF $WBEM_CONF_OUT || /bin/true
			echo >> $WBEM_CONF_OUT
			echo -e "$COMMENT" >> $WBEM_CONF_OUT
			echo "$KEY = $VALUES" >> $WBEM_CONF_OUT
		fi
		# Move the modified conf file over the top of the original
		mv $WBEM_CONF_OUT $WBEM_CONF || /bin/true
	fi
}
# Import appropriate mofs into appropriate namespaces
INTEROP_NS=$(sed -n -e "/^owcimomd\.interop_schema_namespace/p" $WBEM_CONF | sed -r s/"owcimomd\.interop_schema_namespace[ ]*=[ ]*"//)
SMASH_NS=$($SMASHNS -s)
IPMI_NS=$($SMASHNS -f ipmi)
COMPOSITE_NS=$($SMASHNS -c)
# do the interop namespace
loadmof.sh -n $INTEROP_NS \
			$MOFDIR/smash/omc-smash-providers-interop-ns.mof || /bin/true
# do the smash namespace
loadmof.sh -n $SMASH_NS \
			$NPBMOFDIR/base/omc-core.mof \
			$NPBMOFDIR/base/omc-base-providers.mof \
			$MOFDIR/smash/omc-smash-providers.mof || /bin/true
# do the composite (smash staging) namespace
loadmof.sh -n $COMPOSITE_NS \
			$MOFDIR/smash/omc-smash-providers-composite-ns.mof || /bin/true
# do all aggregate namespace: load the device mof only
for CUR_NS in $($SMASHNS -a | awk '{print $1}')
do
	loadmof.sh -n $CUR_NS \
			$MOFDIR/smash/omc-smash-providers-composite-ns.mof || /bin/true
done
# load the raw ipmi class definitions into the ipmi namespace only.
if [ $? == 0 ]; then
	loadmof.sh -n $IPMI_NS \
			$MOFDIR/smash/omc-rawipmi.mof || bin/true
fi
#end mof imports
COMMENT_1="################################################################################\n# A space-separated list of namespaces where providers won't be registerd\n# for classes if no namespace was specified during provider self-registration.\n# If providers use self-registration, and don't specify a namespace (only\n# a class name), they are registered for all namespaces in which the class\n# is present by default.  This option allows the specified namespaces to be\n# excluded from this behavior.\n# This is a multi-valued option. Whitespace is the separator.\n# Example: owcimomd.explicit_registration_namespaces = root/private root/cache"
 
COMMENT_2="################################################################################\n# A space-separated list of namespaces that the providers in\n# omc-base-providers will explicitly register for. The omc-base-providers\n# will always do non-explicit namespace registration for the\n# classes they instrument. This option causes them to register explicitly for\n# the specified namespaces. This option will typically be used to allow\n# the omc-base-providers to instrument their classes in\n# namespaces that have been specified in the\n# owcimomd.explicit_registration_namespaces option in the openwbem.conf file.\n# Example:\n#omc_base_providers.register_explicitly=  smash root/some-namespace"
AddValuesToKeyInConfFile "owcimomd.explicit_registration_namespaces" "$COMMENT_1" $($SMASHNS)
AddValuesToKeyInConfFile "omc.register_explicitly"  "$COMMENT_2" $($SMASHNS -s)
####################################################################
# End of namespace script
####################################################################

%postun -p /sbin/ldconfig

%files
%defattr(-,root,root)
%doc README
%{omcprefix}/%_lib/openwbem/c++providers/*.so*
%{omcprefix}/%_lib/lib*.so*
%dir %{omcprefix}/share/mof/%{name}
%{omcprefix}/share/mof/%{name}/*
%{omcprefix}/bin/smashNs
%dir %{omcsysconfdir}/smash-config
%{omcsysconfdir}/smash-config/smash-config.xml

%files devel
%defattr(-,root,root)
%dir %{omcprefix}/include/omc
%{omcprefix}/include/omc/*
%{omcprefix}/%_lib/lib*.la
%{omcprefix}/%_lib/lib*.a

%changelog -n openwbem-smash-providers
* Sat Jun 17 2016 - kkaempf@suse.de
- add gcc6.patch
* Tue Feb 26 2013 - kkaempf@suse.de
- fix rpmlintrc (bnc#801192)
* Tue Jan 29 2013 - kkaempf@suse.de
- repackage tarball with textfiles run through dos2unix
- merge all patches into gcc4.patch
- fix building with gcc 4.7
* Thu Nov 29 2012 - kkaempf@suse.de
- Fix gcc 4.7 (openSUSE 12.2) build
* Thu Sep 27 2012 - kkaempf@suse.de
- Improve gcc 4.7 builds
* Tue Nov 30 2010 - kkaempf@suse.de
- Fix rhel5 build
* Thu Sep 16 2010 - kkaempf@suse.de
- Fix build with gcc4
* Tue May 30 2006 - npaxton@novell.com
- bugzilla 179939: When the composite device provider calls into
  the smbios provider with a memory modules that was not produced
  by the smbbios provider, it segfaults
  Fixed.
  Risk factor:  While openwbem-smash-providers is not installed by
  default, and the chance of hitting this bug is low, it does cause
  a segfault in openWbem, which affects other default-installed
  applications.
* Fri May 12 2006 - npaxton@novell.com
- bugzilla 174056: every UnixProcess was associated with
  an ssh protocol endpoint (CIM objects / associations only)
  Note: This was a CIM representation only.  Nothing physical
  on the machine was affected.  Hence low risk.
- bugzilla 175476: AssociatedMemory associations were not
  honoring filters, hence returning bogus objects as
  associated objects.  NOTE: This was CIM representation only
  Nothing physical on the machine was affected.  Hence low
  risk.
- bugzilla 174928: ModifyInstance on threshold sensors caused
  loss of threshold values.  This was modifying IPMI incorrectly
  hence loss of data.  Low risk with fix.  Higher risk if fix
  is not incorporated.
* Tue May 02 2006 - bwhiteley@suse.de
- Removed verbose flag to calls to loadmof.sh (#171447)
* Fri Apr 14 2006 - npaxton@suse.de
- Bring Profiles up to the latest profile versions by DMTF
  The following profiles have been upgraded to 1.0.0.a by DMTF
  and openwbem-smash-providers has been changed to reflect those
  modifications:
  Fan, Sensor, SSH Service, Ethernet Port
* Thu Apr 06 2006 - npaxton@suse.de
- Fixed DeviceCapabilities to match the changes in the profiles.
- Fixed CompositeDevice provider where it was returning duplicate
  object paths
- Bring Profiles up to the latest profile versions by DMTF
- Fix "Name" in IPProtocolEndpoint
* Tue Mar 28 2006 - npaxton@suse.de
- Included DNS and DHCP profiles that had been disabled in
  previous build because of seg-faults, etc.  Includes a
  rework of how to obtain DHCP information, which is more
  reliable than previous version.
* Fri Mar 17 2006 - npaxton@suse.de
- Fix several seg-faults and dereferencing-null-pointer
  errors in ip-interface and ethernet port profiles.
* Fri Mar 10 2006 - npaxton@suse.de
- Fix a few residual issues from schema change
  for bugzilla #155618.
* Thu Mar 09 2006 - npaxton@suse.de
- Correct a config file option in %%post in spec file
* Wed Mar 08 2006 - npaxton@suse.de
- Package approved for late update submissions
  FATE package #: 300184
- code towards completing the required profiles,
  and bringing them up to the latest DMTF profile
  version.
- Bugzilla # 155618: SMASH schema still has 'Novell_'
* Fri Mar 03 2006 - npaxton@suse.de
- Package approved for late update submissions
  FATE package #: 300184
- code towards completing the required profiles,
  and bringing them up to the latest DMTF profile
  version.
- Fixed Collections aspect of Record Log Profile
- Fixed segfaults in EthernetPort profile.
* Sat Feb 25 2006 - npaxton@suse.de
- Package approved for late update submissions
  FATE package #: 300184
- code towards completing the required profiles,
  and bringing them up to the latest DMTF profile
  version.
- Record Log Profile providers enhanced to latest profile version
- Sensor Profile providers enhanced to latest profile version
* Fri Feb 17 2006 - npaxton@suse.de
- Package approved for late udpate submissions
  FATE package #: 300184
- code towards completing the required profiles,
  and bringing them up to the latest DMTF profile
  version.
* Sat Feb 11 2006 - bwhiteley@suse.de
- changed group of -devel package to get past submitpac
* Sat Feb 11 2006 - bwhiteley@suse.de
- performed #neededforbuild -> BuildRequires change previously
  clobbered by npaxton.
* Fri Feb 10 2006 - npaxton@suse.de
- Package approved for late udpate submissions
  FATE package #: 300184
- code towards completing the required profiles,
  and bringing them up to the latest DMTF profile
  version.
* Wed Jan 25 2006 - mls@suse.de
- converted neededforbuild to BuildRequires
* Thu Jan 19 2006 - npaxton@suse.de
- new code, more complete internal IPMI usage
* Wed Jan 18 2006 - npaxton@suse.de
- still more libhd/pci_id fixes
* Tue Jan 17 2006 - npaxton@suse.de
- fix to libhd removing old pci_ids
- new mofs for ip/ethernet
* Sun Jan 15 2006 - npaxton@suse.de
- spec file clean-up
* Sun Jan 15 2006 - npaxton@suse.de
- Really re-order mof files for dependencies for mof-install
* Fri Jan 13 2006 - npaxton@suse.de
- Re-order mof files for dependencies for mof-install
* Fri Jan 13 2006 - npaxton@suse.de
- Added dhcp profile, updated version to 0.9.1
* Fri Jan 13 2006 - npaxton@suse.de
- Change versioned dependency to have spaces:  cim-schema >= 2.11
* Thu Jan 12 2006 - npaxton@suse.de
- Up version to 0.9.0
* Thu Jan 12 2006 - npaxton@suse.de
- Update to newer code.
- Remove dependency on OpenIPMI
* Tue Jan 10 2006 - npaxton@suse.de
- Change package name from novell-smash to openwbem-smash-providers.
- Transitioning to new ipmi library  (from openIPMI)
- DNS / DHCP profiles
- Change requirements from novell-provider-base to openwbem-base-providers
- Added versioned dependency on cim-schema>=2.11
* Thu Dec 22 2005 - npaxton@novell.com
- Update to newer code.  First submission by Norm
* Thu Dec 15 2005 - bwhiteley@suse.de
- Update to newer code
* Sat Dec 03 2005 - bwhiteley@suse.de
- Initial build
openSUSE Build Service is sponsored by