From 011204d96366bd8ca9e46e63a9edcb3a064a495f Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Fri, 20 Jul 2018 12:06:11 +0000 Subject: [PATCH] fireinfo: Import latest patches Signed-off-by: Michael Tremer --- lfs/fireinfo | 3 ++ ...-proc-cpuinfo-doesn-t-have-any-infor.patch | 34 +++++++++++++++++++ ...e-any-systems-with-ID-Default-string.patch | 25 ++++++++++++++ 3 files changed, 62 insertions(+) create mode 100644 src/patches/fireinfo-Don-t-crash-when-proc-cpuinfo-doesn-t-have-any-infor.patch create mode 100644 src/patches/fireinfo-Ignore-any-systems-with-ID-Default-string.patch diff --git a/lfs/fireinfo b/lfs/fireinfo index dec588705d..784685029d 100644 --- a/lfs/fireinfo +++ b/lfs/fireinfo @@ -71,6 +71,9 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects)) @$(PREBUILD) @rm -rf $(DIR_APP) && cd $(DIR_SRC) && tar zxf $(DIR_DL)/$(DL_FILE) + cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/fireinfo-Don-t-crash-when-proc-cpuinfo-doesn-t-have-any-infor.patch + cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/fireinfo-Ignore-any-systems-with-ID-Default-string.patch + cd $(DIR_APP) && [ -x "configure" ] || sh ./autogen.sh cd $(DIR_APP) && ./configure --prefix=/usr cd $(DIR_APP) && make $(MAKETUNING) diff --git a/src/patches/fireinfo-Don-t-crash-when-proc-cpuinfo-doesn-t-have-any-infor.patch b/src/patches/fireinfo-Don-t-crash-when-proc-cpuinfo-doesn-t-have-any-infor.patch new file mode 100644 index 0000000000..a99c618e99 --- /dev/null +++ b/src/patches/fireinfo-Don-t-crash-when-proc-cpuinfo-doesn-t-have-any-infor.patch @@ -0,0 +1,34 @@ +From e2b6025dea547bf8de4bd2b8056f2a8227c635f5 Mon Sep 17 00:00:00 2001 +From: Michael Tremer +Date: Wed, 13 Jun 2018 20:56:41 +0200 +Subject: [PATCH 1/2] Don't crash when /proc/cpuinfo doesn't have any + information + +Signed-off-by: Michael Tremer +--- + src/fireinfo/cpu.py | 9 +++++---- + 1 file changed, 5 insertions(+), 4 deletions(-) + +diff --git a/src/fireinfo/cpu.py b/src/fireinfo/cpu.py +index 541575a..dc76caf 100644 +--- a/src/fireinfo/cpu.py ++++ b/src/fireinfo/cpu.py +@@ -108,10 +108,11 @@ class CPU(object): + """ + Return the model string of this CPU. + """ +- try: +- return self.__cpuinfo["model_name"] +- except KeyError: +- return self.__cpuinfo["Processor"] ++ for key in ("model_name", "Processor"): ++ try: ++ return self.__cpuinfo[key] ++ except KeyError: ++ pass + + @property + def vendor(self): +-- +2.12.2 + diff --git a/src/patches/fireinfo-Ignore-any-systems-with-ID-Default-string.patch b/src/patches/fireinfo-Ignore-any-systems-with-ID-Default-string.patch new file mode 100644 index 0000000000..ace5d0133d --- /dev/null +++ b/src/patches/fireinfo-Ignore-any-systems-with-ID-Default-string.patch @@ -0,0 +1,25 @@ +From d1f6789178e141664895332af79dbe7aa9e5ab68 Mon Sep 17 00:00:00 2001 +From: Michael Tremer +Date: Wed, 13 Jun 2018 20:58:42 +0200 +Subject: [PATCH 2/2] Ignore any systems with ID "Default string" + +Signed-off-by: Michael Tremer +--- + src/fireinfo/system.py | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/fireinfo/system.py b/src/fireinfo/system.py +index e3295af..73c3882 100644 +--- a/src/fireinfo/system.py ++++ b/src/fireinfo/system.py +@@ -42,6 +42,7 @@ INVALID_ID_STRINGS = ( + "N/A", "n/a", + "12345", "54321", "202020", + "Chassis", "chassis", ++ "Default string", + "EVAL", + "Not Applicable", + "None", "empty", +-- +2.12.2 + -- 2.39.2