Release B.02.19.2-8

Update lshw to upstream latest(76afbaaf40e)

Resolves: bz2068386
Resolves: bz2098463

Signed-off-by: Tao Liu <ltao@redhat.com>
This commit is contained in:
Tao Liu 2022-07-15 17:14:54 +08:00
parent 002b93bdd8
commit a8aba2be1d
4 changed files with 165 additions and 3 deletions

View File

@ -0,0 +1,40 @@
From 9bf4e4c9c1bc90eee01bf26799afe64008bf5d70 Mon Sep 17 00:00:00 2001
From: Lyonel Vincent <lyonel@ezix.org>
Date: Thu, 10 Mar 2022 00:08:09 +0100
Subject: [PATCH 1/2] Github PR85 Set product name for all netdevs sharing the
same PCI number
Some network drivers can create multiple netdevs with the same PCI number
(bus info), e.g. in case of port representors in switchdev mode. In this
case, lshw displays the PCI branding string as description only for the
first netdev (lshw -c net -businfo). The remaining netdevs with the same
PCI number get a generic description ("Ethernet interface"). Moreover, the
decision which one of the netdevs gets the PCI branding string is not
deterministic, as it depends on the order of netdevs in /proc/net/dev file.
With this change, all netdevs sharing the same PCI number will get the same
description, taken from PCI branding string.
Signed-off-by: Marcin Szycik marcin.szycik@intel.com
---
src/core/network.cc | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/core/network.cc b/src/core/network.cc
index 746ac1b..4f58ad5 100644
--- a/src/core/network.cc
+++ b/src/core/network.cc
@@ -813,6 +813,10 @@ bool scan_network(hwNode & n)
existing = n.findChildByBusInfo(interface.getBusInfo());
// Multiple NICs can exist on one PCI function.
+
+ if (existing && !existing->getBusInfo().empty() && (interface.getBusInfo() == existing->getBusInfo()) && interface.getProduct().empty())
+ interface.setProduct(existing->getProduct());
+
// Only merge if MACs also match.
if (existing && (existing->getSerial() == "" || interface.getSerial() == existing->getSerial()))
{
--
2.33.1

View File

@ -0,0 +1,114 @@
From d76afbaaf40e953243da921844cddff8185324f3 Mon Sep 17 00:00:00 2001
From: Lyonel Vincent <lyonel@ezix.org>
Date: Tue, 28 Jun 2022 10:22:38 +0200
Subject: [PATCH 2/2] make version check optional
cf. Github PR#86
Rather than using an LSM such as SELinux to limit network access, or
having to add exceptions into network monitoring, allow lshw to be built
so that it doesn't do the DNS lookup to check for upstream version
updates.
Signed-off-by: Stewart Smith trawets@amazon.com
---
src/Makefile | 10 ++++++++--
src/core/Makefile | 5 ++++-
src/core/version.cc | 9 ++++++++-
3 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/src/Makefile b/src/Makefile
index 220f3f6..ac726d0 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -24,7 +24,10 @@ export ZLIB
CXX?=$(CROSS_COMPILE)c++
PKG_CONFIG ?= pkg-config
INCLUDES=-I./core/
-DEFINES=-DPREFIX=\"$(PREFIX)\" -DSBINDIR=\"$(SBINDIR)\" -DMANDIR=\"$(MANDIR)\" -DDATADIR=\"$(DATADIR)\" -DVERSION=\"$(VERSION)\"
+ifneq ($(NO_VERSION_CHECK), 1)
+REMOTE_VERSION_CHECK?=-DREMOTE_VERSION_CHECK
+endif
+DEFINES=-DPREFIX=\"$(PREFIX)\" -DSBINDIR=\"$(SBINDIR)\" -DMANDIR=\"$(MANDIR)\" -DDATADIR=\"$(DATADIR)\" -DVERSION=\"$(VERSION)\" $(REMOTE_VERSION_CHECK)
CXXFLAGS=-g -Wall -g $(INCLUDES) $(DEFINES) $(RPM_OPT_FLAGS)
ifeq ($(SQLITE), 1)
CXXFLAGS+= -DSQLITE $(shell $(PKG_CONFIG) --cflags sqlite3)
@@ -37,7 +40,10 @@ ifneq ($(shell $(LD) --help 2| grep -- --as-needed), )
LDFLAGS+= -Wl,--as-needed
endif
LDSTATIC=-static
-LIBS+=-llshw -lresolv
+LIBS+=-llshw
+ifneq ($(NO_VERSION_CHECK), 1)
+LIBS+=-lresolv
+endif
ifeq ($(SQLITE), 1)
LIBS+= $(shell $(PKG_CONFIG) --libs sqlite3)
endif
diff --git a/src/core/Makefile b/src/core/Makefile
index a8ed0cf..5035062 100644
--- a/src/core/Makefile
+++ b/src/core/Makefile
@@ -2,7 +2,10 @@ PACKAGENAME?=lshw
CXX?=$(CROSS_COMPILE)c++
INCLUDES=
-DEFINES=-DPREFIX=\"$(PREFIX)\" -DSBINDIR=\"$(SBINDIR)\" -DMANDIR=\"$(MANDIR)\" -DDATADIR=\"$(DATADIR)\"
+ifneq ($(NO_VERSION_CHECK), 1)
+REMOTE_VERSION_CHECK?=-DREMOTE_VERSION_CHECK
+endif
+DEFINES=-DPREFIX=\"$(PREFIX)\" -DSBINDIR=\"$(SBINDIR)\" -DMANDIR=\"$(MANDIR)\" -DDATADIR=\"$(DATADIR)\" $(REMOTE_VERSION_CHECK)
CXXFLAGS?=-g -Wall $(INCLUDES) $(DEFINES) $(RPM_OPT_FLAGS)
LDFLAGS=
LDSTATIC=
diff --git a/src/core/version.cc b/src/core/version.cc
index 1f64b3a..ea8dd4a 100644
--- a/src/core/version.cc
+++ b/src/core/version.cc
@@ -13,6 +13,7 @@
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
+#ifdef REMOTE_VERSION_CHECK
#include <netinet/in.h>
#include <arpa/nameser.h>
#include <resolv.h>
@@ -21,7 +22,7 @@
#ifndef PACKETSZ
#define PACKETSZ 512
#endif
-
+#endif
const char *getpackageversion()
{
@@ -31,6 +32,7 @@ const char *getpackageversion()
return "unknown";
}
+#ifdef REMOTE_VERSION_CHECK
static char *txtquery(const char *name, const char *domain, unsigned int *ttl)
{
unsigned char answer[PACKETSZ], *pt;
@@ -84,13 +86,18 @@ static char *txtquery(const char *name, const char *domain, unsigned int *ttl)
return txt;
}
+#endif
const char * checkupdates()
{
+#ifdef REMOTE_VERSION_CHECK
static char *latest = NULL;
if(!latest)
latest = txtquery(PACKAGE, "ezix.org", NULL);
return latest;
+#else
+ return NULL;
+#endif
}
--
2.33.1

View File

@ -300,7 +300,7 @@ new file mode 100644
index 0000000..8b97a16
--- /dev/null
+++ b/src/CMakeLists.txt
@@ -0,0 +1,102 @@
@@ -0,0 +1,103 @@
+if(STATIC)
+ set(ZLIB OFF)
+ set(SQLITE OFF)
@ -308,6 +308,7 @@ index 0000000..8b97a16
+
+# SQLite support
+if(SQLITE)
+ find_package(PkgConfig REQUIRED)
+ pkg_check_modules(SQLITE3 sqlite3)
+ if(SQLITE3_FOUND)
+ message("-- Enabling SQLite support")

View File

@ -2,7 +2,7 @@
Summary: Hardware lister
Name: lshw
Version: B.02.19.2
Release: 7%{?dist}
Release: 8%{?dist}
License: GPLv2
URL: http://ezix.org/project/wiki/HardwareLiSter
Source0: http://www.ezix.org/software/files/lshw-%{version}.tar.gz
@ -74,6 +74,8 @@ Patch69: 0063-Add-Catalan-translation.patch
Patch71: 0065-merge-Github-PR-77.patch
Patch72: 0066-Fix-mistakes-in-Catalan-translation.patch
Patch73: 0067-Add-Spanish-translation.patch
Patch74: 0001-Github-PR85-Set-product-name-for-all-netdevs-sharing.patch
Patch75: 0002-make-version-check-optional.patch
BuildRequires: cmake
BuildRequires: desktop-file-utils
BuildRequires: gcc
@ -83,7 +85,9 @@ BuildRequires: gtk3-devel >= 3.24
BuildRequires: libappstream-glib
BuildRequires: ninja-build
BuildRequires: python3-devel
BuildRequires: sqlite-devel
Requires: hwdata
Requires: sqlite-libs
%description
lshw is a small tool to provide detailed informaton on the hardware
configuration of the machine. It can report exact memory
@ -173,7 +177,7 @@ format.
%patch73 -p1
%build
%cmake -DNOLOGO=ON -DHWDATA=OFF -DPOLICYKIT=ON -DBUILD_SHARED_LIBS=OFF -GNinja
%cmake -DNOLOGO=ON -DHWDATA=OFF -DPOLICYKIT=ON -DSQLITE=ON -DBUILD_SHARED_LIBS=OFF -GNinja
%cmake_build
%install
@ -217,6 +221,9 @@ appstream-util validate-relax --nonet %{buildroot}/%{_datadir}/appdata/*.appdata
%{_datadir}/polkit-1/actions/org.ezix.lshw.gui.policy
%changelog
* Fri Jul 15 2022 Tao Liu <ltao@redhat.com> - B.02.19.2-8
- Update lshw to upstream latest(d76afbaaf40)
* Fri Dec 24 2021 Tao Liu <ltao@redhat.com> - B.02.19.2-7
- Update lshw to upstream latest(a2b731e7ecf)