From ef6ce1c675eee8a2c2f2b9bfac1f9cd10ddcc024 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Tue, 9 Jun 2020 19:53:16 +0000 Subject: [PATCH] import lshw-B.02.19.2-2.el8 --- .gitignore | 1 + .lshw.metadata | 1 + ...001-report-CPU-family-model-stepping.patch | 96 ++ ...ve-PnP-devices-to-the-ISA-LPC-bridge.patch | 53 + .../0003-correctly-format-SMBIOS-UUID.patch | 34 + SOURCES/0004-cosmetic-clean-up.patch | 27 + .../0005-begin-work-on-input-devices.patch | 223 ++++ SOURCES/0006-cosmetic-fixes.patch | 34 + SOURCES/0007-detect-sound-devices.patch | 141 +++ SOURCES/0008-detect-framebuffers.patch | 102 ++ ...ct-input-devices-to-the-right-parent.patch | 29 + ...ree-Add-chip-id-from-the-dimm-module.patch | 39 + ...11-devtree-Add-chip-id-from-CPU-node.patch | 40 + ...mes-fix-segfault-in-apfs-volume-code.patch | 31 + SOURCES/0013-merge-Github-PR-53.patch | 58 + ...Add-capabilites-to-the-OPAL-Firmware.patch | 96 ++ ...ogical-names-being-truncated-dev-sda.patch | 29 + SOURCES/0016-code-clean-up-for-read-3.patch | 51 + ...eport-product-model-on-Power-systems.patch | 27 + SOURCES/lshw-B.02.18-revert-json.patch | 66 ++ SOURCES/lshw-B.02.18-scandir.patch | 26 + ...-Add-the-FindPkgConfig-to-CMakeLists.patch | 28 + SOURCES/lshw-B.02.19.2-cmake.patch | 992 ++++++++++++++++++ SPECS/lshw.spec | 367 +++++++ 24 files changed, 2591 insertions(+) create mode 100644 .gitignore create mode 100644 .lshw.metadata create mode 100644 SOURCES/0001-report-CPU-family-model-stepping.patch create mode 100644 SOURCES/0002-move-PnP-devices-to-the-ISA-LPC-bridge.patch create mode 100644 SOURCES/0003-correctly-format-SMBIOS-UUID.patch create mode 100644 SOURCES/0004-cosmetic-clean-up.patch create mode 100644 SOURCES/0005-begin-work-on-input-devices.patch create mode 100644 SOURCES/0006-cosmetic-fixes.patch create mode 100644 SOURCES/0007-detect-sound-devices.patch create mode 100644 SOURCES/0008-detect-framebuffers.patch create mode 100644 SOURCES/0009-try-to-connect-input-devices-to-the-right-parent.patch create mode 100644 SOURCES/0010-devtree-Add-chip-id-from-the-dimm-module.patch create mode 100644 SOURCES/0011-devtree-Add-chip-id-from-CPU-node.patch create mode 100644 SOURCES/0012-volumes-fix-segfault-in-apfs-volume-code.patch create mode 100644 SOURCES/0013-merge-Github-PR-53.patch create mode 100644 SOURCES/0014-devtree-Add-capabilites-to-the-OPAL-Firmware.patch create mode 100644 SOURCES/0015-fix-issue-with-logical-names-being-truncated-dev-sda.patch create mode 100644 SOURCES/0016-code-clean-up-for-read-3.patch create mode 100644 SOURCES/0017-report-product-model-on-Power-systems.patch create mode 100644 SOURCES/lshw-B.02.18-revert-json.patch create mode 100644 SOURCES/lshw-B.02.18-scandir.patch create mode 100644 SOURCES/lshw-B.02.19.2-Add-the-FindPkgConfig-to-CMakeLists.patch create mode 100644 SOURCES/lshw-B.02.19.2-cmake.patch create mode 100644 SPECS/lshw.spec diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ce20e98 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/lshw-B.02.19.2.tar.gz diff --git a/.lshw.metadata b/.lshw.metadata new file mode 100644 index 0000000..fa97b84 --- /dev/null +++ b/.lshw.metadata @@ -0,0 +1 @@ +f44f0fa34968fdc0cce42e83c44b17e43579e978 SOURCES/lshw-B.02.19.2.tar.gz diff --git a/SOURCES/0001-report-CPU-family-model-stepping.patch b/SOURCES/0001-report-CPU-family-model-stepping.patch new file mode 100644 index 0000000..8cb190e --- /dev/null +++ b/SOURCES/0001-report-CPU-family-model-stepping.patch @@ -0,0 +1,96 @@ +From f914f225975bb4a146792c2b0181b8d0e01ff3a6 Mon Sep 17 00:00:00 2001 +From: Lyonel Vincent +Date: Sat, 28 Mar 2020 11:54:10 +0100 +Subject: [PATCH 01/17] report CPU family/model/stepping + +--- + src/core/cpuinfo.cc | 21 +++++++++++++++++++-- + src/core/hw.cc | 20 ++++++++++++++++++++ + src/core/hw.h | 1 + + 3 files changed, 40 insertions(+), 2 deletions(-) + +diff --git a/src/core/cpuinfo.cc b/src/core/cpuinfo.cc +index 33085fda1159..eceb83aa4e3a 100644 +--- a/src/core/cpuinfo.cc ++++ b/src/core/cpuinfo.cc +@@ -463,6 +463,14 @@ string value) + } + if (id == "model name") + cpu->setProduct(value); ++ if (id == "microcode") ++ cpu->setConfig(id, stoll(value, NULL, 0)); ++ if (id == "cpu family") ++ cpu->addHint(id, stoll(value, NULL, 0)); ++ if (id == "model") ++ cpu->addHint(id, stoll(value, NULL, 0)); ++ if (id == "stepping") ++ cpu->addHint(id, stoll(value, NULL, 0)); + //if ((id == "cpu MHz") && (cpu->getSize() == 0)) + //{ + //cpu->setSize((long long) (1000000L * atof(value.c_str()))); +@@ -667,8 +675,17 @@ bool scan_cpuinfo(hwNode & n) + } + + hwNode *cpu = getcpu(n, 0); +- if(cpu && (n.getWidth()==0)) +- n.setWidth(cpu->getWidth()); ++ if(cpu) ++ { ++ hw::value family, model, stepping; ++ family = cpu->getHint("cpu family"); ++ model = cpu->getHint("model"); ++ stepping = cpu->getHint("stepping"); ++ if(family.defined() && model.defined() && stepping.defined()) ++ cpu->setVersion(tostring(family.asInteger())+"."+tostring(model.asInteger())+"."+tostring(stepping.asInteger())); ++ if(n.getWidth()==0) ++ n.setWidth(cpu->getWidth()); ++ } + + return true; + } +diff --git a/src/core/hw.cc b/src/core/hw.cc +index 4522c1af0fc3..a59273008862 100644 +--- a/src/core/hw.cc ++++ b/src/core/hw.cc +@@ -2432,6 +2432,26 @@ string value::asString() const + } + + ++long long value::asInteger() const ++{ ++ if(!This) return 0; ++ ++ switch(This->type) ++ { ++ case hw::text: ++ return stoll(This->s, NULL, 0); ++ case hw::integer: ++ return This->ll; ++ case hw::boolean: ++ return This->b?1:0; ++ case hw::nil: ++ return 0; ++ }; ++ ++ return 0; ++} ++ ++ + bool value::defined() const + { + if(!This) return false; +diff --git a/src/core/hw.h b/src/core/hw.h +index 3cb782b0e635..451e9b3cf26a 100644 +--- a/src/core/hw.h ++++ b/src/core/hw.h +@@ -79,6 +79,7 @@ namespace hw + bool operator ==(const value &) const; + + string asString() const; ++ long long asInteger() const; + bool defined() const; + + private: +-- +2.17.1 + diff --git a/SOURCES/0002-move-PnP-devices-to-the-ISA-LPC-bridge.patch b/SOURCES/0002-move-PnP-devices-to-the-ISA-LPC-bridge.patch new file mode 100644 index 0000000..7187850 --- /dev/null +++ b/SOURCES/0002-move-PnP-devices-to-the-ISA-LPC-bridge.patch @@ -0,0 +1,53 @@ +From 126bc4387648fabf0478d0b869fe6bc52676b447 Mon Sep 17 00:00:00 2001 +From: Lyonel Vincent +Date: Sun, 29 Mar 2020 19:25:39 +0200 +Subject: [PATCH 02/17] move PnP devices to the ISA/LPC bridge + +--- + src/core/pnp.cc | 14 ++++++++++---- + 1 file changed, 10 insertions(+), 4 deletions(-) + +diff --git a/src/core/pnp.cc b/src/core/pnp.cc +index 8c92adf647a0..6a391856ec52 100644 +--- a/src/core/pnp.cc ++++ b/src/core/pnp.cc +@@ -165,6 +165,11 @@ hw::hwClass pnp_class(const string & pnpid) + return hw::generic; + } + ++static bool ISAbridge(const hwNode & n) ++{ ++ return n.getClass()==hw::bridge && n.isCapable("isa"); ++} ++ + bool scan_pnp(hwNode & n) + { + vector < sysfs::entry > entries = sysfs::entries_by_bus("pnp"); +@@ -172,11 +177,12 @@ bool scan_pnp(hwNode & n) + if (entries.empty()) + return false; + +- hwNode *core = n.getChild("core"); +- if (!core) ++ hwNode *isapnpbridge = n.findChild(ISAbridge); ++ if (!isapnpbridge) isapnpbridge = n.getChild("core"); ++ if (!isapnpbridge) + { + n.addChild(hwNode("core", hw::bus)); +- core = n.getChild("core"); ++ isapnpbridge = n.getChild("core"); + } + + for (vector < sysfs::entry >::iterator it = entries.begin(); +@@ -208,7 +214,7 @@ bool scan_pnp(hwNode & n) + device.setProduct("PnP device " + pnpid); + device.claim(); + +- core->addChild(device); ++ isapnpbridge->addChild(device); + } + return true; + } +-- +2.17.1 + diff --git a/SOURCES/0003-correctly-format-SMBIOS-UUID.patch b/SOURCES/0003-correctly-format-SMBIOS-UUID.patch new file mode 100644 index 0000000..8282c02 --- /dev/null +++ b/SOURCES/0003-correctly-format-SMBIOS-UUID.patch @@ -0,0 +1,34 @@ +From bb82dda52da2029a527577a796daffcbc97d8e83 Mon Sep 17 00:00:00 2001 +From: Lyonel Vincent +Date: Mon, 30 Mar 2020 23:36:15 +0200 +Subject: [PATCH 03/17] correctly format SMBIOS UUID +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +cf. https://en.wikipedia.org/wiki/Universally_unique_identifier (RFC 4122 Section 3 requires that the characters be generated in lower case, while being case-insensitive on input.) + +cf. https://www.dmtf.org/sites/default/files/standards/documents/DSP0134_2.7.1.pdf §7.2.1 + +--- + src/core/dmi.cc | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/core/dmi.cc b/src/core/dmi.cc +index c4c01e02a392..30b3ab3b995c 100644 +--- a/src/core/dmi.cc ++++ b/src/core/dmi.cc +@@ -195,8 +195,8 @@ static string dmi_uuid(const u8 * p) + return string(REMOVED); + + snprintf(buffer, sizeof(buffer), +- "%02X%02X%02X%02X-%02X%02X-%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X", +- p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], ++ "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x", ++ p[3], p[2], p[1], p[0], p[5], p[4], p[7], p[6], p[8], p[9], p[10], + p[11], p[12], p[13], p[14], p[15]); + + return hw::strip(string(buffer)); +-- +2.17.1 + diff --git a/SOURCES/0004-cosmetic-clean-up.patch b/SOURCES/0004-cosmetic-clean-up.patch new file mode 100644 index 0000000..ed45f19 --- /dev/null +++ b/SOURCES/0004-cosmetic-clean-up.patch @@ -0,0 +1,27 @@ +From aea375aeb4f58a35afd1ec2998a04060bc8fccfa Mon Sep 17 00:00:00 2001 +From: Lyonel Vincent +Date: Tue, 31 Mar 2020 23:27:36 +0200 +Subject: [PATCH 04/17] cosmetic clean-up + +--- + src/core/mmc.cc | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/core/mmc.cc b/src/core/mmc.cc +index 96c2c49e4597..1385e116c7ae 100644 +--- a/src/core/mmc.cc ++++ b/src/core/mmc.cc +@@ -327,8 +327,8 @@ bool scan_mmc(hwNode & n) + device->setDescription("MMC Host"); + device->setModalias(e.modalias()); + +- vector < sysfs::entry > namespaces = e.devices(); +- for(vector < sysfs::entry >::iterator i = namespaces.begin(); i != namespaces.end(); ++i) ++ vector < sysfs::entry > devices = e.devices(); ++ for(vector < sysfs::entry >::iterator i = devices.begin(); i != devices.end(); ++i) + { + const sysfs::entry & d = *i; + +-- +2.17.1 + diff --git a/SOURCES/0005-begin-work-on-input-devices.patch b/SOURCES/0005-begin-work-on-input-devices.patch new file mode 100644 index 0000000..aec0533 --- /dev/null +++ b/SOURCES/0005-begin-work-on-input-devices.patch @@ -0,0 +1,223 @@ +From 691ed58e2838ca3e50e899f013e259ea84f6bfe9 Mon Sep 17 00:00:00 2001 +From: Lyonel Vincent +Date: Wed, 1 Apr 2020 00:43:15 +0200 +Subject: [PATCH 05/17] begin work on input devices + +still missing: + * capabilities + * properties + * report at least as much information as /proc/bus/input/devices + +--- + src/core/hw.cc | 2 +- + src/core/input.cc | 146 ++++++++++++++++++++++++++++++++++++++++++++++ + src/core/input.h | 8 +++ + src/core/main.cc | 4 ++ + 4 files changed, 159 insertions(+), 1 deletions(-) + create mode 100644 src/core/input.cc + create mode 100644 src/core/input.h + +diff --git a/src/core/hw.cc b/src/core/hw.cc +index a59273008862..f7da370816c5 100644 +--- a/src/core/hw.cc ++++ b/src/core/hw.cc +@@ -1083,7 +1083,7 @@ void hwNode::setLogicalName(const string & name) + This->logicalnames.push_back("/dev/" + n); + } + else +- This->logicalnames.push_back(n); ++ This->logicalnames.push_back(basename(n.c_str())); + + if(This->dev == "") + This->dev = get_devid(n); +diff --git a/src/core/input.cc b/src/core/input.cc +new file mode 100644 +index 000000000000..1f14fa9d8b56 +--- /dev/null ++++ b/src/core/input.cc +@@ -0,0 +1,146 @@ ++#include "version.h" ++#include "hw.h" ++#include "sysfs.h" ++#include "osutils.h" ++#include "input.h" ++#include "disk.h" ++#include "heuristics.h" ++ ++#include ++#include ++ ++__ID("@(#) $Id$"); ++ ++#define BUS_PCI 0x01 ++#define BUS_ISAPNP 0x02 ++#define BUS_USB 0x03 ++#define BUS_HIL 0x04 ++#define BUS_BLUETOOTH 0x05 ++#define BUS_VIRTUAL 0x06 ++ ++#define BUS_ISA 0x10 ++#define BUS_I8042 0x11 ++#define BUS_XTKBD 0x12 ++#define BUS_RS232 0x13 ++#define BUS_GAMEPORT 0x14 ++#define BUS_PARPORT 0x15 ++#define BUS_AMIGA 0x16 ++#define BUS_ADB 0x17 ++#define BUS_I2C 0x18 ++#define BUS_HOST 0x19 ++#define BUS_GSC 0x1A ++#define BUS_ATARI 0x1B ++#define BUS_SPI 0x1C ++#define BUS_RMI 0x1D ++#define BUS_CEC 0x1E ++#define BUS_INTEL_ISHTP 0x1F ++ ++using namespace std; ++ ++bool scan_input(hwNode & n) ++{ ++ vector < sysfs::entry > entries = sysfs::entries_by_class("input"); ++ ++ if (entries.empty()) ++ return false; ++ ++ for (vector < sysfs::entry >::iterator it = entries.begin(); ++ it != entries.end(); ++it) ++ { ++ const sysfs::entry & e = *it; ++ ++ if(!e.hassubdir("id")) continue; ++ ++ hwNode *device = n.findChildByBusInfo(e.leaf().businfo()); ++ if(!device) ++ device = n.addChild(hwNode("input", hw::input)); ++ else ++ { ++ if(device->getClass() == hw::generic) ++ device->setClass(hw::input); ++ } ++ device->claim(); ++ device->setLogicalName("input/"+e.name()); ++ device->setProduct(e.string_attr("name")); ++ device->setModalias(e.modalias()); ++ switch(e.hex_attr("id/bustype")) ++ { ++ case BUS_PCI: ++ device->addCapability("pci", "PCI"); ++ break; ++ case BUS_ISAPNP: ++ device->addCapability("isa", "ISA"); ++ device->addCapability("pnp", "PnP"); ++ break; ++ case BUS_USB: ++ device->addCapability("usb", "USB"); ++ break; ++ case BUS_HIL: ++ device->addCapability("hil", "HP-HIL"); ++ break; ++ case BUS_BLUETOOTH: ++ device->addCapability("bt", "Bluetooth"); ++ break; ++ case BUS_VIRTUAL: ++ device->addCapability("virtual"); ++ break; ++ case BUS_ISA: ++ device->addCapability("isa", "ISA bus"); ++ break; ++ case BUS_I8042: ++ device->addCapability("i8042", "i8042 PC AT keyboard controller"); ++ break; ++ case BUS_XTKBD: ++ device->addCapability("xtkbd", "XT keyboard controller"); ++ break; ++ case BUS_RS232: ++ device->addCapability("rs232", "RS-232 serial"); ++ break; ++ case BUS_GAMEPORT: ++ device->addCapability("gameport", "game port"); ++ break; ++ case BUS_PARPORT: ++ device->addCapability("parport", "parallel port"); ++ break; ++ case BUS_AMIGA: ++ device->addCapability("amiga", "Amiga bus"); ++ break; ++ case BUS_ADB: ++ device->addCapability("adb", "Apple Desktop Bus"); ++ break; ++ case BUS_I2C: ++ device->addCapability("i2c", "I²C bus"); ++ break; ++ case BUS_HOST: ++ device->addCapability("host"); ++ break; ++ case BUS_GSC: ++ device->addCapability("gsc", "GSC bus"); ++ break; ++ case BUS_ATARI: ++ device->addCapability("atari", "Atari bus"); ++ break; ++ case BUS_SPI: ++ device->addCapability("spi", "SPI"); ++ break; ++ case BUS_RMI: ++ device->addCapability("rmi", "RMI"); ++ break; ++ case BUS_CEC: ++ device->addCapability("cec", "CEC"); ++ break; ++ case BUS_INTEL_ISHTP: ++ device->addCapability("intelishtp", "Intel Integrated Sensor Hub"); ++ break; ++ } ++ ++ vector < sysfs::entry > events = e.devices(); ++ for(vector < sysfs::entry >::iterator i = events.begin(); i != events.end(); ++i) ++ { ++ const sysfs::entry & d = *i; ++ device->setLogicalName("input/"+d.name()); ++ } ++ } ++ ++ return true; ++} +diff --git a/src/core/input.h b/src/core/input.h +new file mode 100644 +index 000000000000..1bf2383bc53b +--- /dev/null ++++ b/src/core/input.h +@@ -0,0 +1,8 @@ ++#ifndef _INPUT_H_ ++#define _INPUT_H_ ++ ++#include "hw.h" ++ ++bool scan_input(hwNode &); ++ ++#endif +diff --git a/src/core/main.cc b/src/core/main.cc +index d0d7f1057c29..ad0e586ef549 100644 +--- a/src/core/main.cc ++++ b/src/core/main.cc +@@ -45,6 +45,7 @@ + #include "vio.h" + #include "nvme.h" + #include "mmc.h" ++#include "input.h" + #include "smp.h" + #include "abi.h" + #include "s390.h" +@@ -140,6 +141,9 @@ bool scan_system(hwNode & system) + status("MMC"); + if (enabled("mmc")) + scan_mmc(computer); ++ status("input"); ++ if (enabled("input")) ++ scan_input(computer); + status("S/390 devices"); + if (enabled("s390")) + scan_s390_devices(computer); +-- +2.17.1 + diff --git a/SOURCES/0006-cosmetic-fixes.patch b/SOURCES/0006-cosmetic-fixes.patch new file mode 100644 index 0000000..0443841 --- /dev/null +++ b/SOURCES/0006-cosmetic-fixes.patch @@ -0,0 +1,34 @@ +From 7edaa09faa5755e44f2c6226f3447536658300af Mon Sep 17 00:00:00 2001 +From: Lyonel Vincent +Date: Thu, 2 Apr 2020 13:21:58 +0200 +Subject: [PATCH 06/17] cosmetic fixes + +--- + src/core/input.cc | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/core/input.cc b/src/core/input.cc +index 1f14fa9d8b56..a8d8eaf45cb3 100644 +--- a/src/core/input.cc ++++ b/src/core/input.cc +@@ -79,7 +79,7 @@ bool scan_input(hwNode & n) + device->addCapability("hil", "HP-HIL"); + break; + case BUS_BLUETOOTH: +- device->addCapability("bt", "Bluetooth"); ++ device->addCapability("bluetooth", "Bluetooth"); + break; + case BUS_VIRTUAL: + device->addCapability("virtual"); +@@ -112,7 +112,7 @@ bool scan_input(hwNode & n) + device->addCapability("i2c", "I²C bus"); + break; + case BUS_HOST: +- device->addCapability("host"); ++ device->addCapability("platform"); + break; + case BUS_GSC: + device->addCapability("gsc", "GSC bus"); +-- +2.17.1 + diff --git a/SOURCES/0007-detect-sound-devices.patch b/SOURCES/0007-detect-sound-devices.patch new file mode 100644 index 0000000..912c1bb --- /dev/null +++ b/SOURCES/0007-detect-sound-devices.patch @@ -0,0 +1,141 @@ +From 1cc52cac74ea735faae92dc963d10292608d7a4d Mon Sep 17 00:00:00 2001 +From: Lyonel Vincent +Date: Thu, 2 Apr 2020 13:39:42 +0200 +Subject: [PATCH 07/17] detect sound devices + +--- + src/core/main.cc | 4 ++++ + src/core/sound.cc | 53 +++++++++++++++++++++++++++++++++++++++++++++++ + src/core/sound.h | 8 +++++++ + src/core/sysfs.cc | 5 +++++ + src/core/sysfs.h | 1 + + 5 files changed, 71 insertions(+) + create mode 100644 src/core/sound.cc + create mode 100644 src/core/sound.h + +diff --git a/src/core/main.cc b/src/core/main.cc +index ad0e586ef549..e35258c56141 100644 +--- a/src/core/main.cc ++++ b/src/core/main.cc +@@ -46,6 +46,7 @@ + #include "nvme.h" + #include "mmc.h" + #include "input.h" ++#include "sound.h" + #include "smp.h" + #include "abi.h" + #include "s390.h" +@@ -141,6 +142,9 @@ bool scan_system(hwNode & system) + status("MMC"); + if (enabled("mmc")) + scan_mmc(computer); ++ status("sound"); ++ if (enabled("sound")) ++ scan_sound(computer); + status("input"); + if (enabled("input")) + scan_input(computer); +diff --git a/src/core/sound.cc b/src/core/sound.cc +new file mode 100644 +index 000000000000..05edf2352267 +--- /dev/null ++++ b/src/core/sound.cc +@@ -0,0 +1,53 @@ ++#include "version.h" ++#include "hw.h" ++#include "sysfs.h" ++#include "osutils.h" ++#include "sound.h" ++#include "heuristics.h" ++ ++#include ++#include ++ ++__ID("@(#) $Id$"); ++ ++using namespace std; ++ ++bool scan_sound(hwNode & n) ++{ ++ vector < sysfs::entry > entries = sysfs::entries_by_class("sound"); ++ ++ if (entries.empty()) ++ return false; ++ ++ for (vector < sysfs::entry >::iterator it = entries.begin(); ++ it != entries.end(); ++it) ++ { ++ const sysfs::entry & e = *it; ++ string id = e.string_attr("id"); ++ if(id!="") ++ { ++ hwNode *device = n.findChildByBusInfo(e.leaf().businfo()); ++ if(!device) ++ device = n.addChild(hwNode("sound", hw::multimedia)); ++ device->claim(); ++ if(device->getDescription() == "") device->setDescription(id); ++ //device->setPhysId(e.hex_attr("number")); ++ //device->setBusInfo("sound@"+e.string_attr("number")); ++ device->setLogicalName("snd/"+e.name()); ++ if(device->getProduct() == "") device->setProduct(e.string_attr("name")); ++ device->setModalias(e.modalias()); ++ ++ vector < sysfs::entry > events = e.devices(); ++ for(vector < sysfs::entry >::iterator i = events.begin(); i != events.end(); ++i) ++ { ++ const sysfs::entry & d = *i; ++ if(d.subsystem() == "sound") ++ { ++ device->setLogicalName("snd/"+d.name()); ++ } ++ } ++ } ++ } ++ ++ return true; ++} +diff --git a/src/core/sound.h b/src/core/sound.h +new file mode 100644 +index 000000000000..c2caf04687bf +--- /dev/null ++++ b/src/core/sound.h +@@ -0,0 +1,8 @@ ++#ifndef _SOUND_H_ ++#define _SOUND_H_ ++ ++#include "hw.h" ++ ++bool scan_sound(hwNode &); ++ ++#endif +diff --git a/src/core/sysfs.cc b/src/core/sysfs.cc +index 32d65642f157..ee8b1da06c78 100644 +--- a/src/core/sysfs.cc ++++ b/src/core/sysfs.cc +@@ -343,6 +343,11 @@ string entry::classname() const + return basename(dirname(This->devpath).c_str()); + } + ++string entry::subsystem() const ++{ ++ return basename(realpath(This->devpath+"/subsystem").c_str()); ++} ++ + bool entry::isvirtual() const + { + return string(basename(dirname(dirname(This->devpath)).c_str())) == "virtual"; +diff --git a/src/core/sysfs.h b/src/core/sysfs.h +index 9cc1b2b0a500..c25430b834df 100644 +--- a/src/core/sysfs.h ++++ b/src/core/sysfs.h +@@ -26,6 +26,7 @@ namespace sysfs + bool hassubdir(const string &) const; + string name() const; + string classname() const; ++ string subsystem() const; + bool isvirtual() const; + string businfo() const; + string driver() const; +-- +2.17.1 + diff --git a/SOURCES/0008-detect-framebuffers.patch b/SOURCES/0008-detect-framebuffers.patch new file mode 100644 index 0000000..c1f128f --- /dev/null +++ b/SOURCES/0008-detect-framebuffers.patch @@ -0,0 +1,102 @@ +From 755371fc1590e752380822ffdb320484e3b6851f Mon Sep 17 00:00:00 2001 +From: Lyonel Vincent +Date: Thu, 2 Apr 2020 14:54:03 +0200 +Subject: [PATCH 08/17] detect framebuffers + +--- + src/core/graphics.cc | 44 ++++++++++++++++++++++++++++++++++++++++++++ + src/core/graphics.h | 8 ++++++++ + src/core/main.cc | 4 ++++ + 3 files changed, 56 insertions(+) + create mode 100644 src/core/graphics.cc + create mode 100644 src/core/graphics.h + +diff --git a/src/core/graphics.cc b/src/core/graphics.cc +new file mode 100644 +index 000000000000..a8d490cd1d61 +--- /dev/null ++++ b/src/core/graphics.cc +@@ -0,0 +1,44 @@ ++#include "version.h" ++#include "hw.h" ++#include "sysfs.h" ++#include "osutils.h" ++#include "graphics.h" ++#include "heuristics.h" ++ ++#include ++#include ++ ++__ID("@(#) $Id$"); ++ ++using namespace std; ++ ++bool scan_graphics(hwNode & n) ++{ ++ vector < sysfs::entry > entries = sysfs::entries_by_class("graphics"); ++ ++ if (entries.empty()) ++ return false; ++ ++ for (vector < sysfs::entry >::iterator it = entries.begin(); ++ it != entries.end(); ++it) ++ { ++ const sysfs::entry & e = *it; ++ string dev = e.string_attr("dev"); ++ if(dev!="") ++ { ++ hwNode *device = n.findChildByBusInfo(e.leaf().businfo()); ++ if(!device) ++ device = n.addChild(hwNode("graphics", hw::display)); ++ device->claim(); ++ device->setLogicalName(e.name()); ++ device->addCapability("fb", "framebuffer"); ++ if(device->getProduct() == "") device->setProduct(e.string_attr("name")); ++ string resolution = e.string_attr("virtual_size"); ++ string depth = e.string_attr("bits_per_pixel"); ++ if(resolution != "") device->setConfig("resolution", resolution); ++ if(depth != "") device->setConfig("depth", depth); ++ } ++ } ++ ++ return true; ++} +diff --git a/src/core/graphics.h b/src/core/graphics.h +new file mode 100644 +index 000000000000..c30f0bf8112b +--- /dev/null ++++ b/src/core/graphics.h +@@ -0,0 +1,8 @@ ++#ifndef _GRAPHICS_H_ ++#define _GRAPHICS_H_ ++ ++#include "hw.h" ++ ++bool scan_graphics(hwNode &); ++ ++#endif +diff --git a/src/core/main.cc b/src/core/main.cc +index e35258c56141..ac2fba0146f0 100644 +--- a/src/core/main.cc ++++ b/src/core/main.cc +@@ -47,6 +47,7 @@ + #include "mmc.h" + #include "input.h" + #include "sound.h" ++#include "graphics.h" + #include "smp.h" + #include "abi.h" + #include "s390.h" +@@ -145,6 +146,9 @@ bool scan_system(hwNode & system) + status("sound"); + if (enabled("sound")) + scan_sound(computer); ++ status("graphics"); ++ if (enabled("graphics")) ++ scan_graphics(computer); + status("input"); + if (enabled("input")) + scan_input(computer); +-- +2.17.1 + diff --git a/SOURCES/0009-try-to-connect-input-devices-to-the-right-parent.patch b/SOURCES/0009-try-to-connect-input-devices-to-the-right-parent.patch new file mode 100644 index 0000000..2687aa1 --- /dev/null +++ b/SOURCES/0009-try-to-connect-input-devices-to-the-right-parent.patch @@ -0,0 +1,29 @@ +From f6138333811f7f2bf01551c70f5726f7c556dd36 Mon Sep 17 00:00:00 2001 +From: Lyonel Vincent +Date: Fri, 3 Apr 2020 22:42:21 +0200 +Subject: [PATCH 09/17] try to connect input devices to the right parent + +--- + src/core/input.cc | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/src/core/input.cc b/src/core/input.cc +index a8d8eaf45cb3..ab37d37c3863 100644 +--- a/src/core/input.cc ++++ b/src/core/input.cc +@@ -52,6 +52,12 @@ bool scan_input(hwNode & n) + if(!e.hassubdir("id")) continue; + + hwNode *device = n.findChildByBusInfo(e.leaf().businfo()); ++ if(!device) ++ { ++ device = n.findChildByBusInfo(e.leaf().parent().businfo()); ++ if(device) ++ device = device->addChild(hwNode("input", hw::input)); ++ } + if(!device) + device = n.addChild(hwNode("input", hw::input)); + else +-- +2.17.1 + diff --git a/SOURCES/0010-devtree-Add-chip-id-from-the-dimm-module.patch b/SOURCES/0010-devtree-Add-chip-id-from-the-dimm-module.patch new file mode 100644 index 0000000..873cab7 --- /dev/null +++ b/SOURCES/0010-devtree-Add-chip-id-from-the-dimm-module.patch @@ -0,0 +1,39 @@ +From 4c19563dae05d3a730bb67917f1810eb33a54613 Mon Sep 17 00:00:00 2001 +From: Shivaprasad G Bhat +Date: Fri, 6 Mar 2020 04:41:33 -0600 +Subject: [PATCH 10/17] devtree: Add chip-id from the dimm module + +Add chip-id from dimm module into the configuration if available. DIMM's are +behind the CHIP on Power systems. By adding chip-id it helps to map what dimm +is sitting behind which chip. + +Sample output: + *-bank:0 + description: 16GB CDIMM + product: 41T9571 FRU# 41T9571 + physical id: 0 + ..... + configuration: chip-id=0 + + +Signed-off-by: Shivaprasad G Bhat +--- + src/core/device-tree.cc | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/src/core/device-tree.cc b/src/core/device-tree.cc +index 490e1976e619..f43d34f072b6 100644 +--- a/src/core/device-tree.cc ++++ b/src/core/device-tree.cc +@@ -1031,6 +1031,8 @@ static void add_memory_bank(string name, string path, hwNode & core) + if(exists("description")) + description = hw::strip(get_string("description")); + bank.setDescription(description); ++ if (exists("ibm,chip-id")) ++ bank.setConfig("chip-id", get_u32("ibm,chip-id")); + + if(exists("ibm,loc-code")) + bank.setSlot(hw::strip(get_string("ibm,loc-code"))); +-- +2.17.1 + diff --git a/SOURCES/0011-devtree-Add-chip-id-from-CPU-node.patch b/SOURCES/0011-devtree-Add-chip-id-from-CPU-node.patch new file mode 100644 index 0000000..d6fcac2 --- /dev/null +++ b/SOURCES/0011-devtree-Add-chip-id-from-CPU-node.patch @@ -0,0 +1,40 @@ +From 872b0996df37aae586575ca8021c2509c05067b0 Mon Sep 17 00:00:00 2001 +From: Shivaprasad G Bhat +Date: Fri, 6 Mar 2020 04:41:33 -0600 +Subject: [PATCH 11/17] devtree: Add chip-id from CPU node + +Add chip-id from CPU node into the configuration if available. CPU's are +behind the CHIP on Power systems. By adding chip-id it helps to map what cpus +are sitting behind which chip. + +Sample output: + *-cpu:10 + description: POWER8E (raw), altivec supported + product: 00FX746 FRU# 00FX522 + physical id: 176 + bus info: cpu@10 + version: 2.1 (pvr 004b 0201) + ... + configuration: chip-id=1 threads=8 + +Signed-off-by: Shivaprasad G Bhat +--- + src/core/device-tree.cc | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/src/core/device-tree.cc b/src/core/device-tree.cc +index f43d34f072b6..af665a4d8e1a 100644 +--- a/src/core/device-tree.cc ++++ b/src/core/device-tree.cc +@@ -492,6 +492,8 @@ static void fill_core_vpd(hwNode & cpu, string & basepath, + return; + + chip_id = get_u32(basepath + "/ibm,chip-id"); ++ cpu.setConfig("chip-id", chip_id); ++ + data = chip_vpd[chip_id]; + xscom_path = xscoms[chip_id]; + +-- +2.17.1 + diff --git a/SOURCES/0012-volumes-fix-segfault-in-apfs-volume-code.patch b/SOURCES/0012-volumes-fix-segfault-in-apfs-volume-code.patch new file mode 100644 index 0000000..dd555a8 --- /dev/null +++ b/SOURCES/0012-volumes-fix-segfault-in-apfs-volume-code.patch @@ -0,0 +1,31 @@ +From 82df4fa7d3705f2f61282ed5b22074d4e0a6efc4 Mon Sep 17 00:00:00 2001 +From: Harry Mallon +Date: Thu, 23 Apr 2020 21:18:47 +0100 +Subject: [PATCH 12/17] volumes: fix segfault in apfs volume code + +--- + src/core/volumes.cc | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/core/volumes.cc b/src/core/volumes.cc +index e70352377f84..6fce2ee3de1c 100644 +--- a/src/core/volumes.cc ++++ b/src/core/volumes.cc +@@ -784,12 +784,13 @@ struct apfs_super_block { + + static bool detect_apfs(hwNode & n, source & s) + { +- static char buffer[sizeof(apfs_super_block)]; ++ static char buffer[APFS_STANDARD_BLOCK_SIZE]; + source apfsvolume; + apfs_super_block *sb = (apfs_super_block*)buffer; + unsigned long block_size; + + apfsvolume = s; ++ apfsvolume.blocksize = APFS_STANDARD_BLOCK_SIZE; + + if(readlogicalblocks(apfsvolume, buffer, 0, 1)!=1) + return false; +-- +2.17.1 + diff --git a/SOURCES/0013-merge-Github-PR-53.patch b/SOURCES/0013-merge-Github-PR-53.patch new file mode 100644 index 0000000..74efa65 --- /dev/null +++ b/SOURCES/0013-merge-Github-PR-53.patch @@ -0,0 +1,58 @@ +From 89759485f86a48526b4f508a10f7478c76a3f71e Mon Sep 17 00:00:00 2001 +From: Lyonel Vincent +Date: Fri, 15 May 2020 16:00:08 +0200 +Subject: [PATCH 13/17] merge Github PR #53 + +--- + src/core/cpuinfo.cc | 21 ++++++++++----------- + 1 file changed, 10 insertions(+), 11 deletions(-) + +diff --git a/src/core/cpuinfo.cc b/src/core/cpuinfo.cc +index eceb83aa4e3a..49f3052d8da1 100644 +--- a/src/core/cpuinfo.cc ++++ b/src/core/cpuinfo.cc +@@ -446,6 +446,7 @@ string value) + + if (cpu) + { ++ hw::value family, model, stepping; + + // x86 CPUs are assumed to be 32 bits per default + if(cpu->getWidth()==0) cpu->setWidth(32); +@@ -471,6 +472,13 @@ string value) + cpu->addHint(id, stoll(value, NULL, 0)); + if (id == "stepping") + cpu->addHint(id, stoll(value, NULL, 0)); ++ ++ family = cpu->getHint("cpu family"); ++ model = cpu->getHint("model"); ++ stepping = cpu->getHint("stepping"); ++ if(family.defined() && model.defined() && stepping.defined()) ++ cpu->setVersion(tostring(family.asInteger())+"."+tostring(model.asInteger())+"."+tostring(stepping.asInteger())); ++ + //if ((id == "cpu MHz") && (cpu->getSize() == 0)) + //{ + //cpu->setSize((long long) (1000000L * atof(value.c_str()))); +@@ -675,17 +683,8 @@ bool scan_cpuinfo(hwNode & n) + } + + hwNode *cpu = getcpu(n, 0); +- if(cpu) +- { +- hw::value family, model, stepping; +- family = cpu->getHint("cpu family"); +- model = cpu->getHint("model"); +- stepping = cpu->getHint("stepping"); +- if(family.defined() && model.defined() && stepping.defined()) +- cpu->setVersion(tostring(family.asInteger())+"."+tostring(model.asInteger())+"."+tostring(stepping.asInteger())); +- if(n.getWidth()==0) +- n.setWidth(cpu->getWidth()); +- } ++ if(cpu && (n.getWidth()==0)) ++ n.setWidth(cpu->getWidth()); + + return true; + } +-- +2.17.1 + diff --git a/SOURCES/0014-devtree-Add-capabilites-to-the-OPAL-Firmware.patch b/SOURCES/0014-devtree-Add-capabilites-to-the-OPAL-Firmware.patch new file mode 100644 index 0000000..166631a --- /dev/null +++ b/SOURCES/0014-devtree-Add-capabilites-to-the-OPAL-Firmware.patch @@ -0,0 +1,96 @@ +From 29f69ac618fd5ace9ed9aae7839b5cfdc1fb5130 Mon Sep 17 00:00:00 2001 +From: Shivaprasad G Bhat +Date: Wed, 1 Apr 2020 09:25:52 -0500 +Subject: [PATCH 14/17] devtree: Add capabilites to the OPAL Firmware + +On OpenPower systems, the presence of the "/ibm,opal" entry in the device tree +signifies machines are running under OPAL firmware (i.e skiboot). Under this +node OPAL exports certain available interfaces. And also this node have a +compatible property listing "ibm,opal-v which denotes the OPAL compatability. + +This change adds a function to parse information about those OPAL firmware +capabilities and add it to skiboot firmware node. With a current OpenPower +machine, we get something like this: + + *-firmware:0 + description: skiboot + product: OPAL firmware + physical id: 2 + version: 5.4.3-35bf9d9 + capabilities: opal-v2 opal-v3 prd ipmi + + +Signed-off-by: Pridhiviraj Paidipeddi +Signed-off-by: Shivaprasad G Bhat +--- + src/core/device-tree.cc | 42 +++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 42 insertions(+) + +diff --git a/src/core/device-tree.cc b/src/core/device-tree.cc +index af665a4d8e1a..e7227e1f74b7 100644 +--- a/src/core/device-tree.cc ++++ b/src/core/device-tree.cc +@@ -219,11 +219,48 @@ static void scan_devtree_bootrom(hwNode & core) + } + } + ++static hwNode *add_base_opal_node(hwNode & core) ++{ ++ vector < string >:: iterator it; ++ vector < string > compat; ++ string basepath = DEVICETREE "/ibm,opal"; ++ hwNode opal("firmware"); ++ ++ if (!exists(basepath)) ++ return NULL; ++ ++ pushd(basepath); ++ ++ opal.setProduct("OPAL firmware"); ++ opal.setDescription("skiboot"); ++ ++ compat = get_strings(basepath + "/compatible"); ++ for (it = compat.begin(); it != compat.end(); ++it) { ++ if (matches(*it, "^ibm,opal-v")) ++ opal.addCapability((*it).erase(0,4)); ++ } ++ ++ if (exists(basepath + "/ipmi/compatible") && ++ matches(get_string(basepath + "/ipmi/compatible"), "^ibm,opal-ipmi")) ++ opal.addCapability("ipmi"); ++ ++ if (exists(basepath + "/diagnostics/compatible") && ++ matches(get_string(basepath + "/diagnostics/compatible"), "^ibm,opal-prd")) ++ opal.addCapability("prd"); ++ ++ popd(); ++ ++ opal.claim(); ++ return core.addChild(opal); ++} ++ + static void scan_devtree_firmware_powernv(hwNode & core) + { + int n; + struct dirent **namelist; + ++ hwNode *opal = add_base_opal_node(core); ++ + if (!exists(DEVICETREE "/ibm,firmware-versions")) + return; + +@@ -245,6 +282,11 @@ static void scan_devtree_firmware_powernv(hwNode & core) + fwnode.setDescription(sname); + fwnode.setVersion(hw::strip(get_string(fullpath))); + fwnode.claim(); ++ if (opal && sname == "skiboot") { ++ opal->merge(fwnode); ++ free(namelist[i]); ++ continue; ++ } + core.addChild(fwnode); + } + free(namelist[i]); +-- +2.17.1 + diff --git a/SOURCES/0015-fix-issue-with-logical-names-being-truncated-dev-sda.patch b/SOURCES/0015-fix-issue-with-logical-names-being-truncated-dev-sda.patch new file mode 100644 index 0000000..004363c --- /dev/null +++ b/SOURCES/0015-fix-issue-with-logical-names-being-truncated-dev-sda.patch @@ -0,0 +1,29 @@ +From 4348e283f8a0bdd40b97c5d0b6e12354576b3113 Mon Sep 17 00:00:00 2001 +From: Lyonel Vincent +Date: Mon, 25 May 2020 09:31:05 +0200 +Subject: [PATCH 15/17] =?UTF-8?q?fix=20issue=20with=20logical=20names=20be?= + =?UTF-8?q?ing=20truncated=20(`/dev/sda`=20=E2=86=92=20`sda`)?= +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +--- + src/core/hw.cc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/core/hw.cc b/src/core/hw.cc +index f7da370816c5..aca424c3f221 100644 +--- a/src/core/hw.cc ++++ b/src/core/hw.cc +@@ -1083,7 +1083,7 @@ void hwNode::setLogicalName(const string & name) + This->logicalnames.push_back("/dev/" + n); + } + else +- This->logicalnames.push_back(basename(n.c_str())); ++ This->logicalnames.push_back((n[0]=='/')?n:basename(n.c_str())); + + if(This->dev == "") + This->dev = get_devid(n); +-- +2.17.1 + diff --git a/SOURCES/0016-code-clean-up-for-read-3.patch b/SOURCES/0016-code-clean-up-for-read-3.patch new file mode 100644 index 0000000..b460787 --- /dev/null +++ b/SOURCES/0016-code-clean-up-for-read-3.patch @@ -0,0 +1,51 @@ +From 37c3f3934b9d03be2d0ec70caf3779e03c003c5a Mon Sep 17 00:00:00 2001 +From: Lyonel Vincent +Date: Mon, 25 May 2020 15:24:38 +0200 +Subject: [PATCH 16/17] code clean-up for read(3) + +use ssize_t instead of size_t +cf. Github PR #52 + +--- + src/core/cpuinfo.cc | 2 +- + src/core/osutils.cc | 4 ++-- + 2 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/src/core/cpuinfo.cc b/src/core/cpuinfo.cc +index 49f3052d8da1..9e41a42184a6 100644 +--- a/src/core/cpuinfo.cc ++++ b/src/core/cpuinfo.cc +@@ -597,7 +597,7 @@ bool scan_cpuinfo(hwNode & n) + if (core) + { + char buffer[1024]; +- size_t count; ++ ssize_t count; + string cpuinfo_str = ""; + string description = "", version = ""; + string plat = platform(); +diff --git a/src/core/osutils.cc b/src/core/osutils.cc +index f023a465921b..a53ed89e9d7b 100644 +--- a/src/core/osutils.cc ++++ b/src/core/osutils.cc +@@ -148,7 +148,7 @@ vector < string > &list) + { + char buffer[1024]; + string buffer_str = ""; +- size_t count = 0; ++ ssize_t count = 0; + data_file fd = file_open(file); + + if (file_open_error(fd)) +@@ -174,7 +174,7 @@ const string & def) + if (fd >= 0) + { + char buffer[1024]; +- size_t count = 0; ++ ssize_t count = 0; + + memset(buffer, 0, sizeof(buffer)); + result = ""; +-- +2.17.1 + diff --git a/SOURCES/0017-report-product-model-on-Power-systems.patch b/SOURCES/0017-report-product-model-on-Power-systems.patch new file mode 100644 index 0000000..a53ce87 --- /dev/null +++ b/SOURCES/0017-report-product-model-on-Power-systems.patch @@ -0,0 +1,27 @@ +From 3775782808e8b9b8aa72ed2ce23e145433e193cf Mon Sep 17 00:00:00 2001 +From: Lyonel Vincent +Date: Wed, 27 May 2020 01:16:20 +0200 +Subject: [PATCH 17/17] report product model on Power systems + +Github PR #54 + +--- + src/core/device-tree.cc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/core/device-tree.cc b/src/core/device-tree.cc +index e7227e1f74b7..027ad16fc557 100644 +--- a/src/core/device-tree.cc ++++ b/src/core/device-tree.cc +@@ -1396,7 +1396,7 @@ static void get_ibm_model(hwNode & n) + { + if (ibm_model_defs[i].model == machinetype || ibm_model_defs[i].model == model) + { +- n.setProduct(ibm_model_defs[i].modelname); ++ n.setProduct(n.getProduct() + " (" + ibm_model_defs[i].modelname + ")"); + n.addHint("icon", string(ibm_model_defs[i].icon)); + n.setConfig("chassis", ibm_model_defs[i].chassis); + return; +-- +2.17.1 + diff --git a/SOURCES/lshw-B.02.18-revert-json.patch b/SOURCES/lshw-B.02.18-revert-json.patch new file mode 100644 index 0000000..9a2a076 --- /dev/null +++ b/SOURCES/lshw-B.02.18-revert-json.patch @@ -0,0 +1,66 @@ +commit 135a853c60582b14c5b67e5cd988a8062d9896f4 +Author: Lyonel Vincent +Date: Fri Apr 28 16:54:42 2017 +0200 + + Fix JSON output format + + cf. https://github.com/lyonel/lshw/pull/28 + +diff --git a/src/core/hw.cc b/src/core/hw.cc +index 68e5912..9defd26 100644 +--- a/src/core/hw.cc ++++ b/src/core/hw.cc +@@ -1368,9 +1368,14 @@ string hwNode::asJSON(unsigned level) + config = getConfigKeys(); + resources = getResources("\" value=\""); + ++ if (level == 0) ++ { ++ out << "[" << endl; ++ } ++ + if(visible(getClassName())) + { +- out << "{" << endl; ++ out << spaces(2*level) << "{" << endl; + out << spaces(2*level+2) << "\"id\" : \"" << getId() << "\"," << endl; + out << spaces(2*level+2) << "\"class\" : \"" << getClassName() << "\""; + +@@ -1613,20 +1618,13 @@ string hwNode::asJSON(unsigned level) + resources.clear(); + } + +- +- if(countChildren()>0) ++ for (unsigned int i = 0; i < countChildren(); i++) + { +- if(visible(getClassName())) +- out << "," << endl << spaces(2*level+2) << "\"children\" : [" << endl; +- +- for (unsigned int i = 0; i < countChildren(); i++) ++ out << getChild(i)->asJSON(visible(getClassName()) ? level + 2 : 1); ++ if (visible(getChild(i)->getClassName())) + { +- out << spaces(2*level+4) << getChild(i)->asJSON(visible(getClassName()) ? level + 2 : 1); +- if(visible(getChild(i)->getClassName()) && (i < countChildren()-1)) out << "," << endl; ++ out << "," << endl; + } +- +- if(visible(getClassName())) +- out << endl << spaces(2*level+2) << "]"; + } + + if(visible(getClassName())) +@@ -1635,6 +1633,12 @@ string hwNode::asJSON(unsigned level) + out << "}"; + } + ++ if (level == 0) ++ { ++ out.seekp(-2, std::ios_base::end); ++ out << endl << "]" << endl; ++ } ++ + return out.str(); + } + diff --git a/SOURCES/lshw-B.02.18-scandir.patch b/SOURCES/lshw-B.02.18-scandir.patch new file mode 100644 index 0000000..27c64b7 --- /dev/null +++ b/SOURCES/lshw-B.02.18-scandir.patch @@ -0,0 +1,26 @@ +diff --git a/src/core/abi.cc b/src/core/abi.cc +index 76c664c..b5bd9c9 100644 +--- a/src/core/abi.cc ++++ b/src/core/abi.cc +@@ -36,13 +36,15 @@ bool scan_abi(hwNode & system) + struct dirent **namelist; + + n = scandir(".", &namelist, selectfile, alphasort); +- for(i=0; id_name); +- free(namelist[i]); ++ if (n > 0) { ++ for(i=0; id_name); ++ free(namelist[i]); ++ } ++ if(namelist) ++ free(namelist); + } +- if(namelist) +- free(namelist); + } + + popd(); diff --git a/SOURCES/lshw-B.02.19.2-Add-the-FindPkgConfig-to-CMakeLists.patch b/SOURCES/lshw-B.02.19.2-Add-the-FindPkgConfig-to-CMakeLists.patch new file mode 100644 index 0000000..a529365 --- /dev/null +++ b/SOURCES/lshw-B.02.19.2-Add-the-FindPkgConfig-to-CMakeLists.patch @@ -0,0 +1,28 @@ +From 5c3b96616ecec2345c6b785352192c033738f2e1 Mon Sep 17 00:00:00 2001 +From: Lianbo Jiang +Date: Thu, 25 Apr 2019 12:37:38 +0800 +Subject: [PATCH] Add the "FindPkgConfig" to CMakeLists.txt. + +Include the "FindPkgConfig" in order to fix "Unknown CMake command +pkg_check_modules" + +Signed-off-by: Lianbo Jiang +--- + CMakeLists.txt | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 6c69c37336c8..688863130291 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,5 +1,7 @@ + cmake_minimum_required(VERSION 3.0) + ++include(FindPkgConfig) ++ + project(lshw) + set(VERSION "B.02.19.2") + +-- +2.17.1 + diff --git a/SOURCES/lshw-B.02.19.2-cmake.patch b/SOURCES/lshw-B.02.19.2-cmake.patch new file mode 100644 index 0000000..86d9ffd --- /dev/null +++ b/SOURCES/lshw-B.02.19.2-cmake.patch @@ -0,0 +1,992 @@ +From 5da5b63bd38634834bb3e631a24e31a10ab60f27 Mon Sep 17 00:00:00 2001 +From: Terje Rosten +Date: Wed, 25 Mar 2020 21:57:53 +0100 +Subject: [PATCH] cmakeify + +--- + CMakeLists.txt | 43 ++++++ + Makefile | 20 --- + README.md | 51 ++++--- + lshw.spec.in | 66 +++----- + src/CMakeLists.txt | 102 +++++++++++++ + src/Makefile | 144 ------------------ + src/core/Makefile | 80 ---------- + src/core/{config.h => config.h.in} | 28 +--- + src/core/db.cc | 8 + + src/core/dump.cc | 2 +- + src/core/version.h | 2 + + src/gui/CMakeLists.txt | 67 ++++++++ + src/gui/Makefile | 61 -------- + .../{gtk-lshw.desktop => gtk-lshw.desktop.in} | 7 +- + src/gui/integration/lshw-gui.in | 5 + + .../integration/org.ezix.lshw.gui.policy.in | 20 +++ + src/gui/stock.c | 1 + + src/po/CMakeLists.txt | 16 ++ + src/po/Makefile | 23 --- + 19 files changed, 327 insertions(+), 419 deletions(-) + create mode 100644 CMakeLists.txt + delete mode 100644 Makefile + create mode 100644 src/CMakeLists.txt + delete mode 100644 src/Makefile + delete mode 100644 src/core/Makefile + rename src/core/{config.h => config.h.in} (50%) + create mode 100644 src/gui/CMakeLists.txt + delete mode 100644 src/gui/Makefile + rename src/gui/integration/{gtk-lshw.desktop => gtk-lshw.desktop.in} (51%) + create mode 100644 src/gui/integration/lshw-gui.in + create mode 100644 src/gui/integration/org.ezix.lshw.gui.policy.in + create mode 100644 src/po/CMakeLists.txt + delete mode 100644 src/po/Makefile + +diff --git a/CMakeLists.txt b/CMakeLists.txt +new file mode 100644 +index 0000000..3b1d4d6 +--- /dev/null ++++ b/CMakeLists.txt +@@ -0,0 +1,43 @@ ++cmake_minimum_required(VERSION 3.0) ++ ++project(lshw) ++set(VERSION "B.02.19.2") ++ ++find_package(Git) ++ ++if(EXISTS "${PROJECT_SOURCE_DIR}/.git" AND "${MAKE_RELEASE}" STREQUAL "") ++ if(GIT_FOUND) ++ execute_process( ++ COMMAND ${GIT_EXECUTABLE} describe --tags ++ OUTPUT_VARIABLE DESCRIBE_TAG ++ OUTPUT_STRIP_TRAILING_WHITESPACE) ++ string(REGEX MATCH "B.[0-9]+.[0-9]+[-][0-9]+" VERSION ${DESCRIBE_TAG}) ++ string(REPLACE "-" "." VERSION ${VERSION}) ++ endif() ++endif() ++ ++message("-- lshw: ${VERSION}") ++ ++option(GUI "Enable GUI application (${PROJECT_NAME}-gtk)" ON) ++option(HWDATA "Install hwdata files" ON) ++option(SQLITE "Enable SQLite support" OFF) ++option(ZLIB "Enable zlib support" OFF) ++option(NOLOGO "Don't install vendor logos" OFF) ++option(STATIC "Do a static (will disable other features)" OFF) ++option(POLICYKIT "Install PolicyKit file and pfexec wrapper" OFF) ++ ++include(GNUInstallDirs) ++set(CMAKE_INSTALL_PREFIX "/usr/local" CACHE STRING "Install prefix") ++set(DATADIR "${CMAKE_INSTALL_FULL_DATADIR}") ++set(PROJECT_DATADIR "${CMAKE_INSTALL_FULL_DATADIR}/${PROJECT_NAME}") ++set(SBINDIR "${CMAKE_INSTALL_FULL_SBINDIR}") ++set(MANDIR "${CMAKE_INSTALL_FULL_MANDIR}") ++set(LOCALEDIR "${CMAKE_INSTALL_FULL_LOCALEDIR}") ++ ++configure_file( ++ "${PROJECT_SOURCE_DIR}/lshw.spec.in" ++ "${PROJECT_BINARY_DIR}/lshw.spec") ++ ++add_subdirectory(src) ++add_subdirectory(src/po) ++add_subdirectory(src/gui) +diff --git a/Makefile b/Makefile +deleted file mode 100644 +index 8fe665e..0000000 +--- a/Makefile ++++ /dev/null +@@ -1,20 +0,0 @@ +-PACKAGENAME = lshw +-VERSION?= $(shell git describe --tags | cut -d - -f 1,2 | tr - .) +-export PACKAGENAME +- +-all clean install snapshot gui install-gui: +- +$(MAKE) -C src $@ +- +-version.cpe: .version +- echo -n cpe:/a:ezix:$(PACKAGENAME): > $@ +- cat $^ >> $@ +- +-.PHONY: $(PACKAGENAME).spec +- +-$(PACKAGENAME).spec: $(PACKAGENAME).spec.in +- cat $^ | sed -e s/\@VERSION\@/$(VERSION)/g > $@ +- +-release: $(PACKAGENAME).spec +- git archive --prefix=$(PACKAGENAME)-$(VERSION)/ -o $(PACKAGENAME)-$(VERSION).tar HEAD +- tar --transform s!^!$(PACKAGENAME)-$(VERSION)/! -rf $(PACKAGENAME)-$(VERSION).tar $^ +- gzip -f $(PACKAGENAME)-$(VERSION).tar +diff --git a/README.md b/README.md +index 30feaf1..294888c 100644 +--- a/README.md ++++ b/README.md +@@ -15,27 +15,29 @@ Installation + 1. Requirements + - Linux 2.4.x, 2.6.x, 3.x or 4.x (2.2.x might work, though) + - a PA-RISC-, Alpha-, IA-64- (Itanium-), PowerPC-, ARM- or x86- based machine ++ - cmake, GNU make or Ninja + - an ANSI (or close enough to ANSI compliance) C++ compiler (tested with g++ 2.95.4 and 3.x) + - for the (optional) GTK+ graphical user interface, you will need a + complete GTK+ development environment (gtk2-devel on RedHat/Fedora derivatives) ++ - for optional SQLite feature install SQLite ++ - for optional zlib feature install zlib and gzip + +- 2. To compile it, just use: ++ 2. Use cmake options to decide feature set: ++ - -DGUI=OFF - disable graphical user interface version og lshw ++ - -DZLIB=ON - enable reading of gzipped datafiles ++ - -DSQLITE=ON - enable SQLite support ++ - -DPOLICYKIT=ON - enable PolicyKit integration ++ - -DNOLOGO=ON - don't install logos with copyright + +- $ make ++ 3. Do configuration and build by + +- To compile with zlib support (see below), use: +- +- $ make ZLIB=1 +- +- 3. If you want to build the optional GUI, do: +- +- $ make +- $ make gui ++ $ mkdir build && cd build ++ $ cmake .. -GNinja ++ $ ninja-build + + 4. If you want to install the result, do: + +- $ make install +- $ make install-gui ++ $ ninja-build install + + Getting help + ------------ +@@ -61,12 +63,27 @@ If compiled with zlib support, lshw will look for `file`.gz first, then for `fil + + Statically-linked and/or compressed binaries can be built by using + +- $ make static +- ++ $ mkdir build && cd build ++ $ cmake .. -DSTATIC=ON ++ $ ninja + or ++ $ mkdir build && cd build ++ $ cmake .. -GNinja ++ $ ninja compressed + +- $ make compressed ++Building compressed binaries requires `upx` (cf. https://upx.github.io/). + +-in the `src/` directory ++Release management and data files maintenance ++--------------------------------------------- + +-Building compressed binaries requires `upx` (cf. https://upx.github.io/). ++Create release tarball, ++ ++ 1. Edit CMakeLists.txt to set version ++ 2. Run ++ $ mkdir build && cd build ++ $ cmake .. -DMAKE_RELEASE=ON ++ $ make release ++ ++Update hwdata files: ++ ++ $ make refresh_hwdata +diff --git a/lshw.spec.in b/lshw.spec.in +index e837fd4..3fe23c2 100644 +--- a/lshw.spec.in ++++ b/lshw.spec.in +@@ -7,11 +7,11 @@ Version: @VERSION@ + Release: 2 + Source: http://www.ezix.org/software/files/%{name}-%{version}.tar.gz + URL: http://lshw.ezix.org/ +-License: GPL ++License: GPLv2 + Group: Applications/System +-BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +- +-%global debug_package %{nil} ++BuildRequires: gcc ++BuildRequires: gcc-c++ ++BuildRequires: cmake + + %description + lshw (Hardware Lister) is a small tool to provide detailed information on +@@ -39,7 +39,7 @@ lshw (Hardware Lister) is a small tool to provide detailed informaton on + the hardware configuration of the machine. It can report exact memory + configuration, firmware version, mainboard configuration, CPU version + and speed, cache configuration, bus speed, etc. on DMI-capable x86s +- systems and on some PowerPC machines (PowerMac G4 is known to work). ++systems and on some PowerPC machines (PowerMac G4 is known to work). + + This package provides a graphical user interface to display hardware + information. +@@ -54,61 +54,29 @@ http://lshw.ezix.org/ + %setup -q + + %build +-%{__make} %{?_smp_mflags} \ +- PREFIX="%{_prefix}" \ +- SBINDIR="%{_sbindir}" \ +- MANDIR="%{_mandir}" \ +- DATADIR="%{_datadir}" \ +- VERSION="%{version}" \ +- all +-%if %{!?_without_gui:1}0 +-%{__make} %{?_smp_mflags} \ +- PREFIX="%{_prefix}" \ +- SBINDIR="%{_sbindir}" \ +- MANDIR="%{_mandir}" \ +- DATADIR="%{_datadir}" \ +- VERSION="%{version}" \ +- gui +-%endif ++mkdir build && cd build ++%cmake .. %{?_without_gui:-DGUI=OFF} ++make %{?_smp_mflags} VERBOSE=1 + + %install +-%{__rm} -rf "%{buildroot}" +- +-%{__make} \ +- DESTDIR="%{buildroot}" \ +- PREFIX="%{_prefix}" \ +- SBINDIR="%{_sbindir}" \ +- MANDIR="%{_mandir}" \ +- DATADIR="%{_datadir}" \ +- INSTALL="%{__install} -p" \ +- install +-%if %{!?_without_gui:1}0 +-%{__make} \ +- DESTDIR="%{buildroot}" \ +- PREFIX="%{_prefix}" \ +- SBINDIR="%{_sbindir}" \ +- MANDIR="%{_mandir}" \ +- DATADIR="%{_datadir}" \ +- INSTALL="%{__install} -p" \ +- install-gui +-%endif +- +-%clean +-%{__rm} -rf %{buildroot} ++cd build ++make install DESTDIR=%{buildroot} + + %files +-%defattr(-,root,root, 0555) +-%doc README.md COPYING docs/TODO docs/Changelog docs/lshw.xsd ++%license COPYING ++%doc docs/TODO docs/Changelog docs/lshw.xsd + %{_sbindir}/lshw +-%doc %{_mandir}/man?/* ++%{_mandir}/man?/* + %{_datadir}/lshw/ + %{_datadir}/locale/*/*/* + + %if %{!?_without_gui:1}0 + %files gui +-%defattr(-,root,root, 0555) +-%doc COPYING ++%license COPYING + %{_sbindir}/gtk-lshw ++%{_datadir}/appdata/gtk-lshw.appdata.xml ++%{_datadir}/applications/gtk-lshw.desktop ++%{_datadir}/pixmaps/gtk-lshw.svg + %endif + + %changelog +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +new file mode 100644 +index 0000000..8b97a16 +--- /dev/null ++++ b/src/CMakeLists.txt +@@ -0,0 +1,102 @@ ++if(STATIC) ++ set(ZLIB OFF) ++ set(SQLITE OFF) ++endif() ++ ++# SQLite support ++if(SQLITE) ++ pkg_check_modules(SQLITE3 sqlite3) ++ if(SQLITE3_FOUND) ++ message("-- Enabling SQLite support") ++ else() ++ message(FATAL_ERROR "SQLite not found, install lib or disable feature: -DSQLITE=OFF") ++ endif() ++else() ++ message("-- SQLite support disabled") ++endif() ++ ++# zlib support ++if(ZLIB) ++ find_program(GZIP gzip "Path to gzip application") ++ if(NOT GZIP) ++ message(FATAL_ERROR "gzip program not found, install gzip or disable zlib support: -DZLIB=OFF") ++ endif() ++ pkg_check_modules(Z zlib) ++ if(Z_FOUND) ++ message("-- Enabling zlib support") ++ else() ++ message(FATAL_ERROR "zlib not found, install lib or disable feature: -DZLIB=OFF") ++ endif() ++else() ++ message("-- zlib support disabled") ++endif() ++ ++if(ERROR) ++ message(FATAL_ERROR "Configuration failed") ++endif() ++ ++# Some special targets, compress, refresh_hwdata and release ++add_custom_target(compressed ++ COMMAND upx -9 -o lshw-compress lshw ++ COMMENT "Creating upx compressed binary") ++add_dependencies(compressed lshw) ++ ++add_custom_target(refresh_hwdata ++ COMMAND wget -N http://pciids.sourceforge.net/pci.ids ++ COMMAND wget -N http://www.linux-usb.org/usb.ids ++ COMMAND wget -N http://standards-oui.ieee.org/oui/oui.txt ++ COMMAND wget -O manuf.txt http://anonsvn.wireshark.org/wireshark/trunk/manuf ++ COMMAND wget -N https://git.fedorahosted.org/cgit/hwdata.git/plain/pnp.ids ++ COMMAND wget -N http://www-pc.uni-regensburg.de/hardware/TECHNIK/PCI_PNP/pnpid.txt ++ WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}/src" ++ COMMENT "Updating hwdata files from upstream location") ++ ++set(TARNAME ${PROJECT_NAME}-${VERSION}) ++add_custom_target(release ++ COMMAND ${GIT_EXECUTABLE} archive --prefix=${TARNAME}/ ++ -o ${PROJECT_BINARY_DIR}/${TARNAME}.tar HEAD ++ COMMAND mv ${PROJECT_BINARY_DIR}/lshw.spec ${PROJECT_SOURCE_DIR}/lshw.spec ++ COMMAND tar --owner=0 --group=0 ++ --transform s,lshw.spec,${TARNAME}/lshw.spec, ++ -rf ${PROJECT_BINARY_DIR}/${TARNAME}.tar lshw.spec ++ COMMAND gzip ${PROJECT_BINARY_DIR}/${TARNAME}.tar ++ COMMAND rm ${PROJECT_SOURCE_DIR}/lshw.spec ++ WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}" ++ COMMENT "Creating release tarball") ++ ++configure_file( ++ "${CMAKE_CURRENT_SOURCE_DIR}/core/config.h.in" ++ "${PROJECT_BINARY_DIR}/config.h") ++ ++include_directories("${PROJECT_BINARY_DIR}") ++include_directories("${CMAKE_CURRENT_SOURCE_DIR}/core") ++ ++file(GLOB DATAFILES "pci.ids" "pnp.ids" "usb.ids" "manuf.txt" "oui.txt" "pnpid.txt") ++ ++file(GLOB SOURCES "core/*.cc") ++add_library(core ${SOURCES}) ++add_executable(lshw lshw.cc) ++ ++if(STATIC) ++ set_target_properties(lshw PROPERTIES LINK_FLAGS "-static" ) ++endif() ++ ++target_link_libraries(lshw ${SQLITE3_LIBRARIES} ${Z_LIBRARIES} core resolv) ++ ++if(NOT ZLIB) ++ if(HWDATA) ++ install(FILES ${DATAFILES} DESTINATION ${PROJECT_DATADIR}) ++ endif() ++else() ++ foreach(DATAFILE ${DATAFILES}) ++ get_filename_component(FILE ${DATAFILE} NAME) ++ add_custom_command( ++ OUTPUT ${FILE}.gz ++ COMMAND ${GZIP} -c ${DATAFILE} > ${FILE}.gz) ++ add_custom_target(${FILE} ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${FILE}.gz) ++ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${FILE}.gz DESTINATION ${PROJECT_DATADIR}) ++ endforeach() ++endif() ++ ++install(FILES lshw.1 DESTINATION ${MANDIR}/man1 COMPONENT doc) ++install(TARGETS lshw DESTINATION sbin) +diff --git a/src/Makefile b/src/Makefile +deleted file mode 100644 +index 7ae8218..0000000 +--- a/src/Makefile ++++ /dev/null +@@ -1,144 +0,0 @@ +-PACKAGENAME:=lshw +-export PACKAGENAME +-VERSION?= $(shell git describe --tags --long | cut -d - -f 1,2 | tr - .) +- +-SQLITE?=0 +-ZLIB?=0 +- +-DESTDIR?=/ +-PREFIX?=/usr +-SBINDIR=$(PREFIX)/sbin +-MANDIR=$(PREFIX)/share/man +-DATADIR=$(PREFIX)/share +-INSTALL?=install -p +-STRIP?=strip +-export DESTDIR +-export PREFIX +-export SBINDIR +-export MANDIR +-export DATADIR +-export SQLITE +-export ZLIB +- +-CXX?=$(CROSS_COMPILE)c++ +-INCLUDES=-I./core/ +-DEFINES=-DPREFIX=\"$(PREFIX)\" -DSBINDIR=\"$(SBINDIR)\" -DMANDIR=\"$(MANDIR)\" -DDATADIR=\"$(DATADIR)\" -DVERSION=\"$(VERSION)\" +-CXXFLAGS=-g -Wall -g $(INCLUDES) $(DEFINES) $(RPM_OPT_FLAGS) +-ifeq ($(SQLITE), 1) +- CXXFLAGS+= -DSQLITE $(shell pkg-config --cflags sqlite3) +-endif +-ifeq ($(ZLIB), 1) +- CXXFLAGS+= -DZLIB $(shell pkg-config --cflags zlib) +-endif +-LDFLAGS+=-L./core/ -g +-ifneq ($(shell $(LD) --help 2| grep -- --as-needed), ) +- LDFLAGS+= -Wl,--as-needed +-endif +-LDSTATIC=-static +-LIBS+=-llshw -lresolv +-ifeq ($(SQLITE), 1) +- LIBS+= $(shell pkg-config --libs sqlite3) +-endif +-ifeq ($(ZLIB), 1) +- LIBS+= $(shell pkg-config --libs zlib) +-endif +- +-export CXXFLAGS +-export LIBS +-export LDFLAGS +- +-ifeq ($(ZLIB), 1) +-DATAFILES = pci.ids.gz usb.ids.gz oui.txt.gz manuf.txt.gz pnp.ids.gz pnpid.txt.gz +-else +-DATAFILES = pci.ids usb.ids oui.txt manuf.txt pnp.ids pnpid.txt +-endif +- +-all: $(PACKAGENAME) $(PACKAGENAME).1 $(DATAFILES) +- +-.cc.o: +- $(CXX) $(CXXFLAGS) -c $< -o $@ +- +-%.gz: % +- gzip -c $< > $@ +- +-.PHONY: core +-core: +- +make -C core all +- +-$(PACKAGENAME): core $(PACKAGENAME).o +- $(CXX) $(LDFLAGS) -o $@ $(PACKAGENAME).o $(LIBS) +- +-.PHONY: po +-po: +- +make -C po all +- +-.PHONY: gui +-gui: core +- +make -C gui all +- +-.PHONY: nologo +-nologo: +- cp -f gui/artwork/nologo/* gui/artwork/ +- +-.PHONY: static +-static: $(PACKAGENAME)-static +- +-$(PACKAGENAME)-static: core core/lib$(PACKAGENAME).a $(PACKAGENAME).o +- $(CXX) $(LDSTATIC) $(LDFLAGS) -o $@ $(PACKAGENAME).o $(LIBS) +- $(STRIP) $@ +- +-.PHONY: compressed +-compressed: $(PACKAGENAME)-compressed +- +-$(PACKAGENAME)-compressed: $(PACKAGENAME)-static +- upx -9 -o $@ $< +- +-$(PACKAGENAME).1: $(PACKAGENAME).sgml +- docbook2man $< +- +-pci.ids: +- wget http://pciids.sourceforge.net/pci.ids +- +-usb.ids: +- wget http://www.linux-usb.org/usb.ids +- +-oui.txt: +- wget http://standards.ieee.org/regauth/oui/oui.txt +- +-manuf.txt: +- wget -O $@ http://anonsvn.wireshark.org/wireshark/trunk/manuf +- +-pnp.ids: +- wget https://git.fedorahosted.org/cgit/hwdata.git/plain/pnp.ids +- +-pnpid.txt: +- wget http://www-pc.uni-regensburg.de/hardware/TECHNIK/PCI_PNP/pnpid.txt +- +-install: all +- $(INSTALL) -d -m 0755 $(DESTDIR)/$(SBINDIR) +- $(INSTALL) -m 0755 $(PACKAGENAME) $(DESTDIR)/$(SBINDIR) +- $(INSTALL) -d -m 0755 $(DESTDIR)/$(MANDIR)/man1 +- $(INSTALL) -m 0644 $(PACKAGENAME).1 $(DESTDIR)/$(MANDIR)/man1 +- $(INSTALL) -d -m 0755 $(DESTDIR)/$(DATADIR)/$(PACKAGENAME) +- $(INSTALL) -m 0644 $(DATAFILES) $(DESTDIR)/$(DATADIR)/$(PACKAGENAME) +- make -C po install +- +-install-gui: gui +- $(INSTALL) -d -m 0755 $(DESTDIR)/$(SBINDIR) +- $(INSTALL) -m 0755 gui/gtk-$(PACKAGENAME) $(DESTDIR)/$(SBINDIR) +- $(INSTALL) -d -m 0755 $(DESTDIR)/$(DATADIR)/$(PACKAGENAME)/artwork +- $(INSTALL) -d -m 0755 $(DESTDIR)/$(DATADIR)/$(PACKAGENAME)/ui +- $(INSTALL) -m 0644 gui/*.ui $(DESTDIR)/$(DATADIR)/$(PACKAGENAME)/ui +- $(INSTALL) -m 0644 gui/artwork/*.svg $(DESTDIR)/$(DATADIR)/$(PACKAGENAME)/artwork +- +-clean: +- rm -f $(PACKAGENAME).o $(PACKAGENAME) $(PACKAGENAME)-static $(PACKAGENAME)-compressed +- rm -f $(addsuffix .gz,$(DATAFILES)) +- make -C core clean +- make -C gui clean +- +-depend: +- @makedepend -Y $(SRCS) 2> /dev/null > /dev/null +- +- +-# DO NOT DELETE +diff --git a/src/core/Makefile b/src/core/Makefile +deleted file mode 100644 +index b429380..0000000 +--- a/src/core/Makefile ++++ /dev/null +@@ -1,80 +0,0 @@ +-PACKAGENAME?=lshw +- +-CXX?=$(CROSS_COMPILE)c++ +-INCLUDES= +-DEFINES=-DPREFIX=\"$(PREFIX)\" -DSBINDIR=\"$(SBINDIR)\" -DMANDIR=\"$(MANDIR)\" -DDATADIR=\"$(DATADIR)\" +-CXXFLAGS?=-g -Wall $(INCLUDES) $(DEFINES) $(RPM_OPT_FLAGS) +-LDFLAGS= +-LDSTATIC= +-LIBS= +- +-OBJS = hw.o main.o print.o mem.o dmi.o device-tree.o cpuinfo.o osutils.o pci.o version.o cpuid.o ide.o cdrom.o pcmcia-legacy.o scsi.o s390.o disk.o spd.o network.o isapnp.o pnp.o fb.o options.o usb.o sysfs.o display.o heuristics.o parisc.o cpufreq.o partitions.o blockio.o lvm.o ideraid.o pcmcia.o volumes.o mounts.o smp.o abi.o jedec.o dump.o fat.o virtio.o vio.o nvme.o mmc.o +-ifeq ($(SQLITE), 1) +- OBJS+= db.o +-endif +-SRCS = $(OBJS:.o=.cc) +- +-all: lib$(PACKAGENAME).a +- +-.cc.o: +- $(CXX) $(CXXFLAGS) -c $< -o $@ +- +-lib$(PACKAGENAME).a: $(OBJS) +- $(AR) rs $@ $^ +- +-install: all +- +-clean: +- rm -f $(OBJS) lib$(PACKAGENAME).a +- +-depend: +- @makedepend -Y $(SRCS) 2> /dev/null > /dev/null +- +- +-# DO NOT DELETE +- +-hw.o: hw.h osutils.h version.h config.h options.h heuristics.h +-main.o: hw.h print.h version.h options.h mem.h dmi.h cpuinfo.h cpuid.h +-main.o: device-tree.h pci.h pcmcia.h pcmcia-legacy.h ide.h scsi.h spd.h +-main.o: network.h isapnp.h fb.h usb.h sysfs.h display.h parisc.h cpufreq.h +-main.o: ideraid.h mounts.h smp.h abi.h s390.h virtio.h pnp.h vio.h +-print.o: print.h hw.h options.h version.h osutils.h config.h +-mem.o: version.h config.h mem.h hw.h sysfs.h +-dmi.o: version.h config.h dmi.h hw.h osutils.h +-device-tree.o: version.h device-tree.h hw.h osutils.h +-cpuinfo.o: version.h cpuinfo.h hw.h osutils.h +-osutils.o: version.h osutils.h +-pci.o: version.h config.h pci.h hw.h osutils.h options.h +-version.o: version.h config.h +-cpuid.o: version.h cpuid.h hw.h +-ide.o: version.h cpuinfo.h hw.h osutils.h cdrom.h disk.h heuristics.h +-cdrom.o: version.h cdrom.h hw.h partitions.h +-pcmcia-legacy.o: version.h pcmcia-legacy.h hw.h osutils.h +-scsi.o: version.h mem.h hw.h cdrom.h disk.h osutils.h heuristics.h sysfs.h +-disk.o: version.h disk.h hw.h osutils.h heuristics.h partitions.h +-spd.o: version.h spd.h hw.h osutils.h +-network.o: version.h config.h network.h hw.h osutils.h sysfs.h options.h +-network.o: heuristics.h +-isapnp.o: version.h isapnp.h hw.h pnp.h +-pnp.o: version.h pnp.h hw.h sysfs.h osutils.h +-fb.o: version.h fb.h hw.h +-options.o: version.h options.h osutils.h +-usb.o: version.h usb.h hw.h osutils.h heuristics.h options.h +-sysfs.o: version.h sysfs.h hw.h osutils.h +-display.o: display.h hw.h +-heuristics.o: version.h sysfs.h hw.h osutils.h +-parisc.o: version.h device-tree.h hw.h osutils.h heuristics.h +-cpufreq.o: version.h hw.h osutils.h +-partitions.o: version.h partitions.h hw.h blockio.h lvm.h volumes.h osutils.h +-blockio.o: version.h blockio.h osutils.h +-lvm.o: version.h lvm.h hw.h blockio.h osutils.h +-ideraid.o: version.h cpuinfo.h hw.h osutils.h cdrom.h disk.h heuristics.h +-pcmcia.o: version.h pcmcia.h hw.h osutils.h sysfs.h +-volumes.o: version.h volumes.h hw.h blockio.h lvm.h osutils.h +-mounts.o: version.h mounts.h hw.h osutils.h +-smp.o: version.h smp.h hw.h osutils.h +-abi.o: version.h abi.h hw.h osutils.h +-jedec.o: jedec.h +-s390.o: hw.h sysfs.h disk.h s390.h +-virtio.o: version.h hw.h sysfs.h disk.h virtio.h +-vio.o: version.h hw.h sysfs.h vio.h +diff --git a/src/core/config.h b/src/core/config.h.in +similarity index 50% +rename from src/core/config.h +rename to src/core/config.h.in +index 69023fd..ca25a5f 100644 +--- a/src/core/config.h ++++ b/src/core/config.h.in +@@ -13,27 +13,15 @@ + #define N_(String) gettext_noop (String) + #endif + +-#ifndef PACKAGE +-#define PACKAGE "lshw" +-#endif +- +-#ifndef PREFIX +-#define PREFIX "/usr" +-#endif +- +-#ifndef SBINDIR +-#define SBINDIR PREFIX"/sbin" +-#endif ++#define PACKAGE "@PROJECT_NAME@" ++#define VERSION "@VERSION@" + +-#ifndef DATADIR +-#define DATADIR PREFIX"/share/lshw" +-#endif ++#define SBINDIR "@SBINDIR@" ++#define DATADIR "@DATADIR@" ++#define MANDIR "@MANDIR@" ++#define LOCALEDIR "@LOCALEDIR@" + +-#ifndef MANDIR +-#define MANDIR PREFIX"/share/man" +-#endif ++#cmakedefine SQLITE 1 ++#cmakedefine ZLIB 1 + +-#ifndef LOCALEDIR +-#define LOCALEDIR PREFIX"/share/locale" +-#endif + #endif +diff --git a/src/core/db.cc b/src/core/db.cc +index d080295..f85c85b 100644 +--- a/src/core/db.cc ++++ b/src/core/db.cc +@@ -1,6 +1,12 @@ ++ + #include + #include + #include ++ ++#include "config.h" ++ ++#ifdef SQLITE ++ + #include + + #include "db.h" +@@ -419,3 +425,5 @@ value statement::operator[](const string & i) const + { + return column(i); + } ++ ++#endif /* SQLITE */ +diff --git a/src/core/dump.cc b/src/core/dump.cc +index 6bc9674..f22f0fb 100644 +--- a/src/core/dump.cc ++++ b/src/core/dump.cc +@@ -1,5 +1,5 @@ +-#include "dump.h" + #include "version.h" ++#include "dump.h" + #include "osutils.h" + + #include +diff --git a/src/core/version.h b/src/core/version.h +index 91e039a..5cecdda 100644 +--- a/src/core/version.h ++++ b/src/core/version.h +@@ -1,6 +1,8 @@ + #ifndef _VERSION_H_ + #define _VERSION_H_ + ++#include "config.h" ++ + #if defined(__GNUC__) || defined(__INTEL_COMPILER) + #define __ID(string) __asm__(".ident\t\"" string "\"") + #else +diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt +new file mode 100644 +index 0000000..3489053 +--- /dev/null ++++ b/src/gui/CMakeLists.txt +@@ -0,0 +1,67 @@ ++if(NOT GUI OR STATIC) ++ message("-- gtk-${PROJECT_NAME} disabled") ++ return() ++endif() ++ ++find_package(PkgConfig) ++pkg_check_modules(GTK2 REQUIRED gtk+-2.0 gmodule-2.0) ++ ++file(GLOB GTK_SOURCES "*.c*") ++ ++include_directories("${PROJECT_BINARY_DIR}") ++include_directories("${PROJECT_SOURCE_DIR}/src/core") ++ ++include_directories("${GTK2_INCLUDE_DIRS}") ++ ++add_executable(gtk-lshw ${GTK_SOURCES}) ++target_link_libraries(gtk-lshw ${SQLITE3_LIBRARIES} ${Z_LIBRARIES} ${GTK2_LIBRARIES} core resolv) ++install(TARGETS gtk-lshw DESTINATION sbin) ++ ++if(POLICYKIT) ++ set(desktop_exec ${CMAKE_INSTALL_FULL_BINDIR}/lshw-gui) ++ configure_file( ++ "${CMAKE_CURRENT_SOURCE_DIR}/integration/org.ezix.lshw.gui.policy.in" ++ "${CMAKE_CURRENT_BINARY_DIR}/org.ezix.lshw.gui.policy") ++ configure_file( ++ "${CMAKE_CURRENT_SOURCE_DIR}/integration/lshw-gui.in" ++ "${CMAKE_CURRENT_BINARY_DIR}/lshw-gui") ++else() ++ set(desktop_exec ${CMAKE_INSTALL_FULL_SBINDIR}/gtk-lshw) ++endif() ++ ++configure_file( ++ "${CMAKE_CURRENT_SOURCE_DIR}/integration/gtk-lshw.desktop.in" ++ "${CMAKE_CURRENT_BINARY_DIR}/gtk-lshw.desktop") ++configure_file( ++ "${CMAKE_CURRENT_SOURCE_DIR}/artwork/logo.svg" ++ "${CMAKE_CURRENT_BINARY_DIR}/gtk-lshw.svg") ++ ++file(GLOB LOGOS "artwork/*.svg") ++file(GLOB NOLOGOS "artwork/nologo/*.svg") ++ ++if(NOLOGO) ++ install(FILES ${NOLOGOS} DESTINATION ${PROJECT_DATADIR}/artwork) ++ foreach(LOGO ${LOGOS}) ++ get_filename_component(BASENAME ${LOGO} NAME) ++ if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/artwork/nologo/${BASENAME}") ++ list(REMOVE_ITEM LOGOS ${LOGO}) ++ endif() ++ endforeach() ++endif() ++ ++install(FILES ${LOGOS} DESTINATION ${PROJECT_DATADIR}/artwork) ++install(FILES gtk-lshw.ui DESTINATION ${PROJECT_DATADIR}/ui) ++install(FILES ${CMAKE_CURRENT_BINARY_DIR}/gtk-lshw.desktop ++ DESTINATION ${CMAKE_INSTALL_FULL_DATADIR}/applications) ++install(FILES integration/gtk-lshw.appdata.xml DESTINATION ++ ${CMAKE_INSTALL_FULL_DATADIR}/appdata) ++install(FILES ${CMAKE_CURRENT_BINARY_DIR}/gtk-lshw.svg DESTINATION ++ ${CMAKE_INSTALL_FULL_DATADIR}/pixmaps) ++ ++ ++if(POLICYKIT) ++ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/org.ezix.lshw.gui.policy ++ DESTINATION ${CMAKE_INSTALL_FULL_DATADIR}/polkit-1/actions) ++ install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/lshw-gui ++ DESTINATION bin) ++endif() +diff --git a/src/gui/Makefile b/src/gui/Makefile +deleted file mode 100644 +index f003cfb..0000000 +--- a/src/gui/Makefile ++++ /dev/null +@@ -1,61 +0,0 @@ +-PACKAGENAME?=lshw +- +-CXX?=$(CROSS_COMPILE)c++ +-CC?=$(CROSS_COMPILE)cc +-STRIP?=strip +-OBJCOPY?=objcopy +- +-DEFINES=-DPREFIX=\"$(PREFIX)\" -DSBINDIR=\"$(SBINDIR)\" -DMANDIR=\"$(MANDIR)\" -DDATADIR=\"$(DATADIR)\" +-GTKINCLUDES=$(shell pkg-config gtk+-2.0 --cflags) +-INCLUDES=-I../core $(GTKINCLUDES) +-CXXFLAGS=-g -Wall $(INCLUDES) $(DEFINES) $(RPM_OPT_FLAGS) +-ifeq ($(SQLITE), 1) +- CXXFLAGS+= -DSQLITE $(shell pkg-config --cflags sqlite3) +-endif +-CFLAGS=$(CXXFLAGS) -g $(DEFINES) +-GTKLIBS=$(shell pkg-config gtk+-2.0 gmodule-2.0 --libs) +-LIBS+=-L../core -llshw -lresolv $(GTKLIBS) +-ifeq ($(SQLITE), 1) +- LIBS+= $(shell pkg-config --libs sqlite3) +-endif +-LDFLAGS= +-ifneq ($(shell $(LD) --help 2| grep -- --as-needed), ) +- LDFLAGS+= -Wl,--as-needed +-endif +- +-OBJS = gtk-lshw.o callbacks.o engine.o print-gui.o stock.o +-SRCS = $(OBJS:.o=.c) +- +-all: gtk-$(PACKAGENAME) +- +-.cc.o: +- $(CXX) $(CXXFLAGS) -c $< -o $@ +- +-.c.o: +- $(CC) $(CFLAGS) -c $< -o $@ +- +-.PHONY: icon +-icon: gtk-$(PACKAGENAME) artwork/logo.svg +- $(OBJCOPY) --add-section .icon=artwork/logo.svg gtk-$(PACKAGENAME) +- +-interface.c: gtk-lshw.glade gtk-lshw.gladep +- glade-2 -w gtk-lshw.glade +- +-gtk-$(PACKAGENAME): $(OBJS) ../core/liblshw.a +- $(CXX) $(LDFLAGS) -o $@ $^ $(LIBS) +- +-install: all +- $(STRIP) gtk-$(PACKAGENAME) +- +-clean: +- rm -f $(OBJS) gtk-$(PACKAGENAME) gtk-lshw.glade.bak gtk-lshw.gladep.bak callbacks.c.bak callbacks.h.bak Makefile.bak +- +-depend: +- @makedepend -Y $(SRCS) 2> /dev/null > /dev/null +- +- +-# DO NOT DELETE +- +-gtk-lshw.o: stock.h engine.h +-callbacks.o: callbacks.h support.h engine.h +-stock.o: stock.h +diff --git a/src/gui/integration/gtk-lshw.desktop b/src/gui/integration/gtk-lshw.desktop.in +similarity index 51% +rename from src/gui/integration/gtk-lshw.desktop +rename to src/gui/integration/gtk-lshw.desktop.in +index 4df1c7c..7124c27 100644 +--- a/src/gui/integration/gtk-lshw.desktop ++++ b/src/gui/integration/gtk-lshw.desktop.in +@@ -3,10 +3,9 @@ Name=LSHW + Comment=HardWare LiSter + Comment[fr]=Listeur de matériel + Comment[es]=Listar equipamiento +-Categories=Application;System;X-Red-Hat-Base;X-Fedora; +-Icon=/usr/share/lshw/artwork/logo.svg +-Exec=/usr/bin/gtk-lshw ++Categories=GTK;System; ++Icon=gtk-lshw ++Exec=@desktop_exec@ + Type=Application + Terminal=false + Encoding=UTF-8 +-X-Desktop-File-Install-Version=0.10 +diff --git a/src/gui/integration/lshw-gui.in b/src/gui/integration/lshw-gui.in +new file mode 100644 +index 0000000..ac0823b +--- /dev/null ++++ b/src/gui/integration/lshw-gui.in +@@ -0,0 +1,5 @@ ++#! /bin/bash ++ ++/usr/bin/pkexec @CMAKE_INSTALL_FULL_SBINDIR@/gtk-lshw ++ ++ +diff --git a/src/gui/integration/org.ezix.lshw.gui.policy.in b/src/gui/integration/org.ezix.lshw.gui.policy.in +new file mode 100644 +index 0000000..cba4189 +--- /dev/null ++++ b/src/gui/integration/org.ezix.lshw.gui.policy.in +@@ -0,0 +1,20 @@ ++ ++ ++ ++ lshw ++ http://ezix.org/project/wiki/HardwareLiSter ++ ++ Hardware Lister (lshw) - list hardware information ++ Authentication is required to run lshw-gui ++ lshw-gui ++ ++ no ++ no ++ auth_admin_keep ++ ++ @CMAKE_INSTALL_FULL_SBINDIR@/gtk-lshw ++ true ++ ++ +diff --git a/src/gui/stock.c b/src/gui/stock.c +index 08675db..2f92332 100644 +--- a/src/gui/stock.c ++++ b/src/gui/stock.c +@@ -1,3 +1,4 @@ ++#include "config.h" + #include "stock.h" + #include + #include +diff --git a/src/po/CMakeLists.txt b/src/po/CMakeLists.txt +new file mode 100644 +index 0000000..de2f5c8 +--- /dev/null ++++ b/src/po/CMakeLists.txt +@@ -0,0 +1,16 @@ ++include(FindGettext) ++ ++if (GETTEXT_FOUND) ++ file(GLOB POTFILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.po") ++ string(REPLACE ".po" " " LANGS ${POTFILES}) ++ message(STATUS "gettext found: ${LANGS}") ++ string(REPLACE " " ";" LANGS ${LANGS}) ++ foreach(LANG ${LANGS}) ++ GETTEXT_PROCESS_PO_FILES(${LANG} ALL PO_FILES ${LANG}.po) ++ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${LANG}.gmo" ++ DESTINATION "${CMAKE_INSTALL_FULL_LOCALEDIR}/${LANG}/LC_MESSAGES" ++ RENAME "${PROJECT_NAME}.mo") ++ endforeach() ++else() ++ message("-- gettext not found") ++endif() +diff --git a/src/po/Makefile b/src/po/Makefile +deleted file mode 100644 +index 36fbdb7..0000000 +--- a/src/po/Makefile ++++ /dev/null +@@ -1,23 +0,0 @@ +-PACKAGENAME?=lshw +- +-LANGUAGES = fr +-SRCS = $(LANGUAGES:=.po) +-CATALOGS = $(LANGUAGES:=.mo) +- +-all: $(PACKAGENAME).pot $(CATALOGS) +- +-POTFILES: +- find .. -name \*.cc > $@ +- find .. -name \*.c >> $@ +- +-$(PACKAGENAME).pot: POTFILES +- xgettext -F --no-wrap --indent --keyword=_ --keyword=N_ -d $(PACKAGENAME) -o $@ -f POTFILES +- +-%.mo: %.po +- msgfmt -v -o $@ $^ +- +-install: $(CATALOGS) +- $(foreach i, $(LANGUAGES), install -D $(i).mo $(DESTDIR)/$(DATADIR)/locale/$(i)/LC_MESSAGES/$(PACKAGENAME).mo ;) +- +-clean: +- rm -f $(CATALOGS) $(PACKAGENAME).pot +-- +2.25.1 + diff --git a/SPECS/lshw.spec b/SPECS/lshw.spec new file mode 100644 index 0000000..ff10c0c --- /dev/null +++ b/SPECS/lshw.spec @@ -0,0 +1,367 @@ +Summary: Hardware lister +Name: lshw +Version: B.02.19.2 +Release: 2%{?dist} +License: GPLv2 +Group: Applications/System +URL: http://ezix.org/project/wiki/HardwareLiSter +Source0: http://www.ezix.org/software/files/lshw-%{version}.tar.gz +Patch1: lshw-B.02.18-scandir.patch +Patch2: lshw-B.02.18-revert-json.patch +Patch3: lshw-B.02.19.2-cmake.patch +Patch4: lshw-B.02.19.2-Add-the-FindPkgConfig-to-CMakeLists.patch +Patch5: 0001-report-CPU-family-model-stepping.patch +Patch6: 0002-move-PnP-devices-to-the-ISA-LPC-bridge.patch +Patch7: 0003-correctly-format-SMBIOS-UUID.patch +Patch8: 0004-cosmetic-clean-up.patch +Patch9: 0005-begin-work-on-input-devices.patch +Patch10: 0006-cosmetic-fixes.patch +Patch11: 0007-detect-sound-devices.patch +Patch12: 0008-detect-framebuffers.patch +Patch13: 0009-try-to-connect-input-devices-to-the-right-parent.patch +Patch14: 0010-devtree-Add-chip-id-from-the-dimm-module.patch +Patch15: 0011-devtree-Add-chip-id-from-CPU-node.patch +Patch16: 0012-volumes-fix-segfault-in-apfs-volume-code.patch +Patch17: 0013-merge-Github-PR-53.patch +Patch18: 0014-devtree-Add-capabilites-to-the-OPAL-Firmware.patch +Patch19: 0015-fix-issue-with-logical-names-being-truncated-dev-sda.patch +Patch20: 0016-code-clean-up-for-read-3.patch +Patch21: 0017-report-product-model-on-Power-systems.patch + +BuildRequires: cmake +BuildRequires: desktop-file-utils +BuildRequires: gcc +BuildRequires: gcc-c++ +BuildRequires: gettext +BuildRequires: gtk2-devel >= 2.4 +BuildRequires: libappstream-glib +BuildRequires: ninja-build +BuildRequires: python3-devel +BuildRequires: sqlite +BuildRequires: sqlite-devel +Requires: hwdata +%description +lshw is a small tool to provide detailed informaton on the hardware +configuration of the machine. It can report exact memory +configuration, firmware version, mainboard configuration, CPU version +and speed, cache configuration, bus speed, etc. on DMI-capable x86 +systems and on some PowerPC machines (PowerMac G4 is known to work). + +Information can be output in plain text, XML or HTML. + +%package gui +Summary: Graphical hardware lister +Group: Applications/System +Requires: polkit +Requires: %{name} = %{version}-%{release} +%description gui +Graphical frontend for the hardware lister (lshw) tool. If desired, +hardware information can be saved to file in plain, XML or HTML +format. + +%prep +%setup -q +%patch01 -p1 +%patch02 -R -p1 +%patch03 -p1 +%patch04 -p1 +%patch05 -p1 +%patch06 -p1 +%patch07 -p1 +%patch08 -p1 +%patch09 -p1 +%patch10 -p1 +%patch11 -p1 +%patch12 -p1 +%patch13 -p1 +%patch14 -p1 +%patch15 -p1 +%patch16 -p1 +%patch17 -p1 +%patch18 -p1 +%patch19 -p1 +%patch20 -p1 +%patch21 -p1 + +%build +mkdir build && pushd build +%cmake .. -DNOLOGO=ON -DHWDATA=OFF -DPOLICYKIT=ON -DBUILD_SHARED_LIBS=OFF -DSQLITE=ON -GNinja +%ninja_build + +%install +pushd build +%ninja_install +ln -s gtk-lshw %{buildroot}%{_sbindir}/lshw-gui + +# translations seems borken, remove for now +#find_lang %{name} +rm -rf %{buildroot}%{_datadir}/locale/fr/ + +%check +appstream-util validate-relax --nonet %{buildroot}/%{_datadir}/appdata/*.appdata.xml + +# check json output is valid +pushd build +src/lshw -json \ + -disable usb -disable pcmcia -disable isapnp \ + -disable ide -disable scsi -disable dmi -disable memory \ + -disable cpuinfo 2>/dev/null | %{__python3} -m json.tool + +#files -f %{name}.lang +%files +%license COPYING +%doc README.md +%{_mandir}/man1/lshw.1* +%{_sbindir}/lshw + +%files gui +%license COPYING +%{_bindir}/lshw-gui +%{_sbindir}/gtk-lshw +%{_sbindir}/lshw-gui +%dir %{_datadir}/lshw +%{_datadir}/lshw/artwork +%dir %{_datadir}/lshw/ui +%{_datadir}/lshw/ui/gtk-lshw.ui +%{_datadir}/pixmaps/gtk-lshw.svg +%{_datadir}/applications/gtk-lshw.desktop +%{_datadir}/appdata/gtk-lshw.appdata.xml +%{_datadir}/polkit-1/actions/org.ezix.lshw.gui.policy + +%changelog +* Wed May 27 2020 Lianbo Jiang - B.02.19.2-2 +- Update to upstream master 3775782808e8 + +* Tue May 26 2020 Lianbo Jiang - B.02.19.2-1 +- B.02.19.2 + +* Mon Feb 10 2020 Lianbo Jiang - B.02.18-23 +- Do not show modified time with -notime option +- Resolves: rhbz#1733126 + +* Thu Nov 21 2019 Lianbo Jiang - B.02.18-22 +- Display proper logical name of network device +- Resolves: rhbz#1724087 +- Add DIMM running speed and Print dimm rank information +- Resolves: rhbz#1725199 + +* Mon May 13 2019 Lianbo Jiang - B.02.18-21 +- Update to upstream master 6cc0581bc805. +- Resolves: rhbz#1664092 + +* Thu Apr 25 2019 Lianbo Jiang - B.02.18-20 +- Change python to python3 in selftest/Makefile for the CI gating test. +- Resolves: rhbz#1680623 + +* Thu Apr 25 2019 Lianbo Jiang - B.02.18-19 +- Enable SQLite and fix the CI gating test. +- Resolves: rhbz#1680623 + +* Tue Apr 23 2019 Lianbo Jiang - B.02.18-18 +- Fix:59a8e99ab22d ("Porting the code from /CoreOS/lshw/sanity/check-output for the CI gating") +- Resolves: rhbz#1680623 + +* Fri Apr 19 2019 Lianbo Jiang - B.02.18-17 +- Add the CI gating test +- Resolves: rhbz#1680623 + +* Mon Apr 02 2018 Terje Rosten - B.02.18-16 +- Update to commit 20cda77 +- Convert to cmake build system + +* Thu Feb 08 2018 Terje Rosten - B.02.18-15 +- Fix JSON issue (rhbz#1543320) + +* Thu Feb 08 2018 Fedora Release Engineering - B.02.18-14 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild + +* Fri Jan 26 2018 Terje Rosten - B.02.18-13 +- Fix date +- Need gettext + +* Fri Jan 26 2018 Terje Rosten - B.02.18-12 +- Update to commit d05baa7 + +* Mon Aug 28 2017 Terje Rosten - B.02.18-11 +- Prefer lshw-gui in lshw-gui context + +* Sun Aug 13 2017 Terje Rosten - B.02.18-10 +- Add AppData bz#1476498 + +* Thu Aug 03 2017 Fedora Release Engineering - B.02.18-9 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild + +* Wed Jul 26 2017 Fedora Release Engineering - B.02.18-8 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild + +* Mon May 15 2017 Fedora Release Engineering - B.02.18-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_27_Mass_Rebuild + +* Fri Feb 10 2017 Fedora Release Engineering - B.02.18-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild + +* Wed Aug 24 2016 Terje Rosten - B.02.18-5 +- Modify lshw gui wrapper to fix bz#1368404 + +* Thu Aug 11 2016 Terje Rosten - B.02.18-4 +- Add patches to fix sysconf/long_bit issue and crash (bz#1342792) + +* Wed May 18 2016 Terje Rosten - B.02.18-3 +- Add patch to fix crash (bz#1332486) + +* Mon Apr 25 2016 Terje Rosten - B.02.18-2 +- Date fix + +* Mon Apr 25 2016 Terje Rosten - B.02.18-1 +- B.02.18 + +* Thu Feb 04 2016 Fedora Release Engineering - B.02.17-7 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild + +* Wed Jun 17 2015 Fedora Release Engineering - B.02.17-6 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild + +* Sat May 02 2015 Kalev Lember - B.02.17-5 +- Rebuilt for GCC 5 C++11 ABI change + +* Sun Aug 17 2014 Fedora Release Engineering - B.02.17-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild + +* Sat Jun 07 2014 Fedora Release Engineering - B.02.17-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild + +* Mon Sep 30 2013 Terje Rosten - B.02.17-2 +- Add patch to fix segfault in scan fat code + +* Thu Sep 26 2013 Terje Rosten - B.02.17-1 +- B.02.17 + +* Sat Aug 03 2013 Fedora Release Engineering - B.02.16-9 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild + +* Sun Jun 09 2013 Terje Rosten - B.02.16-8 +- Rename macro + +* Sun Jun 09 2013 Terje Rosten - B.02.16-7 +- Fix desktop file (bz #953684) +- Remove broken translations (bz #905896) +- Add vendor macro + +* Fri Apr 26 2013 Jon Ciesla - B.02.16-6 +- Drop desktop vendor tag. + +* Thu Feb 14 2013 Fedora Release Engineering - B.02.16-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild + +* Thu Jul 19 2012 Fedora Release Engineering - B.02.16-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild + +* Tue May 08 2012 Terje Rosten - B.02.16-3 +- Switch from consolehelper to PolicyKit (bz #502730) + +* Tue Feb 28 2012 Fedora Release Engineering - B.02.16-2 +- Rebuilt for c++ ABI breakage + +* Sun Jan 29 2012 Terje Rosten - B.02.16-1 +- B.02.16 + +* Fri Jan 13 2012 Fedora Release Engineering - B.02.15-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild + +* Mon Oct 17 2011 Terje Rosten - B.02.15-3 +- Own all dirs + +* Tue Feb 08 2011 Fedora Release Engineering - B.02.15-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild + +* Sun Nov 21 2010 Terje Rosten - B.02.15-1 +- B.02.15 +- Remove patches now upstream +- Build with sqlite support + +* Sun Sep 05 2010 Terje Rosten - B.02.14-5 +- Add patch to fix build with gcc-4.5 + +* Sun Sep 05 2010 Terje Rosten - B.02.14-4 +- Add patch to fix ext4 issue + +* Sat Jul 25 2009 Fedora Release Engineering - B.02.14-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild + +* Wed May 06 2009 Adam Jackson - B.02.14-2 +- Requires: hwdata +- Drop redundant copies of pci.ids and friends, since we'll pick up the + copies in hwdata at runtime + +* Sun Mar 1 2009 Terje Rosten - B.02.14-1 +- B.02.14 +- Drop gcc43 patch now upstream + +* Wed Feb 25 2009 Fedora Release Engineering - B.02.13-4 +- rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild + +* Wed Aug 13 2008 Terje Rosten - B.02.13-3 +- rebuild + +* Wed Aug 13 2008 Terje Rosten - B.02.13-2 +- proper patch macro + +* Wed Aug 13 2008 Terje Rosten - B.02.13-1 +- B.02.13 +- remove patches now upstream +- add new gcc43 patch + +* Tue Apr 15 2008 Terje Rosten - B.02.12.01-5 +- rebuild + +* Tue Apr 15 2008 Terje Rosten - B.02.12.01-4 +- add patch to fix bz #442501 + +* Mon Feb 11 2008 Terje Rosten - B.02.12.01-3 +- add patch to build with gcc-4.3 + +* Sat Feb 09 2008 Terje Rosten - B.02.12.01-2 +- rebuild + +* Mon Nov 5 2007 Terje Rosten - B.02.12.01-1 +- B.02.12.01 +- Replace trademark icons + +* Tue Aug 14 2007 Terje Rosten - B.02.11.01-3 +- Move desktop and pam config to files +- Simplify build + +* Tue Aug 07 2007 Terje Rosten - B.02.11.01-2 +- Remove trademarks + +* Mon Aug 06 2007 Terje Rosten - B.02.11.01-1 +- B.02.11.01 + +* Sun Aug 05 2007 Terje Rosten - B.02.11-3 +- Move artwork to gui subpackage +- Implement consolehelper support + +* Sat Aug 04 2007 Terje Rosten - B.02.11-2 +- License is GPLv2 (only) +- Fix ui %%description + +* Wed Aug 01 2007 Terje Rosten - B.02.11-1 +- Follow upstream version scheme + +* Wed Jul 25 2007 Terje Rosten - 2.11-1 +- 2.11 + +* Wed Jun 27 2007 Terje Rosten - 2.10-2 +- minor fixes +- add patch to avoid stripping +- add desktop file +- strip changelog +- move from sbin to bin +- new url + +* Wed Feb 14 2007 Dag Wieers - 2.10-1 - 4876+/dag +- Updated to release B.02.10. + +* Tue Dec 21 2004 Dag Wieers - 2.0-1 +- Initial package. (using DAR) +