import sblim-cmpi-base-1.6.4-14.el8

This commit is contained in:
CentOS Sources 2020-07-28 03:21:55 -04:00 committed by Stepan Oksanichenko
parent 45b4565f5e
commit a91631bea5
2 changed files with 77 additions and 1 deletions

View File

@ -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);
}

View File

@ -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 <vcrhonek@redhat.com> - 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 <vcrhonek@redhat.com> - 1.6.4-13
- Rebuild