git: 854533b69789 - main - net-mgmt/ocsinventory-agent: Fix cpu detection

From: Mikael Urankar <mikael_at_FreeBSD.org>
Date: Tue, 12 Nov 2024 14:41:42 UTC
The branch main has been updated by mikael:

URL: https://cgit.FreeBSD.org/ports/commit/?id=854533b69789dd41fb97984079c73eaa32db2531

commit 854533b69789dd41fb97984079c73eaa32db2531
Author:     Mikael Urankar <mikael@FreeBSD.org>
AuthorDate: 2024-11-12 14:37:27 +0000
Commit:     Mikael Urankar <mikael@FreeBSD.org>
CommitDate: 2024-11-12 14:41:39 +0000

    net-mgmt/ocsinventory-agent: Fix cpu detection
    
    Fix typo, NBSOCKETS isn't defined
    
    Reported by:            Carlos Fernando Assis Paniago
    Tested by:              Carlos Fernando Assis Paniago
---
 net-mgmt/ocsinventory-agent/Makefile                        |  1 +
 .../patch-lib_Ocsinventory_Agent_Backend_OS_BSD_CPU.pm      | 13 +++++++++++++
 2 files changed, 14 insertions(+)

diff --git a/net-mgmt/ocsinventory-agent/Makefile b/net-mgmt/ocsinventory-agent/Makefile
index 9c8c0509bdf0..0572ca8f9a90 100644
--- a/net-mgmt/ocsinventory-agent/Makefile
+++ b/net-mgmt/ocsinventory-agent/Makefile
@@ -1,6 +1,7 @@
 PORTNAME=	ocsinventory
 PORTVERSION=	2.10.4
 DISTVERSIONPREFIX=	v
+PORTREVISION=	1
 PORTEPOCH=	1
 CATEGORIES=	net-mgmt
 PKGNAMESUFFIX=	-agent
diff --git a/net-mgmt/ocsinventory-agent/files/patch-lib_Ocsinventory_Agent_Backend_OS_BSD_CPU.pm b/net-mgmt/ocsinventory-agent/files/patch-lib_Ocsinventory_Agent_Backend_OS_BSD_CPU.pm
new file mode 100644
index 000000000000..75d5c0457489
--- /dev/null
+++ b/net-mgmt/ocsinventory-agent/files/patch-lib_Ocsinventory_Agent_Backend_OS_BSD_CPU.pm
@@ -0,0 +1,13 @@
+--- lib/Ocsinventory/Agent/Backend/OS/BSD/CPU.pm.orig	2024-11-12 14:35:48 UTC
++++ lib/Ocsinventory/Agent/Backend/OS/BSD/CPU.pm
+@@ -64,8 +64,8 @@ sub run {
+     if ($cpu->{NBSOCKET} and $cpu->{CORES} and $cpu->{THREADS} ){
+         if ($cpu->{THREADS} >= $cpu->{CORES}) {
+             $cpu->{THREADS}=$cpu->{THREADS}/$cpu->{CORES};
+-        } elsif ($cpu->{THREADS} >= $cpu->{NBSOCKETS}) {
+-            $cpu->{THREADS}=$cpu->{THREADS}/$cpu->{NBSOCKETS};
++        } elsif ($cpu->{THREADS} >= $cpu->{NBSOCKET}) {
++            $cpu->{THREADS}=$cpu->{THREADS}/$cpu->{NBSOCKET};
+         }
+     }
+