Updating to lsvpd-1.6.7

This commit is contained in:
Eric Munson 2009-12-02 12:23:02 +00:00
parent 46cdd0e2fc
commit ac51452a1a
5 changed files with 157 additions and 5 deletions

View File

@ -1 +1 @@
lsvpd-1.6.5.tar.gz
lsvpd-1.6.7.tar.gz

View File

@ -1 +1,2 @@
lsvpd-1_6_5-1_fc10:HEAD:lsvpd-1.6.5-1.src.rpm:1237209622
lsvpd-1_6_7-1_fc12:HEAD:lsvpd-1.6.7-1.src.rpm:1259756539

View File

@ -0,0 +1,141 @@
### Eclipse Workspace Patch 1.0
#P lsvpd-new
Add ids file lookup to runtime.
Currently the pci.ids and usb.ids files are located by the Makefile
and the location defined by the build. This presents a problem when
the build system has the files in a different location from the host.
This patch addresses this problem by moving the logic to locate the
ids files into the vpdupdate code.
Signed-off-by: Eric B Munson <ebmunson@us.ibm.com>
---
Index: src/include/devicelookup.hpp
===================================================================
RCS file: /cvsroot/lsvpd/lsvpd-new/src/include/devicelookup.hpp,v
retrieving revision 1.1
diff -u -r1.1 devicelookup.hpp
--- src/include/devicelookup.hpp 18 Feb 2008 19:45:54 -0000 1.1
+++ src/include/devicelookup.hpp 16 Oct 2009 09:35:42 -0000
@@ -58,7 +58,11 @@
void fillManus( ifstream& idFile );
+ static void findIdsPrefix( );
+
public:
+ static string idsPrefix;
+
DeviceLookup( ifstream& idFile );
~DeviceLookup( );
const Manufacturer* getManufacturer( int id ) const;
@@ -99,8 +103,8 @@
*/
const string& getName( int manID, int devID, int subID )const;
- static const string PCI_ID_FILE;
- static const string USB_ID_FILE;
+ static string getPciIds( );
+ static string getUsbIds( );
};
}
#endif
Index: src/internal/sys_interface/sysfstreecollector.cpp
===================================================================
RCS file: /cvsroot/lsvpd/lsvpd-new/src/internal/sys_interface/sysfstreecollector.cpp,v
retrieving revision 1.11
diff -u -r1.11 sysfstreecollector.cpp
--- src/internal/sys_interface/sysfstreecollector.cpp 16 Mar 2009 13:24:48 -0000 1.11
+++ src/internal/sys_interface/sysfstreecollector.cpp 16 Oct 2009 09:35:43 -0000
@@ -77,7 +77,7 @@
mPciTable = NULL;
mUsbTable = NULL;
- id.open( DeviceLookup::PCI_ID_FILE.c_str( ), ios::in );
+ id.open( DeviceLookup::getPciIds( ).c_str( ), ios::in );
if( id )
{
mPciTable = new DeviceLookup( id );
@@ -91,7 +91,7 @@
LOG_ERR );
}
- id.open( DeviceLookup::USB_ID_FILE.c_str( ), ios::in );
+ id.open( DeviceLookup::getUsbIds( ).c_str( ), ios::in );
if( id )
{
mUsbTable = new DeviceLookup( id );
Index: src/internal/devicelookup.cpp
===================================================================
RCS file: /cvsroot/lsvpd/lsvpd-new/src/internal/devicelookup.cpp,v
retrieving revision 1.2
diff -u -r1.2 devicelookup.cpp
--- src/internal/devicelookup.cpp 18 Feb 2008 19:45:54 -0000 1.2
+++ src/internal/devicelookup.cpp 16 Oct 2009 09:35:43 -0000
@@ -27,6 +27,8 @@
#include <libvpd-2/vpdexception.hpp>
#include <libvpd-2/lsvpd.hpp>
+#include <sys/stat.h>
+
/**
* The Manufacturer object will store the id and name of a single manufacturer
* entry from the pci.ids file. It will also store a hash_map of devices
@@ -34,8 +36,6 @@
*/
namespace lsvpd
{
- const string DeviceLookup::PCI_ID_FILE( PCI_IDS );
- const string DeviceLookup::USB_ID_FILE( USB_IDS );
DeviceLookup::DeviceLookup( ifstream& pciID )
{
@@ -119,4 +119,45 @@
const Device* d = m->getDevice( devID );
return (d->getSubDevice( subID ))->getName( );
}
+
+ void DeviceLookup::findIdsPrefix( )
+ {
+ // There are 6 potential locations for the ids files:
+ // /usr/share, /usr/local/share, /usr/share/misc,
+ // /usr/local/share/misc, /usr/share/hwdata,
+ // and /usr/local/share/hwdata
+
+ struct stat buf;
+
+ if ( !stat( "/usr/share/pci.ids", &buf ) )
+ DeviceLookup::idsPrefix = "/usr/share";
+ else if ( !stat( "/usr/local/share/pci.ids", &buf ) )
+ DeviceLookup::idsPrefix = "/usr/local/share";
+ else if ( !stat( "/usr/share/misc/pci.ids", &buf ) )
+ DeviceLookup::idsPrefix = "/usr/share/misc";
+ else if ( !stat( "/usr/local/share/misc/pci.ids", &buf ) )
+ DeviceLookup::idsPrefix = "/usr/local/share/misc";
+ else if ( !stat( "/usr/share/hwdata/pci.ids", &buf ) )
+ DeviceLookup::idsPrefix = "/usr/share/hwdata";
+ else if ( !stat( "/usr/local/share/hwdata/pci.ids", &buf ) )
+ DeviceLookup::idsPrefix = "/usr/local/share/hwdata";
+ }
+
+ string DeviceLookup::getPciIds( )
+ {
+ if ( DeviceLookup::idsPrefix == "" )
+ DeviceLookup::findIdsPrefix( );
+
+ return DeviceLookup::idsPrefix + "/pci.ids";
+ }
+
+ string DeviceLookup::getUsbIds( )
+ {
+ if ( DeviceLookup::idsPrefix == "" )
+ findIdsPrefix( );
+
+ return DeviceLookup::idsPrefix + "/usb.ids";
+ }
+
+ string DeviceLookup::idsPrefix = "";
}

View File

@ -1,9 +1,9 @@
%define name lsvpd
%define version 1.6.5
%define version 1.6.7
Name: %{name}
Version: %{version}
Release: 3%{?dist}
Release: 1%{?dist}
Summary: VPD/hardware inventory utilities for Linux
Group: Applications/System
@ -11,12 +11,16 @@ License: GPLv2+
URL: http://linux-diag.sf.net/Lsvpd.html
Source: http://downloads.sourceforge.net/linux-diag/%{name}-%{version}.tar.gz
Patch0: lsvpd-1.6.4-sg3_utils-1.26.patch
Patch1: lsvpd-1.6.7-ids-lookup.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: sg3_utils-devel libvpd-devel zlib-devel
Requires(post): /usr/sbin/vpdupdate
# By default, build without librtas because it does not yet exist in Fedora
%{!?_with_librtas: %{!?_without_librtas: %define _without_librtas --without-librtas }}
# librtas is now part of Fedora, lsvpd provides much more information with
# librtas on POWER
#%{!?_with_librtas: %{!?_without_librtas: %define _without_librtas --without-librtas }}
%ifarch ppc
%{?_with_librtas:BuildRequires: librtas-devel }
@ -39,6 +43,7 @@ on POWER PC based systems.
%prep
%setup -q
%patch0 -p1
%patch1 -p0
%build
%configure
@ -71,6 +76,11 @@ on POWER PC based systems.
%dir %{_sysconfdir}/lsvpd
%changelog
* Wed Dec 02 2009 Eric Munson <ebmunson@us.ibm.com> - 1.6.7-1
- Update to latest lsvpd release
- Add librtas support to build on POWERPC
- Add patch to lookup *.ids file location at runtime
* Sat Jul 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.6.5-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild

View File

@ -1 +1 @@
cdc0e247fd31bec97989d128d61efd3e lsvpd-1.6.5.tar.gz
97e6363177ee6c5dbf0cb198f5554af8 lsvpd-1.6.7.tar.gz