[arch-commits] Commit in lshw/trunk (2 files)

Sergej Pupykin spupykin at gemini.archlinux.org
Thu Sep 30 17:12:06 UTC 2021


    Date: Thursday, September 30, 2021 @ 17:12:05
  Author: spupykin
Revision: 1026203

upgpkg: lshw B.02.19.2-3

Added:
  lshw/trunk/82393aa9b59307a443677df7340a1dd38847a5ef.patch
Modified:
  lshw/trunk/PKGBUILD

------------------------------------------------+
 82393aa9b59307a443677df7340a1dd38847a5ef.patch |   58 +++++++++++++++++++++++
 PKGBUILD                                       |    9 ++-
 2 files changed, 64 insertions(+), 3 deletions(-)

Added: 82393aa9b59307a443677df7340a1dd38847a5ef.patch
===================================================================
--- 82393aa9b59307a443677df7340a1dd38847a5ef.patch	                        (rev 0)
+++ 82393aa9b59307a443677df7340a1dd38847a5ef.patch	2021-09-30 17:12:05 UTC (rev 1026203)
@@ -0,0 +1,58 @@
+From 82393aa9b59307a443677df7340a1dd38847a5ef Mon Sep 17 00:00:00 2001
+From: Yuan-Chen Cheng <ycheng.tw at gmail.com>
+Date: Fri, 25 Oct 2019 11:15:24 -0400
+Subject: [PATCH] correct "JSON output format" without/with all class.
+
+test pass on my machine.
+
+Signed-off-by: Yuan-Chen Cheng <ycheng.tw at gmail.com>
+---
+ src/core/hw.cc | 25 ++++++++++++++++++++-----
+ 1 file changed, 20 insertions(+), 5 deletions(-)
+
+diff --git a/src/core/hw.cc b/src/core/hw.cc
+index 4522c1a..8232337 100644
+--- a/src/core/hw.cc
++++ b/src/core/hw.cc
+@@ -1650,13 +1650,29 @@ string hwNode::asJSON(unsigned level)
+     resources.clear();
+   }
+ 
+-  for (unsigned int i = 0; i < countChildren(); i++)
++  if(countChildren()>0)
+   {
+-    out << getChild(i)->asJSON(visible(getClassName()) ? level + 2 : 1);
+-    if (visible(getChild(i)->getClassName()))
++    bool childOutputed = false;
++    for (unsigned int i = 0; i < countChildren(); i++)
+     {
+-      out << "," << endl;
++      string childJSON = getChild(i)->asJSON(visible(getClassName()) ? level + 2 : 1);
++      string childJSONstrip = strip(childJSON);
++      if (childJSONstrip.length() > 0)
++      {
++        if (!childOutputed)
++        {
++          if(visible(getClassName()))
++            out << "," << endl << spaces(2*level+2) << "\"children\" : [" << endl;
++        }
++        else
++          out << "," << endl;
++        childOutputed = true;
++        out << childJSON;
++      }
+     }
++
++    if(visible(getClassName()) && childOutputed)
++      out << endl << spaces(2*level+2) << "]";
+   }
+ 
+   if(visible(getClassName()))
+@@ -1667,7 +1683,6 @@ string hwNode::asJSON(unsigned level)
+ 
+   if (level == 0)
+   {
+-    out.seekp(-2, std::ios_base::end);
+     out << endl << "]" << endl;
+   }
+ 

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2021-09-30 17:11:40 UTC (rev 1026202)
+++ PKGBUILD	2021-09-30 17:12:05 UTC (rev 1026203)
@@ -4,7 +4,7 @@
 
 pkgname=lshw
 pkgver=B.02.19.2
-pkgrel=2
+pkgrel=3
 pkgdesc="A small tool to provide detailed information on the hardware configuration of the machine."
 url="https://ezix.org/project/wiki/HardwareLiSter"
 license=('GPL')
@@ -12,13 +12,16 @@
 depends=('gcc-libs' 'hwids')
 optdepends=('gtk2')
 makedepends=('gcc' 'gtk2' 'sqlite')
-source=(https://ezix.org/software/files/lshw-$pkgver.tar.gz)
-sha256sums=('9bb347ac87142339a366a1759ac845e3dbb337ec000aa1b99b50ac6758a80f80')
+source=(https://ezix.org/software/files/lshw-$pkgver.tar.gz
+	82393aa9b59307a443677df7340a1dd38847a5ef.patch)
+sha256sums=('9bb347ac87142339a366a1759ac845e3dbb337ec000aa1b99b50ac6758a80f80'
+            '3906335e802387319900a70c7ce575f0f539fce5befd6d37edc74be0d31141df')
 
 prepare() {
   cd "$srcdir"/$pkgname-$pkgver
   sed -i 's|/usr/bin/gtk-lshw|/usr/sbin/gtk-lshw|' src/gui/integration/gtk-lshw.desktop
   sed -i '/^LDFLAGS=$/d' src/core/Makefile src/gui/Makefile
+  patch -p1 <../82393aa9b59307a443677df7340a1dd38847a5ef.patch
 }
 
 build() {



More information about the arch-commits mailing list