commit:     3a3a765766793f84b88c98c8b1620d915278ac9d
Author:     jinqiang zhang <peeweep <AT> 0x0 <DOT> ee>
AuthorDate: Thu Nov 17 05:30:41 2022 +0000
Commit:     Joonas Niilola <juippis <AT> gentoo <DOT> org>
CommitDate: Wed Nov 23 17:55:08 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3a3a7657

app-misc/neofetch: fix cpu model detect on arm, riscv, loongarch

Closes: https://bugs.gentoo.org/881591
Upstream: https://github.com/dylanaraps/neofetch/pull/2139
Signed-off-by: jinqiang zhang <peeweep <AT> 0x0.ee>
Closes: https://github.com/gentoo/gentoo/pull/28305
Signed-off-by: Joonas Niilola <juippis <AT> gentoo.org>

 ...x-arm-riscv-loongarch-cpu-model-detection.patch | 35 ++++++++++++++++++++++
 app-misc/neofetch/neofetch-7.1.0-r1.ebuild         |  4 +++
 app-misc/neofetch/neofetch-7.1.0.ebuild            |  4 +++
 app-misc/neofetch/neofetch-9999.ebuild             |  4 +++
 4 files changed, 47 insertions(+)

diff --git 
a/app-misc/neofetch/files/neofetch-7.1.0-fix-arm-riscv-loongarch-cpu-model-detection.patch
 
b/app-misc/neofetch/files/neofetch-7.1.0-fix-arm-riscv-loongarch-cpu-model-detection.patch
new file mode 100644
index 000000000000..43442dc7689f
--- /dev/null
+++ 
b/app-misc/neofetch/files/neofetch-7.1.0-fix-arm-riscv-loongarch-cpu-model-detection.patch
@@ -0,0 +1,35 @@
+https://github.com/dylanaraps/neofetch/pull/2139
+
+diff --git a/neofetch b/neofetch
+index 1e4b5646..78babd0b 100755
+--- a/neofetch
++++ b/neofetch
+@@ -2086,9 +2086,18 @@ get_cpu() {
+                     [[ -z "$cpu" ]] && cpu="$(awk -F':' '/family/ {printf $2; 
exit}' "$cpu_file")"
+                 ;;
+ 
++                "arm"* | "aarch64")
++                    if [[ $(trim "$distro") == Android* ]]; then
++                    # Android roms have modified cpuinfo that shows CPU model 
as a string
++                        cpu="$(awk -F':' '/Hardware/ {print $2; exit}' 
"$cpu_file")"
++                    else
++                        cpu="$(lscpu | awk -F': ' '/Vendor ID/ {print $2; 
exit}' ) $(lscpu | awk -F': ' '/Model name/ {print $2; exit}')"
++                    fi
++                ;;
++
+                 *)
+                     cpu="$(awk -F '\\s*: | @' \
+-                            '/model name|Hardware|Processor|^cpu model|chip 
type|^cpu type/ {
++                            '/model name|Model|uarch|Hardware|Processor|^cpu 
model|chip type|^cpu type/ {
+                             cpu=$2; if ($1 == "Hardware") exit } END { print 
cpu }' "$cpu_file")"
+                 ;;
+             esac
+@@ -2286,7 +2295,7 @@ get_cpu() {
+     cpu="${cpu//, * Compute Cores}"
+     cpu="${cpu//Core / }"
+     cpu="${cpu//(\"AuthenticAMD\"*)}"
+-    cpu="${cpu//with Radeon * Graphics}"
++    cpu="${cpu//with Radeon*Graphics}"
+     cpu="${cpu//, altivec supported}"
+     cpu="${cpu//FPU*}"
+     cpu="${cpu//Chip Revision*}"

diff --git a/app-misc/neofetch/neofetch-7.1.0-r1.ebuild 
b/app-misc/neofetch/neofetch-7.1.0-r1.ebuild
index a95947200ffa..9a06d763e8b9 100644
--- a/app-misc/neofetch/neofetch-7.1.0-r1.ebuild
+++ b/app-misc/neofetch/neofetch-7.1.0-r1.ebuild
@@ -18,6 +18,10 @@ HOMEPAGE="https://github.com/dylanaraps/neofetch";
 LICENSE="MIT-with-advertising"
 SLOT="0"
 
+PATCHES=(
+       "${FILESDIR}"/${P}-fix-arm-riscv-loongarch-cpu-model-detection.patch
+)
+
 src_prepare() {
        if use prefix; then
                # bug #693526

diff --git a/app-misc/neofetch/neofetch-7.1.0.ebuild 
b/app-misc/neofetch/neofetch-7.1.0.ebuild
index 864cc9203b4c..aa21d63f1a9a 100644
--- a/app-misc/neofetch/neofetch-7.1.0.ebuild
+++ b/app-misc/neofetch/neofetch-7.1.0.ebuild
@@ -29,6 +29,10 @@ RDEPEND="sys-apps/pciutils
                x11-apps/xwininfo
        )"
 
+PATCHES=(
+       "${FILESDIR}"/${P}-fix-arm-riscv-loongarch-cpu-model-detection.patch
+)
+
 src_prepare() {
        if use prefix; then
                # bug #693526

diff --git a/app-misc/neofetch/neofetch-9999.ebuild 
b/app-misc/neofetch/neofetch-9999.ebuild
index cc85a3afcd91..7f7fde51975a 100644
--- a/app-misc/neofetch/neofetch-9999.ebuild
+++ b/app-misc/neofetch/neofetch-9999.ebuild
@@ -18,6 +18,10 @@ HOMEPAGE="https://github.com/dylanaraps/neofetch";
 LICENSE="MIT-with-advertising"
 SLOT="0"
 
+PATCHES=(
+       
"${FILESDIR}"/neofetch-7.1.0-fix-arm-riscv-loongarch-cpu-model-detection.patch
+)
+
 src_prepare() {
        if use prefix; then
                # bug #693526

Reply via email to