git: aa469725eb9a - main - sysutils/parallel: Fix --number-of-cores

From: Po-Chuan Hsieh <sunpoet_at_FreeBSD.org>
Date: Mon, 25 Dec 2023 09:11:37 UTC
The branch main has been updated by sunpoet:

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

commit aa469725eb9acf665d738ca24ce02730a459eddb
Author:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
AuthorDate: 2023-12-25 09:03:07 +0000
Commit:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
CommitDate: 2023-12-25 09:03:07 +0000

    sysutils/parallel: Fix --number-of-cores
    
    - Bump PORTREVISION for package change
    
    PR:             268011
    Reported by:    jwb
---
 sysutils/parallel/Makefile                 |  1 +
 sysutils/parallel/files/patch-src-parallel | 18 ++++++++++++++++++
 2 files changed, 19 insertions(+)

diff --git a/sysutils/parallel/Makefile b/sysutils/parallel/Makefile
index f909c0ad9a57..c82ffddc26e6 100644
--- a/sysutils/parallel/Makefile
+++ b/sysutils/parallel/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	parallel
 PORTVERSION=	20231122
+PORTREVISION=	1
 CATEGORIES=	sysutils
 MASTER_SITES=	GNU
 
diff --git a/sysutils/parallel/files/patch-src-parallel b/sysutils/parallel/files/patch-src-parallel
new file mode 100644
index 000000000000..b0a1e33b811b
--- /dev/null
+++ b/sysutils/parallel/files/patch-src-parallel
@@ -0,0 +1,18 @@
+--- src/parallel.orig	2023-11-23 00:27:43 UTC
++++ src/parallel
+@@ -8704,13 +8704,9 @@ sub sct_freebsd($) {
+     local $/ = "\n";
+     my $cpu = shift;
+     $cpu->{'cores'} ||=
+-	(::qqx(qq{ sysctl -a dev.cpu | grep \%parent | awk '{ print \$2 }' | uniq | wc -l | awk '{ print \$1 }' })
+-	 or
+-	 ::qqx(qq{ sysctl hw.ncpu | awk '{ print \$2 }' }));
++	::qqx(qq{ sysctl kern.smp.cores | awk '{ print \$2 }' });
+     $cpu->{'threads'} ||=
+-	(::qqx(qq{ sysctl hw.ncpu | awk '{ print \$2 }' })
+-	 or
+-	 ::qqx(qq{ sysctl -a dev.cpu | grep \%parent | awk '{ print \$2 }' | uniq | wc -l | awk '{ print \$1 }' }));
++	::qqx(qq{ sysctl kern.smp.cpus | awk '{ print \$2 }' });
+     return $cpu;
+ }
+