Adds the Hardware Lister package to ptxdist
A patch is added for the package to make the xml output
compatibility with a xml-parser using tinyxpath.

Signed-off-by: Bart vdr. Meulen <[email protected]>
Signed-off-by: Remy Bohmer <[email protected]>
---
 patches/lshw-B.02.14/fix-cross-compile.patch       |   43 ++++++++++
 .../replace_reserved_xml_keyword.patch             |   33 ++++++++
 patches/lshw-B.02.14/series                        |    2 +
 rules/lshw.in                                      |   21 +++++
 rules/lshw.make                                    |   85 ++++++++++++++++++++
 5 files changed, 184 insertions(+), 0 deletions(-)
 create mode 100644 patches/lshw-B.02.14/fix-cross-compile.patch
 create mode 100644 patches/lshw-B.02.14/replace_reserved_xml_keyword.patch
 create mode 100644 patches/lshw-B.02.14/series
 create mode 100644 rules/lshw.in
 create mode 100644 rules/lshw.make

diff --git a/patches/lshw-B.02.14/fix-cross-compile.patch 
b/patches/lshw-B.02.14/fix-cross-compile.patch
new file mode 100644
index 0000000..bfcce62
--- /dev/null
+++ b/patches/lshw-B.02.14/fix-cross-compile.patch
@@ -0,0 +1,43 @@
+fix cross-compilation
+
+Signed-off-by: Remy Bohmer <[email protected]>
+---
+ src/Makefile |   10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+Index: lshw-B.02.14/src/Makefile
+===================================================================
+--- lshw-B.02.14.orig/src/Makefile
++++ lshw-B.02.14/src/Makefile
+@@ -18,10 +18,10 @@ export DATADIR
+ CXX?=c++
+ INCLUDES=-I./core/
+ DEFINES=-DPREFIX=\"$(PREFIX)\" -DSBINDIR=\"$(SBINDIR)\" 
-DMANDIR=\"$(MANDIR)\" -DDATADIR=\"$(DATADIR)\"
+-CXXFLAGS=-g -Wall -g $(INCLUDES) $(DEFINES) $(RPM_OPT_FLAGS)
+-LDFLAGS=-L./core/ -g
++CXXFLAGS= ${CPPFLAGS} -g -Wall -g $(INCLUDES) $(DEFINES) $(RPM_OPT_FLAGS)
++MYLDFLAGS:= ${LDFLAGS} -L./core/ -g
+ ifneq ($(shell $(LD) --help 2| grep -- --as-needed), )
+-      LDFLAGS+= -Wl,--as-needed
++      MYLDFLAGS+= -Wl,--as-needed
+ endif
+ LDSTATIC=-static
+ LIBS=-llshw -lresolv
+@@ -38,7 +38,7 @@ core:
+       +make -C core all
+ 
+ $(PACKAGENAME): core $(PACKAGENAME).o
+-      $(CXX) $(LDFLAGS) -o $@ $(PACKAGENAME).o $(LIBS)
++      $(CXX) $(MYLDFLAGS) -o $@ $(PACKAGENAME).o $(LIBS)
+ 
+ .PHONY: gui
+ gui: core
+@@ -52,7 +52,7 @@ nologo:
+ static: $(PACKAGENAME)-static
+ 
+ $(PACKAGENAME)-static: core core/lib$(PACKAGENAME).a $(PACKAGENAME).o
+-      $(CXX) $(LDSTATIC) $(LDFLAGS) -o $@ $(PACKAGENAME).o $(LIBS)
++      $(CXX) $(LDSTATIC) $(MYLDFLAGS) -o $@ $(PACKAGENAME).o $(LIBS)
+       $(STRIP) $@
+ 
+ .PHONY: compressed
diff --git a/patches/lshw-B.02.14/replace_reserved_xml_keyword.patch 
b/patches/lshw-B.02.14/replace_reserved_xml_keyword.patch
new file mode 100644
index 0000000..f508ce7
--- /dev/null
+++ b/patches/lshw-B.02.14/replace_reserved_xml_keyword.patch
@@ -0,0 +1,33 @@
+Replace keyword node with hwnode for TinyXpath compatibility
+
+It turns out that within TinyXpath 'node' is a reserved key-word.
+Replace it with 'hwnode' when printing to xml.
+
+Signed-off-by: Bart vdr. Meulen <[email protected]>
+Signed-off-by: Remy Bohmer <[email protected]>
+---
+ src/core/hw.cc |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+Index: lshw-B.02.14/src/core/hw.cc
+===================================================================
+--- lshw-B.02.14.orig/src/core/hw.cc   2009-10-14 14:49:33.000000000 +0200
++++ lshw-B.02.14/src/core/hw.cc        2009-10-14 14:49:49.000000000 +0200
+@@ -1343,7 +1343,7 @@ string hwNode::asXML(unsigned level)
+   if(visible(getClassName()))
+   {
+     out << spaces(2*level);
+-    out << "<node id=\"" << getId() << "\"";
++    out << "<hwnode id=\"" << getId() << "\"";
+     if (disabled())
+       out << " disabled=\"true\"";
+     if (claimed())
+@@ -1596,7 +1596,7 @@ string hwNode::asXML(unsigned level)
+   if(visible(getClassName()))
+   {
+     out << spaces(2*level);
+-    out << "</node>" << endl;
++    out << "</hwnode>" << endl;
+   }
+
+   return out.str();
diff --git a/patches/lshw-B.02.14/series b/patches/lshw-B.02.14/series
new file mode 100644
index 0000000..4b21b99
--- /dev/null
+++ b/patches/lshw-B.02.14/series
@@ -0,0 +1,2 @@
+fix-cross-compile.patch
+replace_reserved_xml_keyword.patch
diff --git a/rules/lshw.in b/rules/lshw.in
new file mode 100644
index 0000000..bdfe968
--- /dev/null
+++ b/rules/lshw.in
@@ -0,0 +1,21 @@
+## SECTION=shell_and_console
+
+menuconfig LSHW
+       tristate
+       prompt "lshw                         "
+       select GTK if LSHW_GUI
+       help
+         lshw (Hardware Lister) is a small tool to provide detailed information
+         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.
+
+if LSHW
+
+config LSHW_GUI
+       bool
+       default n
+       prompt "install GUI"
+
+endif
+
diff --git a/rules/lshw.make b/rules/lshw.make
new file mode 100644
index 0000000..388f213
--- /dev/null
+++ b/rules/lshw.make
@@ -0,0 +1,85 @@
+# -*-makefile-*-
+#
+# Copyright (C) 2010 by Bart vdr. Meulen <[email protected]>
+#
+# See CREDITS for details about who has contributed to this project.
+#
+# For further information about the PTXdist project and license conditions
+# see the README file.
+#
+
+#
+# We provide this package
+#
+PACKAGES-$(PTXCONF_LSHW) += lshw
+
+#
+# Paths and names
+#
+LSHW_VERSION   := B.02.14
+LSHW           := lshw-$(LSHW_VERSION)
+LSHW_SUFFIX    := tar.gz
+LSHW_URL       := http://www.ezix.org/software/files/$(LSHW).$(LSHW_SUFFIX)
+LSHW_SOURCE    := $(SRCDIR)/$(LSHW).$(LSHW_SUFFIX)
+LSHW_DIR       := $(BUILDDIR)/$(LSHW)
+LSHW_LICENSE   := GPLv2
+
+# ----------------------------------------------------------------------------
+# Get
+# ----------------------------------------------------------------------------
+
+$(LSHW_SOURCE):
+       @$(call targetinfo)
+       @$(call get, LSHW)
+
+# ----------------------------------------------------------------------------
+# Prepare
+# ----------------------------------------------------------------------------
+
+LSHW_CONF_TOOL         := NO
+LSHW_MAKE_OPT          := $(CROSS_ENV) all
+LSHW_INSTALL_OPT       := $(CROSS_ENV) install
+ifdef PTXCONF_LSHW_GUI
+LSHW_MAKE_OPT          += gui
+LSHW_INSTALL_OPT       += install-gui
+endif
+
+# ----------------------------------------------------------------------------
+# Target-Install
+# ----------------------------------------------------------------------------
+
+$(STATEDIR)/lshw.targetinstall:
+       @$(call targetinfo)
+
+       @$(call install_init,  lshw)
+       @$(call install_fixup, lshw,PACKAGE,lshw)
+       @$(call install_fixup, lshw,PRIORITY,optional)
+       @$(call install_fixup, lshw,VERSION,$(LSHW_VERSION))
+       @$(call install_fixup, lshw,SECTION,base)
+       @$(call install_fixup, lshw,AUTHOR,"Bart vdr. Meulen 
<[email protected]>")
+       @$(call install_fixup, lshw,DEPENDS,)
+       @$(call install_fixup, lshw,DESCRIPTION,missing)
+
+       @$(call install_copy, lshw, 0, 0, 0755, -, /usr/sbin/lshw)
+
+       @$(call install_copy, lshw, 0, 0, 0755, /usr/share/lshw)
+       @$(call install_copy, lshw, 0, 0, 0644, -, /usr/share/lshw/pci.ids)
+       @$(call install_copy, lshw, 0, 0, 0644, -, /usr/share/lshw/usb.ids)
+       @$(call install_copy, lshw, 0, 0, 0644, -, /usr/share/lshw/oui.txt)
+       @$(call install_copy, lshw, 0, 0, 0644, -, /usr/share/lshw/manuf.txt)
+
+ifdef PTXCONF_LSHW_GUI
+       @$(call install_copy, lshw, 0, 0, 0755, -, /usr/sbin/gtk-lshw)
+
+       @$(call install_copy, lshw, 0, 0, 0755, /usr/share/lshw/artwork)
+       @cd $(LSHW_PKGDIR)/usr/share/lshw/artwork; \
+       for file in * ; do \
+               $(call install_copy, lshw, 0, 0, 0644, -, \
+                       /usr/share/lshw/artwork/$$file); \
+       done
+endif
+
+       @$(call install_finish, lshw)
+       @$(call touch)
+
+# vim: syntax=make
-- 
1.7.0.4


-- 
ptxdist mailing list
[email protected]

Reply via email to