add 0013-cpuinfo-in-arm-system-is-null.patch
(cherry picked from commit 4829849dea8056eb79b5a7860a3ef63f6e519f87)
This commit is contained in:
parent
1238cec26a
commit
d93b023cc9
68
0013-cpuinfo-in-arm-system-is-null.patch
Normal file
68
0013-cpuinfo-in-arm-system-is-null.patch
Normal file
@ -0,0 +1,68 @@
|
||||
From b225b7a8b8cb4421fcfa81e4fc985bcf6ec1c59d Mon Sep 17 00:00:00 2001
|
||||
From: peijiankang <peijiankang@kylinos.cn>
|
||||
Date: Sat, 11 Sep 2021 15:29:44 +0800
|
||||
Subject: [PATCH] cpuinfo in arm system is null
|
||||
|
||||
---
|
||||
plugins/messages-task/about/cpuinfo.cpp | 37 +++++++++++++------------
|
||||
1 file changed, 19 insertions(+), 18 deletions(-)
|
||||
|
||||
diff --git a/plugins/messages-task/about/cpuinfo.cpp b/plugins/messages-task/about/cpuinfo.cpp
|
||||
index ee24a95..d208453 100644
|
||||
--- a/plugins/messages-task/about/cpuinfo.cpp
|
||||
+++ b/plugins/messages-task/about/cpuinfo.cpp
|
||||
@@ -1,6 +1,6 @@
|
||||
#include <QFile>
|
||||
#include <QDebug>
|
||||
-
|
||||
+#include <QProcess>
|
||||
#include "cpuinfo.h"
|
||||
|
||||
cpuinfo::cpuinfo(QObject *parent) : QObject(parent)
|
||||
@@ -10,25 +10,26 @@ cpuinfo::cpuinfo(QObject *parent) : QObject(parent)
|
||||
|
||||
QString cpuinfo::getCpuName()
|
||||
{
|
||||
- QString name = "";
|
||||
+ QString name = "";
|
||||
#ifdef Q_OS_LINUX
|
||||
- QFile file("/proc/cpuinfo");
|
||||
- if (!file.open(QIODevice::ReadOnly | QIODevice::Text))
|
||||
- return "no cpuinfo";
|
||||
+ QProcess process;
|
||||
+ process.start("lscpu");
|
||||
+ process.waitForFinished();
|
||||
+ QString output = process.readAll();
|
||||
+ QStringList outputlist = output.split("\n");
|
||||
|
||||
- QString line = "N/A";
|
||||
- QTextStream in(&file);
|
||||
- line = in.readLine();
|
||||
- while (!in.atEnd()) {
|
||||
- line = in.readLine();
|
||||
- if (line.contains("model name"))
|
||||
- break;
|
||||
- }
|
||||
- //openEuler /proc/cpuinfo
|
||||
- //model name : Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz
|
||||
- name = QString(line).right(line.length() - (line.indexOf(":") + 2));
|
||||
+ for (QString str : outputlist) {
|
||||
+ if (str.contains("型号名称")){
|
||||
+ name = QString(str).right(str.length() - 28);
|
||||
+ break;
|
||||
+ }
|
||||
+ else if(str.contains("Model name")) {
|
||||
+ name = QString(str).right(str.length() - 33);
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
#elif defined(Q_OS_FREEBSD)
|
||||
|
||||
#endif
|
||||
- return name;
|
||||
-}
|
||||
+ return name;
|
||||
+}
|
||||
--
|
||||
2.30.0
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
%define debug_package %{nil}
|
||||
Name: ukui-control-center
|
||||
Version: 3.0.1
|
||||
Release: 17
|
||||
Release: 18
|
||||
Summary: utilities to configure the UKUI desktop
|
||||
License: GPL-2+
|
||||
URL: http://www.ukui.org
|
||||
@ -86,6 +86,7 @@ patch13: 0001-fix-compile-extern-C-error.patch
|
||||
patch14: fix_arm_root_user_crash.patch
|
||||
patch15: fix_add_group_failed_issue.patch
|
||||
patch16: fix_user_passwd_valid_time_setting_failed_issue.patch
|
||||
patch17: 0013-cpuinfo-in-arm-system-is-null.patch
|
||||
|
||||
Recommends: qt5-qtquickcontrols
|
||||
|
||||
@ -123,6 +124,7 @@ Suggests: ukui-settings-daemon
|
||||
%patch14 -p1
|
||||
%patch15 -p1
|
||||
%patch16 -p1
|
||||
%patch17 -p1
|
||||
|
||||
%build
|
||||
qmake-qt5
|
||||
@ -168,6 +170,9 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%{_datadir}/polkit-1/actions/org.ukui.groupmanager.policy
|
||||
|
||||
%changelog
|
||||
* Sat Sep 11 2021 peijiankang <peijiankang@kylinos.cn> - 3.0.1-18
|
||||
- add 0013-cpuinfo-in-arm-system-is-null.patch
|
||||
|
||||
* Mon Sep 6 2021 douyan <douyan@kylinos.cn> - 3.0.1-17
|
||||
- add fix_user_passwd_valid_time_setting_failed_issue.patch
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user