From 9ae65c8e08344b1d9efb34c6604a6746ee4a77d2 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Tue, 18 May 2021 13:52:11 +0000 Subject: [PATCH] fireinfo: Update to 2.2.0 This release ports fireinfo to Python 3 Signed-off-by: Michael Tremer --- config/rootfiles/common/fireinfo | 38 ++++-------- config/rootfiles/core/158/filelists/fireinfo | 1 + lfs/fireinfo | 11 +--- src/patches/fireinfo-2.2.0-python-3.8.patch | 26 ++++++++ ...-proc-cpuinfo-doesn-t-have-any-infor.patch | 34 ----------- ...e-any-systems-with-ID-Default-string.patch | 25 -------- ...t-upstream-proxy-with-authentication.patch | 61 ------------------- 7 files changed, 42 insertions(+), 154 deletions(-) create mode 120000 config/rootfiles/core/158/filelists/fireinfo create mode 100644 src/patches/fireinfo-2.2.0-python-3.8.patch delete mode 100644 src/patches/fireinfo-Don-t-crash-when-proc-cpuinfo-doesn-t-have-any-infor.patch delete mode 100644 src/patches/fireinfo-Ignore-any-systems-with-ID-Default-string.patch delete mode 100644 src/patches/fireinfo-support-upstream-proxy-with-authentication.patch diff --git a/config/rootfiles/common/fireinfo b/config/rootfiles/common/fireinfo index a4e209f941..11f4729438 100644 --- a/config/rootfiles/common/fireinfo +++ b/config/rootfiles/common/fireinfo @@ -1,27 +1,13 @@ usr/bin/sendprofile -usr/lib/python2.7/site-packages/fireinfo -usr/lib/python2.7/site-packages/fireinfo/__init__.py -usr/lib/python2.7/site-packages/fireinfo/__init__.pyc -usr/lib/python2.7/site-packages/fireinfo/__init__.pyo -#usr/lib/python2.7/site-packages/fireinfo/_fireinfo.la -usr/lib/python2.7/site-packages/fireinfo/_fireinfo.so -usr/lib/python2.7/site-packages/fireinfo/bios.py -usr/lib/python2.7/site-packages/fireinfo/bios.pyc -usr/lib/python2.7/site-packages/fireinfo/bios.pyo -usr/lib/python2.7/site-packages/fireinfo/cpu.py -usr/lib/python2.7/site-packages/fireinfo/cpu.pyc -usr/lib/python2.7/site-packages/fireinfo/cpu.pyo -usr/lib/python2.7/site-packages/fireinfo/device.py -usr/lib/python2.7/site-packages/fireinfo/device.pyc -usr/lib/python2.7/site-packages/fireinfo/device.pyo -usr/lib/python2.7/site-packages/fireinfo/hypervisor.py -usr/lib/python2.7/site-packages/fireinfo/hypervisor.pyc -usr/lib/python2.7/site-packages/fireinfo/hypervisor.pyo -usr/lib/python2.7/site-packages/fireinfo/network.py -usr/lib/python2.7/site-packages/fireinfo/network.pyc -usr/lib/python2.7/site-packages/fireinfo/network.pyo -usr/lib/python2.7/site-packages/fireinfo/system.py -usr/lib/python2.7/site-packages/fireinfo/system.pyc -usr/lib/python2.7/site-packages/fireinfo/system.pyo -usr/share/doc/fireinfo -usr/share/doc/fireinfo/COPYING +#usr/lib/python3.8/site-packages/fireinfo +usr/lib/python3.8/site-packages/fireinfo/__init__.py +#usr/lib/python3.8/site-packages/fireinfo/_fireinfo.la +usr/lib/python3.8/site-packages/fireinfo/_fireinfo.so +usr/lib/python3.8/site-packages/fireinfo/bios.py +usr/lib/python3.8/site-packages/fireinfo/cpu.py +usr/lib/python3.8/site-packages/fireinfo/device.py +usr/lib/python3.8/site-packages/fireinfo/hypervisor.py +usr/lib/python3.8/site-packages/fireinfo/network.py +usr/lib/python3.8/site-packages/fireinfo/system.py +#usr/share/doc/fireinfo +#usr/share/doc/fireinfo/COPYING diff --git a/config/rootfiles/core/158/filelists/fireinfo b/config/rootfiles/core/158/filelists/fireinfo new file mode 120000 index 0000000000..c46115521f --- /dev/null +++ b/config/rootfiles/core/158/filelists/fireinfo @@ -0,0 +1 @@ +../../../common/fireinfo \ No newline at end of file diff --git a/lfs/fireinfo b/lfs/fireinfo index 2e6d1e94c9..7014cbc4c3 100644 --- a/lfs/fireinfo +++ b/lfs/fireinfo @@ -24,7 +24,7 @@ include Config -VER = 2.1.12 +VER = 2.2.0 THISAPP = fireinfo-v$(VER) DL_FILE = $(THISAPP).tar.gz @@ -40,7 +40,7 @@ objects = $(DL_FILE) $(DL_FILE) = $(DL_FROM)/$(DL_FILE) -$(DL_FILE)_MD5 = 40ada8f4eceeb69661d09e43308e5a6a +$(DL_FILE)_MD5 = 34cd6041bf9b9882c2a356a47ad1e000 install : $(TARGET) @@ -70,15 +70,10 @@ $(subst %,%_MD5,$(objects)) : $(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) && patch -Np1 < $(DIR_SRC)/src/patches/fireinfo-support-upstream-proxy-with-authentication.patch - + cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/fireinfo-2.2.0-python-3.8.patch cd $(DIR_APP) && [ -x "configure" ] || sh ./autogen.sh cd $(DIR_APP) && ./configure --prefix=/usr cd $(DIR_APP) && make $(MAKETUNING) cd $(DIR_APP) && make install - @rm -rf $(DIR_APP) @$(POSTBUILD) diff --git a/src/patches/fireinfo-2.2.0-python-3.8.patch b/src/patches/fireinfo-2.2.0-python-3.8.patch new file mode 100644 index 0000000000..ca0e6843b9 --- /dev/null +++ b/src/patches/fireinfo-2.2.0-python-3.8.patch @@ -0,0 +1,26 @@ +From 1d70d3cbf7e1fe1e1f0760e9a79e520e416519fe Mon Sep 17 00:00:00 2001 +From: Michael Tremer +Date: Tue, 18 May 2021 13:40:51 +0000 +Subject: [PATCH] python: Fix linking against Python 3.8 + +Signed-off-by: Michael Tremer +--- + configure.ac | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/configure.ac b/configure.ac +index ede2cb6..6efe73c 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -91,7 +91,7 @@ AC_SUBST([OUR_LDFLAGS], $with_ldflags) + + # Python + AM_PATH_PYTHON([3.7]) +-PKG_CHECK_MODULES([PYTHON_DEVEL], [python-${PYTHON_VERSION}]) ++PKG_CHECK_MODULES([PYTHON_DEVEL], [python-${PYTHON_VERSION}-embed python-${PYTHON_VERSION}]) + + AC_CONFIG_FILES([ + Makefile +-- +2.20.1 + 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 deleted file mode 100644 index a99c618e99..0000000000 --- a/src/patches/fireinfo-Don-t-crash-when-proc-cpuinfo-doesn-t-have-any-infor.patch +++ /dev/null @@ -1,34 +0,0 @@ -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 deleted file mode 100644 index ace5d0133d..0000000000 --- a/src/patches/fireinfo-Ignore-any-systems-with-ID-Default-string.patch +++ /dev/null @@ -1,25 +0,0 @@ -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 - diff --git a/src/patches/fireinfo-support-upstream-proxy-with-authentication.patch b/src/patches/fireinfo-support-upstream-proxy-with-authentication.patch deleted file mode 100644 index 1e5a986556..0000000000 --- a/src/patches/fireinfo-support-upstream-proxy-with-authentication.patch +++ /dev/null @@ -1,61 +0,0 @@ -From 74c5e2adc61548900e256c3e58a0a63f5b3c2a4f Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Peter=20M=C3=BCller?= -Date: Tue, 4 Dec 2018 18:13:15 +0100 -Subject: [PATCH] fireinfo: support upstream proxy with authentication -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Fireinfo could not send its profile to https://fireinfo.ipfire.org/ -if the machine is behind an upstream proxy which requires username -and password. This is fixed by tweaking urllib2's opening handler. - -To apply this on existing installations, the fireinfo package -needs to be shipped during an update. - -The third version of this patch fixes bogus indention, assembles -proxy authentication string more readable and preserves HTTP -proxy handler. - -Fixes #11905 - -Signed-off-by: Peter Müller -Cc: Michael Tremer -Signed-off-by: Michael Tremer ---- - src/sendprofile | 14 ++++++++++++-- - 1 file changed, 12 insertions(+), 2 deletions(-) - mode change 100644 => 100755 src/sendprofile - -diff --git a/src/sendprofile b/src/sendprofile -old mode 100644 -new mode 100755 -index b836567..3ce68b9 ---- a/src/sendprofile -+++ b/src/sendprofile -@@ -73,10 +73,20 @@ def send_profile(profile): - request.add_header("User-Agent", "fireinfo/%s" % fireinfo.__version__) - - # Set upstream proxy if we have one. -- # XXX this cannot handle authentication - proxy = get_upstream_proxy() -+ - if proxy["host"]: -- request.set_proxy(proxy["host"], "http") -+ # handling upstream proxies with authentication is more tricky... -+ if proxy["user"] and proxy["pass"]: -+ prx_auth_string = "http://%s:%s@%s/" % (proxy["user"], proxy["pass"], proxy["host"]) -+ -+ proxy_handler = urllib2.ProxyHandler({'http': prx_auth_string, 'https': prx_auth_string}) -+ auth = urllib2.HTTPBasicAuthHandler() -+ opener = urllib2.build_opener(proxy_handler, auth, urllib2.HTTPHandler) -+ urllib2.install_opener(opener) -+ else: -+ request.set_proxy(proxy["host"], "http") -+ request.set_proxy(proxy["host"], "https") - - try: - urllib2.urlopen(request, timeout=60) --- -2.6.3 - -- 2.39.2