From a91631bea527d592b1256da9538e10b9a6e15d21 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Tue, 28 Jul 2020 03:21:55 -0400 Subject: [PATCH] import sblim-cmpi-base-1.6.4-14.el8 --- ...i-base-1.6.4-fix-get-os-install-date.patch | 67 +++++++++++++++++++ SPECS/sblim-cmpi-base.spec | 11 ++- 2 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 SOURCES/sblim-cmpi-base-1.6.4-fix-get-os-install-date.patch diff --git a/SOURCES/sblim-cmpi-base-1.6.4-fix-get-os-install-date.patch b/SOURCES/sblim-cmpi-base-1.6.4-fix-get-os-install-date.patch new file mode 100644 index 0000000..8e81398 --- /dev/null +++ b/SOURCES/sblim-cmpi-base-1.6.4-fix-get-os-install-date.patch @@ -0,0 +1,67 @@ +diff -up sblim-cmpi-base-1.6.4/OSBase_OperatingSystem.c.orig sblim-cmpi-base-1.6.4/OSBase_OperatingSystem.c +--- sblim-cmpi-base-1.6.4/OSBase_OperatingSystem.c.orig 2014-10-23 16:54:13.000000000 +0200 ++++ sblim-cmpi-base-1.6.4/OSBase_OperatingSystem.c 2020-01-21 15:11:49.420942584 +0100 +@@ -143,11 +143,11 @@ void _init_os_distro() { + + _OSBASE_TRACE(4,("--- _init_os_distro() called : init")); + +- rc = runcommand( "find /etc/ -maxdepth 1 -type f -name *release 2>/dev/null" , NULL , &hdout , NULL ); ++ rc = runcommand( "find /etc/ /usr/lib/ -maxdepth 1 -type f -name *release 2>/dev/null" , NULL , &hdout , NULL ); + if( rc == 0 && *hdout != NULL) { + while (hdout[j] && hdout[j][0]) { +- if (strstr(hdout[j],"lsb-release") && hdout[j+1] && hdout[j+1][0]) { +- /* found lsb-release but there are other (preferred) release files */ ++ if ((strstr(hdout[j],"lsb-release") || strstr(hdout[j],"os-release")) && hdout[j+1] && hdout[j+1][0]) { ++ /* found lsb-release/os-release but there are other (preferred) release files */ + j++; + continue; + } +@@ -242,35 +242,28 @@ unsigned long long get_os_totalSwapSize( + + + char * get_os_installdate() { +- struct tm date; ++ struct tm * datep; + char ** hdout = NULL; +- char * dstr = NULL; + char * str = NULL; +- char * ptr = NULL; +- int rc = 0; ++ int rc = -1; + + _OSBASE_TRACE(4,("--- get_os_installdate() called")); + +- if( CIM_OS_DISTRO && strstr( CIM_OS_DISTRO, "Red Hat" ) ) { +- /* we guess it is Red Hat */ +- rc = runcommand( "rpm -qi redhat-release | grep Install" , NULL , &hdout , NULL ); +- if(rc!=0) { +- /* we guess it is Fedora */ +- rc = runcommand( "rpm -qi fedora-release | grep Install" , NULL , &hdout , NULL ); ++ if( CIM_OS_DISTRO ) { ++ if( strstr( CIM_OS_DISTRO, "Red Hat" ) ) { ++ /* we guess it is Red Hat */ ++ rc = runcommand( "rpm -q --qf '%{INSTALLTIME}' redhat-release" , NULL , &hdout , NULL ); ++ } ++ else if( strstr( CIM_OS_DISTRO, "Fedora" ) ) { ++ /* we guess it is Fedora */ ++ rc = runcommand( "rpm -q --qf '%{INSTALLTIME}' fedora-release-common" , NULL , &hdout , NULL ); + } + if( rc == 0 ) { +- str = strstr( hdout[0], ": "); +- str+=2; +- for( ptr = str ; (*ptr)!=' ' ; ptr++ ) { +- if( *(ptr+1)==' ' ) { ptr ++; } +- } +- dstr = (char *) malloc( (strlen(str)-strlen(ptr)+1)); +- strncpy( dstr , str, strlen(str)-strlen(ptr)-1); +- strptime(dstr, "%A %d %B %Y %H:%M:%S %p %Z", &date); ++ time_t t = (time_t) atoi(*hdout); ++ datep = gmtime(&t); + str = (char*)malloc(26); +- strftime(str,26,"%Y%m%d%H%M%S.000000",&date); ++ strftime(str,26,"%Y%m%d%H%M%S.000000",datep); + _cat_timezone(str, get_os_timezone()); +- if(dstr) free(dstr); + } + freeresultbuf(hdout); + } diff --git a/SPECS/sblim-cmpi-base.spec b/SPECS/sblim-cmpi-base.spec index 6a398b5..df5aa20 100644 --- a/SPECS/sblim-cmpi-base.spec +++ b/SPECS/sblim-cmpi-base.spec @@ -1,6 +1,6 @@ Name: sblim-cmpi-base Version: 1.6.4 -Release: 13%{?dist} +Release: 14%{?dist} Summary: SBLIM CMPI Base Providers License: EPL-1.0 @@ -19,6 +19,9 @@ Patch5: sblim-cmpi-base-1.6.4-prov-reg-sfcb-systemd.patch Patch6: sblim-cmpi-base-1.6.4-list-lib-dependencies.patch # Patch7: don't install COPYING with license, included through %%license Patch7: sblim-cmpi-base-1.6.4-dont-install-license.patch +# Patch8: fixes getting of InstallDate property, improves it to work +# on non en_US locales and updates support for Fedora +Patch8: sblim-cmpi-base-1.6.4-fix-get-os-install-date.patch Requires: cim-server sblim-indication_helper BuildRequires: perl-generators BuildRequires: sblim-cmpi-devel sblim-indication_helper-devel @@ -60,6 +63,7 @@ autoreconf --install --force %patch5 -p1 -b .prov-reg-sfcb-systemd %patch6 -p1 -b .list-lib-dependencies %patch7 -p1 -b .dont-install-license +%patch8 -p1 -b .fix-get-os-install-date %build %configure TESTSUITEDIR=%{_datadir}/sblim-testsuite --disable-static @@ -112,6 +116,11 @@ rm -f $RPM_BUILD_ROOT/%{_libdir}/cmpi/*a %postun -p /sbin/ldconfig %changelog +* Tue Feb 04 2020 Vitezslav Crhonek - 1.6.4-14 +- Fix getting of InstallDate property, improve it to work on non en_US locales + and update support for recent Fedora distributions + Resolves: #1776670 + * Mon Aug 05 2019 Vitezslav Crhonek - 1.6.4-13 - Rebuild