summaryrefslogtreecommitdiff
path: root/repo/lshw
diff options
context:
space:
mode:
authordavidovski <david@davidovski.xyz>2022-06-09 14:35:52 +0100
committerdavidovski <david@davidovski.xyz>2022-06-09 14:35:52 +0100
commitd1fc3393cca72e8e432f827f7624e38734fad6dc (patch)
tree7b971fbfc203ff017ad78852476bfcccee170971 /repo/lshw
parentccc722b7ed330198d82a3cf28ead76d6d107a70a (diff)
moved firmware to separate pacakges
Diffstat (limited to 'repo/lshw')
-rw-r--r--repo/lshw/15565229509455527de9ce7cbb9530e2b31d043b.patch59
-rw-r--r--repo/lshw/2b1c730b493d647bbab4854713571458e82a81e7.patch46
-rw-r--r--repo/lshw/fix-musl-sc_long_bit.patch14
-rw-r--r--repo/lshw/lshw.xibuild34
-rw-r--r--repo/lshw/wrapper-for-basename.patch107
5 files changed, 260 insertions, 0 deletions
diff --git a/repo/lshw/15565229509455527de9ce7cbb9530e2b31d043b.patch b/repo/lshw/15565229509455527de9ce7cbb9530e2b31d043b.patch
new file mode 100644
index 0000000..0d9c65d
--- /dev/null
+++ b/repo/lshw/15565229509455527de9ce7cbb9530e2b31d043b.patch
@@ -0,0 +1,59 @@
+From 15565229509455527de9ce7cbb9530e2b31d043b Mon Sep 17 00:00:00 2001
+From: Lyonel Vincent <lyonel@ezix.org>
+Date: Wed, 27 May 2020 01:07:16 +0200
+Subject: [PATCH] clean-up JSON output
+
+---
+ src/core/hw.cc | 29 +++++++++++++++++++++++++----
+ 1 file changed, 25 insertions(+), 4 deletions(-)
+
+diff --git a/src/core/hw.cc b/src/core/hw.cc
+index ab345fe..6aea7cf 100644
+--- a/src/core/hw.cc
++++ b/src/core/hw.cc
+@@ -1650,13 +1650,20 @@ string hwNode::asJSON(unsigned level)
+ resources.clear();
+ }
+
+- for (unsigned int i = 0; i < countChildren(); i++)
++ if(!::enabled("output:list") && countChildren()>0)
+ {
+- out << getChild(i)->asJSON(visible(getClassName()) ? level + 2 : 1);
+- if (visible(getChild(i)->getClassName()))
++ out << "," << endl;
++ out << spaces(2*level+2);
++ out << "\"children\" : [";
++ for (unsigned int i = 0; i < countChildren(); i++)
+ {
+- out << "," << endl;
++ out << getChild(i)->asJSON(visible(getClassName()) ? level + 2 : 1);
++ if (visible(getChild(i)->getClassName()) && i<countChildren()-1)
++ {
++ out << "," << endl;
++ }
+ }
++ out << "]";
+ }
+
+ if(visible(getClassName()))
+@@ -1665,6 +1672,20 @@ string hwNode::asJSON(unsigned level)
+ out << "}";
+ }
+
++ if(::enabled("output:list") && countChildren()>0)
++ {
++ bool needcomma = visible(getClassName());
++ for (unsigned int i = 0; i < countChildren(); i++)
++ {
++ string json = getChild(i)->asJSON(visible(getClassName()) ? level + 2 : 1);
++
++ if(needcomma && strip(json)!="")
++ out << "," << endl;
++ out << getChild(i)->asJSON(visible(getClassName()) ? level + 2 : 1);
++ needcomma |= strip(json)!="";
++ }
++ }
++
+ if (::enabled("output:list") && level == 0)
+ {
+ out << endl << "]" << endl;
diff --git a/repo/lshw/2b1c730b493d647bbab4854713571458e82a81e7.patch b/repo/lshw/2b1c730b493d647bbab4854713571458e82a81e7.patch
new file mode 100644
index 0000000..57dccb5
--- /dev/null
+++ b/repo/lshw/2b1c730b493d647bbab4854713571458e82a81e7.patch
@@ -0,0 +1,46 @@
+From 2b1c730b493d647bbab4854713571458e82a81e7 Mon Sep 17 00:00:00 2001
+From: Lyonel Vincent <lyonel@ezix.org>
+Date: Tue, 26 May 2020 01:00:37 +0200
+Subject: [PATCH] JSON output clean-up (list/object)
+
+---
+ src/core/hw.cc | 5 ++---
+ src/lshw.cc | 1 +
+ 2 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/src/core/hw.cc b/src/core/hw.cc
+index aca424c..ab345fe 100644
+--- a/src/core/hw.cc
++++ b/src/core/hw.cc
+@@ -1400,7 +1400,7 @@ string hwNode::asJSON(unsigned level)
+ config = getConfigKeys();
+ resources = getResources("\" value=\"");
+
+- if (level == 0)
++ if (::enabled("output:list") && level == 0)
+ {
+ out << "[" << endl;
+ }
+@@ -1665,9 +1665,8 @@ string hwNode::asJSON(unsigned level)
+ out << "}";
+ }
+
+- if (level == 0)
++ if (::enabled("output:list") && level == 0)
+ {
+- out.seekp(-2, std::ios_base::end);
+ out << endl << "]" << endl;
+ }
+
+diff --git a/src/lshw.cc b/src/lshw.cc
+index 219a008..571b1c3 100644
+--- a/src/lshw.cc
++++ b/src/lshw.cc
+@@ -84,6 +84,7 @@ char **argv)
+
+ disable("isapnp");
+
++ disable("output:list");
+ disable("output:json");
+ disable("output:db");
+ disable("output:xml");
diff --git a/repo/lshw/fix-musl-sc_long_bit.patch b/repo/lshw/fix-musl-sc_long_bit.patch
new file mode 100644
index 0000000..b409dfe
--- /dev/null
+++ b/repo/lshw/fix-musl-sc_long_bit.patch
@@ -0,0 +1,14 @@
+--- a/src/core/abi.cc
++++ b/src/core/abi.cc
+@@ -21,7 +21,11 @@
+ {
+ // are we compiled as 32- or 64-bit process ?
+ long sc = sysconf(LONG_BIT);
++#ifdef _SC_LONG_BIT
+ if(sc==-1) sc = sysconf(_SC_LONG_BIT);
++#else
++ if(sc==-1) sc = (CHAR_BIT * sizeof(long));
++#endif
+ if(sc!=-1) system.setWidth(sc);
+
+ pushd(PROC_SYS);
diff --git a/repo/lshw/lshw.xibuild b/repo/lshw/lshw.xibuild
new file mode 100644
index 0000000..9316489
--- /dev/null
+++ b/repo/lshw/lshw.xibuild
@@ -0,0 +1,34 @@
+#!/bin/sh
+
+NAME="lshw"
+DESC="Hardware Lister"
+
+MAKEDEPS="sqlite3 linux-headers"
+
+PKG_VER=B.02.19.2
+SOURCE="https://ezix.org/software/files/lshw-$PKG_VER.tar.gz"
+
+ADDITIONAL="
+15565229509455527de9ce7cbb9530e2b31d043b.patch
+2b1c730b493d647bbab4854713571458e82a81e7.patch
+fix-musl-sc_long_bit.patch
+wrapper-for-basename.patch
+"
+
+prepare () {
+ apply_patches
+ sed -i 's/install -p/install/' src/Makefile
+}
+
+build() {
+ make RPM_OPT_FLAGS=-DNONLS
+}
+
+check() {
+ ./src/lshw -version
+}
+
+package() {
+ make DESTDIR="$PKG_DEST" install
+}
+
diff --git a/repo/lshw/wrapper-for-basename.patch b/repo/lshw/wrapper-for-basename.patch
new file mode 100644
index 0000000..dabfa79
--- /dev/null
+++ b/repo/lshw/wrapper-for-basename.patch
@@ -0,0 +1,107 @@
+From 49a2c103c7d1127045ced8e8c887279a36a3f357 Mon Sep 17 00:00:00 2001
+From: Felix Janda <felix.janda@posteo.de>
+Date: Wed, 12 Apr 2017 21:29:11 -0400
+Subject: [PATCH 1/2] Add wrapper for basename
+
+basename comes in two variants. A GNU and a POSIX version. Currently,
+the GNU version is mostly used, but this breaks compilation on systems
+without glibc.
+
+Switch to the portable version. Because this variant modifies its
+argument, similarly to dirname, a wrapper is needed.
+---
+ src/core/osutils.cc | 10 ++++++++++
+ src/core/osutils.h | 1 +
+ src/core/pci.cc | 4 ++--
+ src/core/sysfs.cc | 8 ++++----
+ 5 files changed, 19 insertions(+), 8 deletions(-)
+
+diff --git a/src/core/osutils.cc b/src/core/osutils.cc
+index e93b79e..1624ab1 100644
+--- a/src/core/osutils.cc
++++ b/src/core/osutils.cc
+@@ -426,6 +426,16 @@ string dirname(const string & path)
+ return result;
+ }
+
++string basename(const string & path)
++{
++ size_t len = path.length();
++ char *buffer = new char[len + 1];
++ path.copy(buffer, len);
++ buffer[len] = '\0';
++ string result = basename(buffer);
++ delete[] buffer;
++ return result;
++}
+
+ string spaces(unsigned int count, const string & space)
+ {
+diff --git a/src/core/osutils.h b/src/core/osutils.h
+index 549258e..55f5548 100644
+--- a/src/core/osutils.h
++++ b/src/core/osutils.h
+@@ -15,6 +15,7 @@ bool samefile(const std::string & path1, const std::string & path2);
+ std::string readlink(const std::string & path);
+ std::string realpath(const std::string & path);
+ std::string dirname(const std::string & path);
++std::string basename(const std::string & path);
+ bool loadfile(const std::string & file, std::vector < std::string > &lines);
+
+ size_t splitlines(const std::string & s,
+diff --git a/src/core/pci.cc b/src/core/pci.cc
+index d1625cf..1163ad2 100644
+--- a/src/core/pci.cc
++++ b/src/core/pci.cc
+@@ -1131,9 +1131,9 @@ bool scan_pci(hwNode & n)
+ string drivername = readlink(string(devices[i]->d_name)+"/driver");
+ string modulename = readlink(string(devices[i]->d_name)+"/driver/module");
+
+- device->setConfig("driver", basename(const_cast<char *>(drivername.c_str())));
++ device->setConfig("driver", basename(drivername));
+ if(exists(modulename))
+- device->setConfig("module", basename(const_cast<char *>(modulename.c_str())));
++ device->setConfig("module", basename(modulename));
+
+ if(exists(string(devices[i]->d_name)+"/rom"))
+ {
+diff --git a/src/core/sysfs.cc b/src/core/sysfs.cc
+index 97dbab5..0fc4855 100644
+--- a/src/core/sysfs.cc
++++ b/src/core/sysfs.cc
+@@ -99,7 +99,7 @@ static string sysfs_getbustype(const string & path)
+ {
+ devname =
+ string(fs.path + "/bus/") + string(namelist[i]->d_name) +
+- "/devices/" + basename(path.c_str());
++ "/devices/" + basename(path);
+
+ if (samefile(devname, path))
+ return string(namelist[i]->d_name);
+@@ -139,7 +139,7 @@ static string sysfstobusinfo(const string & path)
+
+ if (bustype == "virtio")
+ {
+- string name = basename(path.c_str());
++ string name = basename(path);
+ if (name.compare(0, 6, "virtio") == 0)
+ return "virtio@" + name.substr(6);
+ else
+@@ -207,7 +207,7 @@ string entry::driver() const
+ string driverlink = This->devpath + "/driver";
+ if (!exists(driverlink))
+ return "";
+- return basename(readlink(driverlink).c_str());
++ return basename(readlink(driverlink));
+ }
+
+
+@@ -288,7 +288,7 @@ string entry::name_in_class(const string & classname) const
+
+ string entry::name() const
+ {
+- return basename(This->devpath.c_str());
++ return basename(This->devpath);
+ }
+
+