Source: lshw
Version: 02.18-0.1
Severity: normal
Tags: upstream patch

Dear Maintainer,

the stretch version of lshw no longer shows the version information:

$ lshw -version
unknown

The reason is in lshw-B.02.18/src/core/version.cc: The versiontag
definition in line 13 contains a variable $URL$ that was expanded
to an URL in earlier versions, then getpackageversion() picked the
version number from that path (which is, err, interesting). This
no longer works and the code falls back to "unknown".

The patch attached changes getpackageversion to use a defined constant
that is picked from the lshw.spec file. By doing so you can also drop
the hard-coded line in debian/rules.

Afterwards:

$ lshw -version
B.02.18

Regards,
    Christoph

-- System Information:
Debian Release: stretch/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: amd64 (x86_64)

Kernel: Linux 4.9.0 (SMP w/4 CPU cores)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Init: unable to detect

diff --git a/debian/patches/restore-version-option.patch b/debian/patches/restore-version-option.patch
new file mode 100644
index 0000000..1c12ef1
--- /dev/null
+++ b/debian/patches/restore-version-option.patch
@@ -0,0 +1,26 @@
+Subject: Restore the -version command line option
+Author: Christoph Biedl <[email protected]>
+Forwarded: No
+
+--- a/lshw-B.02.18/src/core/version.cc
++++ b/lshw-B.02.18/src/core/version.cc
+@@ -27,6 +27,8 @@
+ 
+ const char *getpackageversion()
+ {
++  return UVERSION;
++
+   static char * result = NULL;
+   char * lastslash = NULL;
+ 
+--- a/lshw-B.02.18/src/Makefile
++++ b/lshw-B.02.18/src/Makefile
+@@ -20,7 +20,7 @@
+ 
+ CXX?=c++
+ INCLUDES=-I./core/
+-DEFINES=-DPREFIX=\"$(PREFIX)\" -DSBINDIR=\"$(SBINDIR)\" -DMANDIR=\"$(MANDIR)\" -DDATADIR=\"$(DATADIR)\"
++DEFINES=-DPREFIX=\"$(PREFIX)\" -DSBINDIR=\"$(SBINDIR)\" -DMANDIR=\"$(MANDIR)\" -DDATADIR=\"$(DATADIR)\" -DUVERSION=\"$(UVERSION)\"
+ #CXXFLAGS=-g -Wall -g $(INCLUDES) $(DEFINES) $(RPM_OPT_FLAGS)
+ CXXFLAGS=$(CXX_DEB_FLAGS) $(INCLUDES) $(DEFINES) 
+ ifeq ($(SQLITE), 1)
diff --git a/debian/patches/series b/debian/patches/series
index c4eb7c4..6c87466 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -11,3 +11,4 @@ spelling-error.patch
 fix-manpage.patch
 Avoid-crash-in-scan_dmi_sysfs-when-running-as-non-ro.patch
 fix-width-handling.patch
+restore-version-option.patch
diff --git a/debian/rules b/debian/rules
index e1c7189..1fad8d0 100755
--- a/debian/rules
+++ b/debian/rules
@@ -26,8 +26,8 @@ ifeq ($(DEB_BUILD_GNU_TYPE),alpha-linux-gnu)
 endif
 
 
-uver=B.02.18
-srcdir=lshw-$(uver)/src
+export UVERSION=$(shell awk '($$1=="Version:"){print $$2}' lshw.spec | head -1)
+srcdir=lshw-$(UVERSION)/src
 
 configure: configure-stamp
 configure-stamp:

Attachment: signature.asc
Description: Digital signature

Reply via email to