Hello community, here is the log from the commit of package lsvpd for openSUSE:Factory checked in at 2018-06-20 15:37:21 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/lsvpd (Old) and /work/SRC/openSUSE:Factory/.lsvpd.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "lsvpd" Wed Jun 20 15:37:21 2018 rev:49 rq:618014 version:1.7.9 Changes: -------- --- /work/SRC/openSUSE:Factory/lsvpd/lsvpd.changes 2017-12-19 10:58:21.381730147 +0100 +++ /work/SRC/openSUSE:Factory/.lsvpd.new/lsvpd.changes 2018-06-20 15:37:29.644713158 +0200 @@ -1,0 +2,13 @@ +Wed Jun 20 09:26:49 UTC 2018 - jloe...@suse.com + +- version update to 1.7.9 (fate#324941) + - vpdupdate: Remove old archive db + - Add support to parse OPFR record format + - lsmcode: Add product version string to firmware information + - lsmcode: Support firmware info on BMC based Power9 system + +- removed patches: + * lsvpd.bug-1072079_add_host_number.patch + * lsvpd.bug-1072079_std_io_base_failure_workaround.patch + +------------------------------------------------------------------- Old: ---- lsvpd-1.7.8.tar.gz lsvpd.bug-1072079_add_host_number.patch lsvpd.bug-1072079_std_io_base_failure_workaround.patch New: ---- lsvpd-1.7.9.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ lsvpd.spec ++++++ --- /var/tmp/diff_new_pack.lxDfXw/_old 2018-06-20 15:37:30.328688329 +0200 +++ /var/tmp/diff_new_pack.lxDfXw/_new 2018-06-20 15:37:30.332688183 +0200 @@ -17,15 +17,13 @@ Name: lsvpd -Version: 1.7.8 +Version: 1.7.9 Release: 0 Summary: VPD Hardware Inventory Utilities for Linux License: GPL-2.0+ Group: System/Monitoring Url: http://sourceforge.net/projects/linux-diag/ Source0: http://sourceforge.net/projects/linux-diag/files/lsvpd-new/%{version}/%{name}-%{version}.tar.gz -Patch0: lsvpd.bug-1072079_add_host_number.patch -Patch1: lsvpd.bug-1072079_std_io_base_failure_workaround.patch BuildRequires: gcc-c++ BuildRequires: librtas-devel BuildRequires: libvpd2-devel @@ -47,8 +45,6 @@ %prep %setup -q -%patch0 -p1 -%patch1 -p1 %build export CFLAGS="%{optflags} -UPCI_IDS -DPCI_IDS='\"%{_datadir}/pci.ids\"' -UUSB_IDS -DUSB_IDS='\"%{_datadir}/usb.ids\"'" ++++++ lsvpd-1.7.8.tar.gz -> lsvpd-1.7.9.tar.gz ++++++ ++++ 24717 lines of diff (skipped) ++++ retrying with extended exclude list diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/lsvpd-1.7.8/ChangeLog new/lsvpd-1.7.9/ChangeLog --- old/lsvpd-1.7.8/ChangeLog 2017-03-22 09:36:30.000000000 +0100 +++ new/lsvpd-1.7.9/ChangeLog 2018-06-12 12:35:31.000000000 +0200 @@ -1,6 +1,13 @@ +1.7.9: Vasant Hegde <hegdevas...@linux.vnet.ibm.com> - Tue Jun 12 2018 +vpdupdate: Remove old archive db +Add support to parse OPFR record format +lsmcode: Add product version string to firmware information +lsmcode: Support firmware info on BMC based Power9 system +Fixed regression issues + 1.7.8: Vasant Hegde <hegdevas...@linux.vnet.ibm.com> - Wed Mar 22 2017 -- Remove temporary block file creation under /tmp -- Various bug fixes +Remove temporary block file creation under /tmp +Various bug fixes 1.7.7: Vasant Hegde <hegdevas...@linux.vnet.ibm.com> - Tue Apr 12 2016 Support for NVMe devices diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/lsvpd-1.7.8/config/compile new/lsvpd-1.7.9/config/compile --- old/lsvpd-1.7.8/config/compile 2017-03-22 09:40:22.000000000 +0100 +++ new/lsvpd-1.7.9/config/compile 1970-01-01 01:00:00.000000000 +0100 @@ -1,347 +0,0 @@ -#! /bin/sh -# Wrapper for compilers which do not understand '-c -o'. - -scriptversion=2012-10-14.11; # UTC - -# Copyright (C) 1999-2014 Free Software Foundation, Inc. -# Written by Tom Tromey <tro...@cygnus.com>. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. - -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# This file is maintained in Automake, please report -# bugs to <bug-autom...@gnu.org> or send patches to -# <automake-patc...@gnu.org>. - -nl=' -' - -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent tools from complaining about whitespace usage. -IFS=" "" $nl" - -file_conv= - -# func_file_conv build_file lazy -# Convert a $build file to $host form and store it in $file -# Currently only supports Windows hosts. If the determined conversion -# type is listed in (the comma separated) LAZY, no conversion will -# take place. -func_file_conv () -{ - file=$1 - case $file in - / | /[!/]*) # absolute file, and not a UNC file - if test -z "$file_conv"; then - # lazily determine how to convert abs files - case `uname -s` in - MINGW*) - file_conv=mingw - ;; - CYGWIN*) - file_conv=cygwin - ;; - *) - file_conv=wine - ;; - esac - fi - case $file_conv/,$2, in - *,$file_conv,*) - ;; - mingw/*) - file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` - ;; - cygwin/*) - file=`cygpath -m "$file" || echo "$file"` - ;; - wine/*) - file=`winepath -w "$file" || echo "$file"` - ;; - esac - ;; - esac -} - -# func_cl_dashL linkdir -# Make cl look for libraries in LINKDIR -func_cl_dashL () -{ - func_file_conv "$1" - if test -z "$lib_path"; then - lib_path=$file - else - lib_path="$lib_path;$file" - fi - linker_opts="$linker_opts -LIBPATH:$file" -} - -# func_cl_dashl library -# Do a library search-path lookup for cl -func_cl_dashl () -{ - lib=$1 - found=no - save_IFS=$IFS - IFS=';' - for dir in $lib_path $LIB - do - IFS=$save_IFS - if $shared && test -f "$dir/$lib.dll.lib"; then - found=yes - lib=$dir/$lib.dll.lib - break - fi - if test -f "$dir/$lib.lib"; then - found=yes - lib=$dir/$lib.lib - break - fi - if test -f "$dir/lib$lib.a"; then - found=yes - lib=$dir/lib$lib.a - break - fi - done - IFS=$save_IFS - - if test "$found" != yes; then - lib=$lib.lib - fi -} - -# func_cl_wrapper cl arg... -# Adjust compile command to suit cl -func_cl_wrapper () -{ - # Assume a capable shell - lib_path= - shared=: - linker_opts= - for arg - do - if test -n "$eat"; then - eat= - else - case $1 in - -o) - # configure might choose to run compile as 'compile cc -o foo foo.c'. - eat=1 - case $2 in - *.o | *.[oO][bB][jJ]) - func_file_conv "$2" - set x "$@" -Fo"$file" - shift - ;; - *) - func_file_conv "$2" - set x "$@" -Fe"$file" - shift - ;; - esac - ;; - -I) - eat=1 - func_file_conv "$2" mingw - set x "$@" -I"$file" - shift - ;; - -I*) - func_file_conv "${1#-I}" mingw - set x "$@" -I"$file" - shift - ;; - -l) - eat=1 - func_cl_dashl "$2" - set x "$@" "$lib" - shift - ;; - -l*) - func_cl_dashl "${1#-l}" - set x "$@" "$lib" - shift - ;; - -L) - eat=1 - func_cl_dashL "$2" - ;; - -L*) - func_cl_dashL "${1#-L}" - ;; - -static) - shared=false - ;; - -Wl,*) - arg=${1#-Wl,} - save_ifs="$IFS"; IFS=',' - for flag in $arg; do - IFS="$save_ifs" - linker_opts="$linker_opts $flag" - done - IFS="$save_ifs" - ;; - -Xlinker) - eat=1 - linker_opts="$linker_opts $2" - ;; - -*) - set x "$@" "$1" - shift - ;; - *.cc | *.CC | *.cxx | *.CXX | *.[cC]++) - func_file_conv "$1" - set x "$@" -Tp"$file" - shift - ;; - *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO]) - func_file_conv "$1" mingw - set x "$@" "$file" - shift - ;; - *) - set x "$@" "$1" - shift - ;; - esac - fi - shift - done - if test -n "$linker_opts"; then - linker_opts="-link$linker_opts" - fi - exec "$@" $linker_opts - exit 1 -} - -eat= - -case $1 in - '') - echo "$0: No command. Try '$0 --help' for more information." 1>&2 - exit 1; - ;; - -h | --h*) - cat <<\EOF -Usage: compile [--help] [--version] PROGRAM [ARGS] - -Wrapper for compilers which do not understand '-c -o'. -Remove '-o dest.o' from ARGS, run PROGRAM with the remaining -arguments, and rename the output as expected. - -If you are trying to build a whole package this is not the -right script to run: please start by reading the file 'INSTALL'. - -Report bugs to <bug-autom...@gnu.org>. -EOF - exit $? - ;; - -v | --v*) - echo "compile $scriptversion" - exit $? - ;; - cl | *[/\\]cl | cl.exe | *[/\\]cl.exe ) - func_cl_wrapper "$@" # Doesn't return... - ;; -esac - -ofile= -cfile= - -for arg -do - if test -n "$eat"; then - eat= - else - case $1 in - -o) - # configure might choose to run compile as 'compile cc -o foo foo.c'. - # So we strip '-o arg' only if arg is an object. - eat=1 - case $2 in - *.o | *.obj) - ofile=$2 - ;; - *) - set x "$@" -o "$2" - shift - ;; - esac - ;; - *.c) - cfile=$1 - set x "$@" "$1" - shift - ;; - *) - set x "$@" "$1" - shift - ;; - esac - fi - shift -done - -if test -z "$ofile" || test -z "$cfile"; then - # If no '-o' option was seen then we might have been invoked from a - # pattern rule where we don't need one. That is ok -- this is a - # normal compilation that the losing compiler can handle. If no - # '.c' file was seen then we are probably linking. That is also - # ok. - exec "$@" -fi - -# Name of file we expect compiler to create. -cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'` - -# Create the lock directory. -# Note: use '[/\\:.-]' here to ensure that we don't use the same name -# that we are using for the .o file. Also, base the name on the expected -# object file name, since that is what matters with a parallel build. -lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d -while true; do - if mkdir "$lockdir" >/dev/null 2>&1; then - break - fi - sleep 1 -done -# FIXME: race condition here if user kills between mkdir and trap. -trap "rmdir '$lockdir'; exit 1" 1 2 15 - -# Run the compile. -"$@" -ret=$? - -if test -f "$cofile"; then - test "$cofile" = "$ofile" || mv "$cofile" "$ofile" -elif test -f "${cofile}bj"; then - test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile" -fi - -rmdir "$lockdir" -exit $ret - -# Local Variables: -# mode: shell-script -# sh-indentation: 2 -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" -# time-stamp-end: "; # UTC" -# End: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/lsvpd-1.7.8/config/config.h.in new/lsvpd-1.7.9/config/config.h.in --- old/lsvpd-1.7.8/config/config.h.in 2017-03-22 09:40:19.000000000 +0100 +++ new/lsvpd-1.7.9/config/config.h.in 2018-06-12 12:35:40.000000000 +0200 @@ -130,7 +130,8 @@ slash. */ #undef LSTAT_FOLLOWS_SLASHED_SYMLINK -/* Define to the sub-directory where libtool stores uninstalled libraries. */ +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ #undef LT_OBJDIR /* Define to 1 if `major', `minor', and `makedev' are declared in <mkdev.h>. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/lsvpd-1.7.8/config/missing new/lsvpd-1.7.9/config/missing --- old/lsvpd-1.7.8/config/missing 2017-03-22 09:40:22.000000000 +0100 +++ new/lsvpd-1.7.9/config/missing 2018-06-12 12:35:41.000000000 +0200 @@ -1,9 +1,9 @@ #! /bin/sh # Common wrapper for a few potentially missing GNU programs. -scriptversion=2013-10-28.13; # UTC +scriptversion=2012-06-26.16; # UTC -# Copyright (C) 1996-2014 Free Software Foundation, Inc. +# Copyright (C) 1996-2013 Free Software Foundation, Inc. # Originally written by Fran,cois Pinard <pin...@iro.umontreal.ca>, 1996. # This program is free software; you can redistribute it and/or modify @@ -160,7 +160,7 @@ ;; autom4te*) echo "You might have modified some maintainer files that require" - echo "the 'autom4te' program to be rebuilt." + echo "the 'automa4te' program to be rebuilt." program_details 'autom4te' ;; bison*|yacc*) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/lsvpd-1.7.8/configure.ac new/lsvpd-1.7.9/configure.ac --- old/lsvpd-1.7.8/configure.ac 2017-03-22 09:37:47.000000000 +0100 +++ new/lsvpd-1.7.9/configure.ac 2018-06-12 12:35:31.000000000 +0200 @@ -3,7 +3,7 @@ AC_PREREQ([2.69]) #base -AC_INIT([lsvpd],[1.7.8],[hegdevas...@in.ibm.com,kamale...@in.ibm.com]) +AC_INIT([lsvpd],[1.7.9],[hegdevas...@in.ibm.com]) AC_CONFIG_HEADER([config/config.h]) AC_SUBST(DATE, [`date`]) AC_CONFIG_MACRO_DIR([m4]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/lsvpd-1.7.8/lsvpd.spec.in new/lsvpd-1.7.9/lsvpd.spec.in --- old/lsvpd-1.7.8/lsvpd.spec.in 2017-03-22 09:35:01.000000000 +0100 +++ new/lsvpd-1.7.9/lsvpd.spec.in 2018-06-12 12:35:31.000000000 +0200 @@ -76,6 +76,12 @@ %changelog +* Tue Jun 12 2018 - Vasant Hegde <hegdevas...@linux.vnet.ibm.com> - 1.7.9 +- vpdupdate: Remove old archive db +- Add support to parse OPFR record format +- lsmcode: Add product version string to firmware information +- lsmcode: Support firmware info on BMC based Power9 system + * Wed Mar 22 2017 - Vasant Hegde <hegdevas...@linux.vnet.ibm.com> - 1.7.8 - Remove temporary block file creation under /tmp - Various bug fixes diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/lsvpd-1.7.8/src/internal/sys_interface/devicetreecollector.cpp new/lsvpd-1.7.9/src/internal/sys_interface/devicetreecollector.cpp --- old/lsvpd-1.7.8/src/internal/sys_interface/devicetreecollector.cpp 2017-03-22 09:27:08.000000000 +0100 +++ new/lsvpd-1.7.9/src/internal/sys_interface/devicetreecollector.cpp 2018-06-12 12:35:31.000000000 +0200 @@ -765,7 +765,7 @@ { Component *parent; ostringstream val; - const DataItem *target, *lun, *bus; + const DataItem *target, *lun, *bus, *host; /* Build up a distinct YL based on parents YL - for device such as * scsi, ide, usb, etc that do not generate ibm,loc-code @@ -778,7 +778,9 @@ target = fillMe->getDeviceSpecific("XT"); lun = fillMe->getDeviceSpecific("XL"); bus = fillMe->getDeviceSpecific("XB"); - if (target != NULL && lun != NULL && bus != NULL) { + host = fillMe->getDeviceSpecific("XH"); + if (host != NULL && target != NULL && + lun != NULL && bus != NULL) { if (fillMe->mPhysicalLocation.dataValue != "") val << fillMe->mPhysicalLocation.dataValue; else if @@ -787,8 +789,8 @@ else val << getAttrValue( parent->deviceTreeNode.dataValue, "ibm,loc-code" ); - val << "-B" << bus->dataValue << "-T" << target->dataValue - << "-L" << lun->dataValue; + val << "H" << host->dataValue << "-B" << bus->dataValue + << "-T" << target->dataValue << "-L" << lun->dataValue; fillMe->mPhysicalLocation.setValue( val.str( ), 60 , __FILE__, __LINE__ ); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/lsvpd-1.7.8/src/internal/sys_interface/icollector.cpp new/lsvpd-1.7.9/src/internal/sys_interface/icollector.cpp --- old/lsvpd-1.7.8/src/internal/sys_interface/icollector.cpp 2017-03-21 07:39:15.000000000 +0100 +++ new/lsvpd-1.7.9/src/internal/sys_interface/icollector.cpp 2018-06-12 12:35:31.000000000 +0200 @@ -104,14 +104,31 @@ */ string ICollector::getBinaryData( const string& path ) { - ifstream fi(path.c_str(), ios::binary); + struct stat sbuf; string str; - str.assign(istreambuf_iterator<char>(fi), - istreambuf_iterator<char>()); - if (fi.bad()) + /* + * Check file existence and size before calling ifstream + * + * Workaround for libstdc++ issue. + * https://gcc.gnu.org/viewcvs/gcc?view=revision&revision=250545 + */ + if ((stat(path.c_str(), &sbuf) != 0)) + return ""; + + ifstream fi(path.c_str(), ios::binary); + if (!fi) return ""; + try + { + str.assign(istreambuf_iterator<char>(fi), + istreambuf_iterator<char>()); + } + catch (const std::ios_base::failure& e) + { + return ""; + } return str; } @@ -186,13 +203,15 @@ fillMe->mEngChangeLevel.setValue( val, 90, file, lineNum ); else if( key == "FN" ) fillMe->mFRU.setValue( val, 90, file, lineNum ); - else if( key == "PN" ) + // OPFR uses VP for part number + else if( key == "PN" || key == "VP" ) fillMe->mPartNumber.setValue( val, 90, file, lineNum ); else if( key == "RL" ) fillMe->mFirmwareLevel.setValue( val, 90, file, lineNum ); else if( key == "RM" ) fillMe->mFirmwareVersion.setValue( val, 90, file, lineNum ); - else if( key == "SN" ) + // OPFR uses VS for serial number + else if( key == "SN" || key == "VS" ) fillMe->mSerialNumber.setValue( val, 90, file, lineNum ); else if( key == "MN" ) fillMe->mManufacturerID.setValue( val, 90, file, lineNum ); @@ -214,6 +233,8 @@ fillMe->plantMfg.setValue( val, 90, file, lineNum ); else if( key == "VK" ) fillMe->mKeywordVersion.setValue( val, 90, file, lineNum ); + else if ( key == "DR" ) + fillMe->mDescription.setValue( val, 90, file, lineNum ); else if( key == "SZ" ) fillMe->addDeviceSpecific( key, "Size", val, 90 ); else if( key == "CC" ) @@ -230,6 +251,18 @@ else if ( key == "ME" ) fillMe->addDeviceSpecific( key, "Update Access Key Exp" " Date", val, 90 ); + else if ( key == "CE" ) + fillMe->addDeviceSpecific( key, "CCIN Extension", + val, 90 ); + else if ( key == "CT" ) + fillMe->addDeviceSpecific( key, "Card Type", val, 90 ); + else if ( key == "HW" ) + fillMe->addDeviceSpecific( key, "Hardware Version", + val, 90 ); + else if ( key == "VN" ) + fillMe->addDeviceSpecific( key, "Vendor", val, 90 ); + else if ( key == "MB" ) + fillMe->addDeviceSpecific( key, "Build Date", val, 90 ); else if( key[ 0 ] == 'U' ) fillMe->addUserData( key, "User Data", val, 90, true ); else if( key[ 0 ] == 'Z' ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/lsvpd-1.7.8/src/internal/sys_interface/sysfstreecollector.cpp new/lsvpd-1.7.9/src/internal/sys_interface/sysfstreecollector.cpp --- old/lsvpd-1.7.8/src/internal/sys_interface/sysfstreecollector.cpp 2017-03-22 06:00:37.000000000 +0100 +++ new/lsvpd-1.7.9/src/internal/sys_interface/sysfstreecollector.cpp 2018-06-12 12:35:31.000000000 +0200 @@ -1669,6 +1669,9 @@ */ newDevDir = dev_syspath + "/" + dev_childname; str = getAttrValue( newDevDir, "dev" ); + if (str.empty()) + return; + beg = end = 0; while (end < (int) str.length() && str[end] != ':') end++; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/lsvpd-1.7.8/src/internal/updater.cpp new/lsvpd-1.7.9/src/internal/updater.cpp --- old/lsvpd-1.7.8/src/internal/updater.cpp 2017-03-21 07:39:15.000000000 +0100 +++ new/lsvpd-1.7.9/src/internal/updater.cpp 2018-06-12 12:35:31.000000000 +0200 @@ -42,6 +42,7 @@ #include <unistd.h> #include <fcntl.h> #include <zlib.h> +#include <cstdlib> #include <libvpd-2/component.hpp> #include <libvpd-2/system.hpp> @@ -164,6 +165,46 @@ } /** + * Method to remove old DB archives. + */ +void removeOldArchiveDB(void) +{ + int n, fp; + struct dirent **namelist; + Logger logger; + + n = scandir(env.c_str(), &namelist, NULL, alphasort); + if (n <= 0) { + ostringstream os; + os << "Error scanning directory : " << env.c_str() << endl; + logger.log( os.str( ), LOG_INFO ); + return; + } + + for (int i = 0; i < n; i++) + { + string fname = string(namelist[i]->d_name); + string pathname = env + "/" + fname; + + if ((fname.find("vpd.db.") == std::string::npos) && + (fname.find(".gz") == std::string::npos)) { + free(namelist[i]); + continue; + } + unlink(pathname.c_str()); + free(namelist[i]); + } + + fp = open(env.c_str(), O_RDWR); + if (fp >= 0) { + fsync(fp); + close(fp); + } + + free(namelist); +} + +/** * Method moves the old db out of the way. */ void archiveDB( const string& fullPath ) @@ -292,6 +333,7 @@ string fullPath = env + "/" + file; + removeOldArchiveDB( ); archiveDB( fullPath ); Gatherer info( limitSCSI ); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/lsvpd-1.7.8/src/output/lsmcode.cpp new/lsvpd-1.7.9/src/output/lsmcode.cpp --- old/lsvpd-1.7.8/src/output/lsmcode.cpp 2017-03-21 07:39:15.000000000 +0100 +++ new/lsvpd-1.7.9/src/output/lsmcode.cpp 2018-06-12 12:35:31.000000000 +0200 @@ -23,6 +23,7 @@ #include <rtascollector.hpp> #include <platformcollector.hpp> +#include <devicetreecollector.hpp> #include <libvpd-2/vpdretriever.hpp> #include <libvpd-2/component.hpp> #include <libvpd-2/dataitem.hpp> @@ -39,6 +40,7 @@ #define _GNU_SOURCE // for getopt_long #endif +#include <dirent.h> #include <unistd.h> #include <getopt.h> #include <zlib.h> @@ -50,6 +52,9 @@ #include <iomanip> #include <limits.h> +/* Firmware information device tree node on PowerNV system */ +#define FW_VERSION_DT_NODE DEVTREEPATH"/ibm,firmware-versions/" + /* IPMI tool */ #define CMD_IPMITOOL "ipmitool" @@ -120,16 +125,14 @@ } /* Get System Firmware FRU information on BMC based system */ -static string bmc_get_fw_fru_info(string ipmitool) +static string bmc_get_fw_fru_info(string ipmitool, string interface) { - string cmd = ipmitool + " fru"; + string cmd = ipmitool + interface; string fruData, fwData; size_t start, end; - if (HelperFunctions::execCmd(cmd.c_str(), fruData)) { - cout << "Failed to execute ipmitool command" << endl; + if (HelperFunctions::execCmd(cmd.c_str(), fruData)) return string(); - } start = fruData.find("System Firmware"); if (start == string::npos) @@ -148,10 +151,140 @@ return fwData; parse_err: - cout << "Failed to get System Firmware information" << endl; return string(); } +static string read_dt_property(const string& path, const string& attrName) +{ + struct stat info; + string fullPath; + string ret = ""; + + ostringstream os; + os << path << "/" << attrName; + fullPath = os.str( ); + + if (stat(fullPath.c_str( ), &info) != 0) { + ostringstream os; + if (errno != ENOENT) { + os << "Error statting " << fullPath << ", errno: " << errno; + Logger().log( os.str( ), LOG_ERR ); + } + return ret; + } + + ifstream attrIn; + attrIn.exceptions ( std::ifstream::failbit | std::ifstream::badbit ); + try { + attrIn.open( fullPath.c_str( ) ); + } + catch (std::ifstream::failure e) { + ostringstream os; + os << "Error opening " << fullPath; + Logger().log(os.str( ), LOG_WARNING); + return ret; + } + + if (attrIn) { + char * strBuf; + try + { + strBuf = new char [ info.st_size + 1 ]; + } + catch (exception& e) + { + return ret; + } + memset( strBuf, '\0', info.st_size + 1 ); + attrIn.read( strBuf, info.st_size ); + ret = strBuf; + attrIn.close( ); + delete [] strBuf; + } + return ret; +} + +/* Get system firmware information on BMC based system via device tree */ +static string bmc_get_fw_dt_info(void) +{ + string fwdata, tag, val, prod_ver = "", prod_extra = "", prop_ver = ""; + struct dirent *ent; + DIR * pDBdir = NULL; + /* Properties to ignore from DT/ibm,firmware-versions node */ + const char *ignore_dt[] = {"phandle", "name"}; + /* Properties to look for version string */ + const char *version_prop[] = {"version", "IBM", "open-power", "buildroot"}; + int i; + bool ignore_dt_flag = false; + + pDBdir = opendir(FW_VERSION_DT_NODE); + if (pDBdir == NULL) { + stringstream os; + os << "Error opening directory " << FW_VERSION_DT_NODE << endl; + Logger().log(os.str( ), LOG_ERR); + return string(""); + } + + /* Get the version property */ + for (i = 0; i < (int)(sizeof(version_prop)/sizeof(char *)); i++) { + string path = FW_VERSION_DT_NODE + string(version_prop[i]); + if (HelperFunctions::file_exists(path)) { + prop_ver = version_prop[i]; + break; + } + } + + fwdata = string("\n Product Name : OpenPOWER Firmware\n"); + + /* + * Different BMCs uses different device tree property to display + * product name. On P9 system OPAL firmware takes care of parsing + * and it will add version property under device tree. But on older + * systems will have IBM or open-power or buildroot depending on + * who builds firmware image. + */ + if (prop_ver != string("")) { + tag = string(" Product Version : "); + prod_ver = read_dt_property(string(FW_VERSION_DT_NODE), prop_ver); + if (prod_ver != string("")) { + if (prop_ver.compare("version") == 0) + prod_ver = tag + prod_ver + string("\n"); + else + prod_ver = tag + prop_ver + string("-") + prod_ver + string("\n"); + } + } + + /* Form the product extra items using remaining properties */ + while ((ent = readdir( pDBdir )) != NULL) { + string fname = ent->d_name; + for (i = 0; i < (int)(sizeof(ignore_dt)/sizeof(char *)); i++) { + if (fname.compare(string(ignore_dt[i])) == 0) { + ignore_dt_flag = true; + break; + } + } + + if (ignore_dt_flag == true) { + ignore_dt_flag = false; + continue; + } + + if (prop_ver != string("")) { + if (fname.compare(prop_ver) == 0) + continue; + } + + tag = string(" Product Extra : \t"); + val = read_dt_property(string(FW_VERSION_DT_NODE), fname); + if (val == string("")) + continue; + prod_extra = prod_extra + tag + fname + string("-") + val + string("\n"); + } + + fwdata = fwdata + prod_ver + prod_extra; + return fwdata; +} + /* Get production version */ static string bmc_get_product_version(string fwData) { @@ -181,13 +314,30 @@ * based system. Hence we don't store this information in VPD db. */ if (PlatformCollector::isBMCBasedSystem()) { - string ipmitool = get_ipmitool_path(); - if (ipmitool.empty()) - return false; - - string fwData = bmc_get_fw_fru_info(ipmitool); - if (fwData.empty()) - return false; + string fwData; + if (!access(FW_VERSION_DT_NODE, F_OK | R_OK)) { + fwData = bmc_get_fw_dt_info(); + if (fwData.empty()) + return false; + } else { + string ipmitool = get_ipmitool_path(); + if (ipmitool.empty()) + return false; + + /* + * AMI BMC stack supports usb interface. If usb interface + * is available use that, else fall back to inband interface. + */ + fwData = bmc_get_fw_fru_info(ipmitool, string(" -I usb fru")); + if (fwData.empty()) { + fwData = bmc_get_fw_fru_info(ipmitool, string(" fru")); + if (fwData.empty()) { + cerr << "Failed to get System Firmware \ + information" << endl; + return false; + } + } + } if ( all ) { string pVersion = bmc_get_product_version(fwData); @@ -401,8 +551,7 @@ } if( device == "" ) { - if (printSystem( root->getLeaves( ) ) != true) - return; + printSystem( root->getLeaves( ) ); } if( !all && device == "" )