diff --git a/0002-Fix-kylin-user-guide-version-is-empty.patch b/0002-Fix-kylin-user-guide-version-is-empty.patch new file mode 100644 index 0000000..fca3461 --- /dev/null +++ b/0002-Fix-kylin-user-guide-version-is-empty.patch @@ -0,0 +1,50 @@ +From 6433e34bc3e113a11aa2d56b8eec8607f43a1927 Mon Sep 17 00:00:00 2001 +From: peijiankang +Date: Thu, 9 Jun 2022 14:12:37 +0800 +Subject: [PATCH] Fix kylin-user-guide version is empty + +--- + src/main.cpp | 25 +++++++++++++++++-------- + 1 file changed, 17 insertions(+), 8 deletions(-) + +diff --git a/src/main.cpp b/src/main.cpp +index 68e5c11..2d3b270 100644 +--- a/src/main.cpp ++++ b/src/main.cpp +@@ -78,16 +78,25 @@ static void crashHandler(int sig) + } + + QString getAppVersion(){ ++ QString m_appVersion; ++ QStringList options; + QProcess process; +- QString cmd = "dpkg-parsechangelog"; +- QStringList arg; +- arg.clear(); +- arg << "-l" << CHANGELOG_PATH << "--show-field" << "Version"; +- process.start(cmd,arg); ++ options << "-qa" << "|" << "grep" << "kylin-user-guide"; ++ process.start("rpm", options); + process.waitForFinished(); +- QByteArray result = process.readAllStandardOutput(); +- result = result.left(result.length()-1); +- return result; ++ QString dpkgInfo = process.readAll(); ++ QStringList infoList = dpkgInfo.split("\n"); ++ for (int n = 0; n < infoList.size(); n++) { ++ QString strInfoLine = infoList[n]; ++ if (strInfoLine.contains("kylin-user-guide")) { ++ QStringList lineInfoList = strInfoLine.split(QRegExp("-")); ++ if (lineInfoList.size() >= 3) { ++ m_appVersion = lineInfoList[3]; ++ } ++ break; ++ } ++ } ++ return m_appVersion; + } + + int main(int argc, char *argv[]) +-- +2.33.0 + diff --git a/kylin-user-guide.spec b/kylin-user-guide.spec index d57e5f4..67db6f3 100644 --- a/kylin-user-guide.spec +++ b/kylin-user-guide.spec @@ -1,12 +1,13 @@ %define debug_package %{nil} Name: kylin-user-guide Version: 1.0.4 -Release: 2 +Release: 3 Summary: A component of the ukui desktop environment that provides convenient text License: CC-BY-SA-4.0 and GPL-3.0-or-later URL: http://www.ukui.org Source0: %{name}-%{version}.tar.gz Patch01: 0001-modify-compile-error-of-None.patch +Patch02: 0002-Fix-kylin-user-guide-version-is-empty.patch BuildRequires: cmake BuildRequires: qt5-qtbase-devel @@ -40,6 +41,7 @@ this packages contains the picture of application %prep %setup -q %patch01 -p1 +%patch02 -p1 %build mkdir build && cd build @@ -79,7 +81,11 @@ rm -rf $RPM_BUILD_ROOT %{_datadir}/kylin-user-guide/translations/*.qm %{_datadir}/kylin-user-guide/data/* + %changelog +* Thu Jun 9 2022 peijiankang - 1.0.4-3 +- Fix kylin-user-guide version is empty + * Wed Jun 8 2022 peijiankang - 1.0.4-2 - add js-marked requires