void-packages/srcpkgs/dtkcore/patches/0001-Revert-feat-add-DSysInfo-class.patch
John 003d45b95c dktcore: unbreak
the deepin-os-release tools is not needed for now. disable it since it
seems to break sometimes when parallel building and also breaks on cross
builds
2018-09-08 11:19:36 -03:00

977 lines
29 KiB
Diff

From 2f6df238bb114d2e04ad0fab611b560d9e1af9d8 Mon Sep 17 00:00:00 2001
From: John Zimmermann <johnz@posteo.net>
Date: Sat, 8 Sep 2018 15:01:38 +0200
Subject: [PATCH] Revert "feat: add DSysInfo class"
This reverts commit 16faf6c84d1a2ce520eecd42f369b78d24e03b9c.
---
.gitignore | 2 -
cmake/DtkCMake/DtkCMakeConfig.cmake | 72 ---
debian/libdtkcore-bin.install | 1 -
dtkcore.pro | 1 +
src/DSysInfo | 1 -
src/dsysinfo.cpp | 442 ------------------
src/dsysinfo.h | 75 ---
src/dtk_build.prf | 4 -
src/dtk_cmake.prf | 6 +-
src/dtk_module.prf | 5 -
src/dtk_qmake.prf | 73 ---
src/src.pro | 25 +-
tools/deepin-os-release/deepin-os-release.pro | 12 -
tools/deepin-os-release/main.cpp | 83 ----
tools/tools.pro | 2 +-
15 files changed, 5 insertions(+), 799 deletions(-)
delete mode 100644 cmake/DtkCMake/DtkCMakeConfig.cmake
delete mode 100644 src/DSysInfo
delete mode 100644 src/dsysinfo.cpp
delete mode 100644 src/dsysinfo.h
delete mode 100644 src/dtk_qmake.prf
delete mode 100644 tools/deepin-os-release/deepin-os-release.pro
delete mode 100644 tools/deepin-os-release/main.cpp
diff --git .gitignore .gitignore
index fd215d3..25e4a6c 100644
--- .gitignore
+++ .gitignore
@@ -23,5 +23,3 @@ src/DtkCore
src/dtkcore_config.h
cmake/DtkCore/DtkCoreConfig.cmake
src/qt_lib_d*.pri
-
-bin/
diff --git cmake/DtkCMake/DtkCMakeConfig.cmake cmake/DtkCMake/DtkCMakeConfig.cmake
deleted file mode 100644
index eeabef4..0000000
--- cmake/DtkCMake/DtkCMakeConfig.cmake
+++ /dev/null
@@ -1,72 +0,0 @@
-function(addDefinitions macro)
- string(TOUPPER ${macro} macro)
- add_definitions(-D${macro})
-endfunction()
-
-add_definitions(-DQ_HOST_NAME=\"${CMAKE_HOST_SYSTEM_PROCESSOR}\")
-addDefinitions(Q_HOST_${CMAKE_HOST_SYSTEM_PROCESSOR})
-
-find_package(DtkCore REQUIRED)
-
-set(DEEPIN_OS_RELEASE_TOOL_PATH ${DTKCORE_TOOL_DIR})
-set(DEEPIN_OS_RELEASE_TOOL ${DEEPIN_OS_RELEASE_TOOL_PATH}/deepin-os-release)
-
-if(NOT EXISTS "${DEEPIN_OS_RELEASE_TOOL}")
- message(FATAL_ERROR "\"${DEEPIN_OS_RELEASE_TOOL}\" is not exists. Install \"dtkcore-bin\" first")
-endif()
-
-function(formatString string)
- string(REGEX REPLACE "\\s+" "_" string ${string})
-endfunction()
-
-macro(execDeepinOsRelease args output)
- exec_program(${DEEPIN_OS_RELEASE_TOOL} ARGS ${args} OUTPUT_VARIABLE ${output} RETURN_VALUE exitCode)
-
- if(NOT ${exitCode} EQUAL 0)
- message(FATAL_ERROR "exec deepin-os-release failed, with args: ${args}, error message: ${output}")
- endif()
-endmacro()
-
-execDeepinOsRelease(--deepin-type DEEPIN_OS_TYPE)
-execDeepinOsRelease(--product-type CMAKE_PLATFORM_ID)
-execDeepinOsRelease(--product-version CMAKE_PLATFORM_VERSION)
-
-if("${CMAKE_PLATFORM_ID}" STREQUAL "")
- message(WARNING "No value of the \"--product-type\" in the process \"${DEEPIN_OS_RELEASE_TOOL}\"")
-else()
- formatString(CMAKE_PLATFORM_ID)
-
- message("OS: ${CMAKE_PLATFORM_ID}, Version: ${CMAKE_PLATFORM_VERSION}")
-
- if(NOT "${CMAKE_PLATFORM_ID}" STREQUAL "")
- addDefinitions(Q_OS_${CMAKE_PLATFORM_ID})
- string(TOUPPER ${CMAKE_PLATFORM_ID} CMAKE_PLATFORM_ID)
- set(OS_${CMAKE_PLATFORM_ID} TRUE)
- endif()
-
- if("${CMAKE_PLATFORM_VERSION}" STREQUAL "")
- message(WARNING "No value of the \"--product-version\"")
- else()
- formatString(CMAKE_PLATFORM_VERSION)
- if(NOT "${CMAKE_PLATFORM_VERSION}" STREQUAL "")
- add_definitions(-DQ_OS_VERSION=\"${CMAKE_PLATFORM_VERSION}\")
- endif()
- endif()
-endif()
-
-if("${DEEPIN_OS_TYPE}" STREQUAL "")
- message(WARNING "No value of the \"--deepin-type\" in the process \"${DEEPIN_OS_RELEASE_TOOL}\"")
-else()
- formatString(DEEPIN_OS_TYPE)
-
- message("Deepin OS Type: ${DEEPIN_OS_TYPE}")
-
- if(NOT "${DEEPIN_OS_TYPE}" STREQUAL "")
- addDefinitions(Q_OS_DEEPIN_${DEEPIN_OS_TYPE})
- string(TOUPPER ${DEEPIN_OS_TYPE} DEEPIN_OS_TYPE)
- set(OS_DEEPIN_${DEEPIN_OS_TYPE} TRUE)
- endif()
-
- add_definitions(-DQ_OS_DEEPIN)
- set(OS_DEEPIN TRUE)
-endif()
diff --git debian/libdtkcore-bin.install debian/libdtkcore-bin.install
index a0739b8..b808e55 100644
--- debian/libdtkcore-bin.install
+++ debian/libdtkcore-bin.install
@@ -1,2 +1 @@
usr/lib/dtk2/*
-usr/lib/*/*/DCore/bin/*
diff --git dtkcore.pro dtkcore.pro
index 1b7c66f..2ce7963 100644
--- dtkcore.pro
+++ dtkcore.pro
@@ -1 +1,2 @@
include($$PWD/src/dtk_lib.prf)
+
diff --git src/DSysInfo src/DSysInfo
deleted file mode 100644
index c026f58..0000000
--- src/DSysInfo
+++ /dev/null
@@ -1 +0,0 @@
-#include "dsysinfo.h"
diff --git src/dsysinfo.cpp src/dsysinfo.cpp
deleted file mode 100644
index 0fa9045..0000000
--- src/dsysinfo.cpp
+++ /dev/null
@@ -1,442 +0,0 @@
-/*
- * Copyright (C) 2017 ~ 2018 Deepin Technology Co., Ltd.
- *
- * Author: zccrs <zccrs@live.com>
- *
- * Maintainer: zccrs <zhangjide@deepin.com>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-#include "dsysinfo.h"
-
-#include <QFile>
-#include <QLocale>
-#include <QStorageInfo>
-#include <QProcess>
-#include <QDebug>
-
-#ifdef Q_OS_LINUX
-#include <sys/sysinfo.h>
-#include <sys/utsname.h>
-#include <sys/unistd.h>
-#endif
-
-DCORE_BEGIN_NAMESPACE
-
-class DSysInfoPrivate
-{
-public:
- DSysInfoPrivate();
-
-#ifdef Q_OS_LINUX
- void ensureDeepinInfo();
-#endif
- void ensureReleaseInfo();
- void ensureComputerInfo();
-
-#ifdef Q_OS_LINUX
- DSysInfo::DeepinType deepinType = DSysInfo::DeepinType(-1);
- QMap<QString, QString> deepinTypeMap; //Type Name with Language
- QString deepinEdition;
- QString deepinCopyright;
-#endif
-
- DSysInfo::ProductType productType = DSysInfo::ProductType(-1);
- QString prettyName;
- QString productTypeString;
- QString productVersion;
-
- QString computerName;
- QString cpuModelName;
- qint64 memoryTotalSize = -1;
- qint64 diskSize = 0;
-};
-
-DSysInfoPrivate::DSysInfoPrivate()
-{
-
-}
-
-#ifdef Q_OS_LINUX
-void DSysInfoPrivate::ensureDeepinInfo()
-{
- if (deepinType >= 0)
- return;
-
- QFile file("/etc/deepin-version");
-
- if (!file.open(QFile::ReadOnly)) {
- deepinType = DSysInfo::UnknownDeepin;
-
- return;
- }
-
- char buf[1024];
- int buf_length = 0;
-
- Q_FOREVER {
- buf_length = file.readLine(buf, sizeof(buf));
-
- if (buf_length < 0)
- break;
-
- const QByteArray line(buf, buf_length);
- const QByteArrayList &list = line.split('=');
-
- if (list.count() != 2) {
- continue;
- }
-
- const auto key_value = qMakePair(list.first().trimmed(), list.last().trimmed());
-
- if (line.startsWith("Type")) {
- if (key_value.first == "Type") {
- deepinTypeMap[QString()] = QString::fromLatin1(key_value.second);
- } else if (key_value.first.at(4) == '[' && key_value.first.at(key_value.first.size() - 1) == ']') {
- const QByteArray &language = key_value.first.mid(5, key_value.first.size() - 6);
-
- if (!language.isEmpty()) {
- deepinTypeMap[QString::fromLatin1(language)] = QString::fromUtf8(key_value.second);
- }
- }
- } else if (key_value.first == "Edition") {
- deepinEdition = QString::fromUtf8(key_value.second);
- } else if (key_value.first == "Copyright") {
- deepinCopyright = QString::fromUtf8(key_value.second);
- }
-
- if (!deepinTypeMap.isEmpty() && !deepinEdition.isEmpty() && !deepinCopyright.isEmpty()) {
- break;
- }
- }
-
- file.close();
-
- const QString &deepin_type = deepinTypeMap[QString()];
-
- if (deepin_type.isEmpty()) {
- deepinType = DSysInfo::UnknownDeepin;
- } else if (deepin_type == "Desktop") {
- deepinType = DSysInfo::DeepinDesktop;
- } else if (deepin_type == "Professional") {
- deepinType = DSysInfo::DeepinProfessional;
- } else {
- deepinType = DSysInfo::UnknownDeepin;
- }
-
- if (!deepinTypeMap.isEmpty() && productTypeString.isEmpty()) {
- productTypeString = "deepin";
- productType = DSysInfo::Deepin;
- }
-}
-
-static QString unquote(const QByteArray &value)
-{
- if (value.at(0) == '"' || value.at(0) == '\'') {
- return QString::fromLatin1(value.mid(1, value.size() - 2));
- }
-
- return QString::fromLatin1(value);
-}
-
-static bool readEtcFile(DSysInfoPrivate *info, const char *filename,
- const QByteArray &idKey, const QByteArray &versionKey, const QByteArray &prettyNameKey)
-{
-
- QFile file(QString::fromLatin1(filename));
-
- if (!file.open(QIODevice::ReadOnly)) {
- return false;
- }
-
- quint8 valid_data_count = 0;
- char buf[1024];
-
- while (valid_data_count < 3) {
- int buf_length = file.readLine(buf, sizeof(buf));
-
- if (buf_length < 0)
- break;
-
- const QByteArray line(buf, buf_length - 1);
-
- if (line.startsWith(idKey)) {
- const QByteArray value(line.constData() + idKey.size());
- info->productTypeString = unquote(value);
- ++valid_data_count;
- continue;
- }
-
- if (line.startsWith(prettyNameKey)) {
- const QByteArray value(line.constData() + prettyNameKey.size());
- info->prettyName = unquote(value);
- ++valid_data_count;
- continue;
- }
-
- if (line.startsWith(versionKey)) {
- const QByteArray value(line.constData() + versionKey.size());
- info->productVersion = unquote(value);
- ++valid_data_count;
- continue;
- }
- }
-
- file.close();
-
- return valid_data_count != 0;
-}
-
-static bool readOsRelease(DSysInfoPrivate *info)
-{
- if (!readEtcFile(info, "/etc/os-release", "ID=", "VERSION_ID=", "PRETTY_NAME="))
- return readEtcFile(info, "/usr/lib/os-release", "ID=", "VERSION_ID=", "PRETTY_NAME=");
-
- return true;
-}
-
-static bool readLsbRelease(DSysInfoPrivate *info)
-{
- return readEtcFile(info, "/etc/lsb-release", "DISTRIB_ID=", "DISTRIB_RELEASE=", "DISTRIB_DESCRIPTION=");
-}
-#endif
-
-void DSysInfoPrivate::ensureReleaseInfo()
-{
- if (productType >= 0) {
- return;
- }
-
-#ifdef Q_OS_LINUX
- if (!readOsRelease(this))
- readLsbRelease(this);
-
- if (productTypeString.isEmpty()) {
- productType = DSysInfo::UnknownType;
- } else {
- switch (productTypeString.at(0).unicode()) {
- case 'd':
- case 'D':
- if (productTypeString.compare("deepin", Qt::CaseInsensitive) == 0) {
- productType = DSysInfo::Deepin;
- } else if (productTypeString.compare("debian", Qt::CaseInsensitive) == 0) {
- productType = DSysInfo::Debian;
- }
- break;
- case 'a':
- case 'A':
- if (productTypeString.compare("arch", Qt::CaseInsensitive) == 0)
- productType = DSysInfo::ArchLinux;
- break;
- case 'c':
- case 'C':
- if (productTypeString.compare("centos", Qt::CaseInsensitive) == 0)
- productType = DSysInfo::CentOS;
- break;
- case 'f':
- case 'F':
- if (productTypeString.compare("fedora", Qt::CaseInsensitive) == 0)
- productType = DSysInfo::Fedora;
- break;
- case 'l':
- case 'L':
- if (productTypeString.compare("linuxmint", Qt::CaseInsensitive) == 0)
- productType = DSysInfo::LinuxMint;
- break;
- case 'm':
- case 'M':
- if (productTypeString.compare("manjaro", Qt::CaseInsensitive) == 0)
- productType = DSysInfo::Manjaro;
- break;
- case 'o':
- case 'O':
- if (productTypeString.compare("opensuse", Qt::CaseInsensitive) == 0)
- productType = DSysInfo::openSUSE;
- break;
- case 's':
- case 'S':
- if (productTypeString.compare("sailfishos", Qt::CaseInsensitive) == 0)
- productType = DSysInfo::SailfishOS;
- break;
- case 'u':
- case 'U':
- if (productTypeString.compare("ubuntu", Qt::CaseInsensitive) == 0)
- productType = DSysInfo::Ubuntu;
- break;
- default:
- productType = DSysInfo::UnknownType;
- break;
- }
- }
-#endif
-}
-
-void DSysInfoPrivate::ensureComputerInfo()
-{
- if (memoryTotalSize >= 0)
- return;
-
-#ifdef Q_OS_LINUX
- struct utsname u;
- if (uname(&u) == 0)
- computerName = QString::fromLatin1(u.nodename);
-
- QFile file("/proc/cpuinfo");
-
- if (file.open(QFile::ReadOnly)) {
- char buf[1024];
- qint64 lineLength = 0;
-
- do {
- lineLength = file.readLine(buf, sizeof(buf));
-
- const QByteArray line(buf, lineLength);
-
- if (line.startsWith("model name")) {
- if (int index = line.indexOf(':', 10)) {
- if (index > 0)
- cpuModelName = QString::fromLatin1(line.mid(index + 1).trimmed());
- }
- break;
- }
- } while (lineLength >= 0);
-
- file.close();
- }
-
- memoryTotalSize = get_phys_pages() * sysconf(_SC_PAGESIZE);
-
- const QString &root_part = QStorageInfo::root().device();
-
- if (root_part.isEmpty())
- return;
-
- QProcess lsblk;
-
- lsblk.start("lsblk", {"-prno", "pkname", root_part}, QIODevice::ReadOnly);
-
- if (!lsblk.waitForFinished())
- return;
-
- const QString &root_disk = QString::fromLatin1(lsblk.readAllStandardOutput().trimmed());
-
- lsblk.start("lsblk", {"-prnbdo", "size", root_disk}, QIODevice::ReadOnly);
-
- if (!lsblk.waitForFinished())
- return;
-
- const QByteArray &disk_size = lsblk.readAllStandardOutput().trimmed();
- diskSize = disk_size.toLongLong();
-#endif
-}
-
-Q_GLOBAL_STATIC(DSysInfoPrivate, siGlobal)
-
-QString DSysInfo::operatingSystemName()
-{
- siGlobal->ensureReleaseInfo();
-
- return siGlobal->prettyName;
-}
-
-#ifdef Q_OS_LINUX
-bool DSysInfo::isDeepin()
-{
- siGlobal->ensureReleaseInfo();
-
- if (siGlobal->productTypeString.isEmpty())
- siGlobal->ensureDeepinInfo();
-
- return productType() == Deepin;
-}
-
-DSysInfo::DeepinType DSysInfo::deepinType()
-{
- siGlobal->ensureDeepinInfo();
-
- return siGlobal->deepinType;
-}
-
-QString DSysInfo::deepinTypeDisplayName(const QLocale &locale)
-{
- siGlobal->ensureDeepinInfo();
-
- return siGlobal->deepinTypeMap.value(locale.name(), siGlobal->deepinTypeMap.value(QString()));
-}
-
-QString DSysInfo::deepinEdition()
-{
- siGlobal->ensureDeepinInfo();
-
- return siGlobal->deepinEdition;
-}
-
-QString DSysInfo::deepinCopyright()
-{
- siGlobal->ensureDeepinInfo();
-
- return siGlobal->deepinCopyright;
-}
-#endif
-
-DSysInfo::ProductType DSysInfo::productType()
-{
- siGlobal->ensureReleaseInfo();
-
- return siGlobal->productType;
-}
-
-QString DSysInfo::productTypeString()
-{
- siGlobal->ensureReleaseInfo();
-
- return siGlobal->productTypeString;
-}
-
-QString DSysInfo::productVersion()
-{
- siGlobal->ensureReleaseInfo();
-
- return siGlobal->productVersion;
-}
-
-QString DSysInfo::computerName()
-{
- siGlobal->ensureComputerInfo();
-
- return siGlobal->computerName;
-}
-
-QString DSysInfo::cpuModelName()
-{
- siGlobal->ensureComputerInfo();
-
- return siGlobal->cpuModelName;
-}
-
-qint64 DSysInfo::memoryTotalSize()
-{
- siGlobal->ensureComputerInfo();
-
- return siGlobal->memoryTotalSize;
-}
-
-qint64 DSysInfo::systemDiskSize()
-{
- siGlobal->ensureComputerInfo();
-
- return siGlobal->diskSize;
-}
-
-DCORE_END_NAMESPACE
diff --git src/dsysinfo.h src/dsysinfo.h
deleted file mode 100644
index 744c298..0000000
--- src/dsysinfo.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (C) 2017 ~ 2018 Deepin Technology Co., Ltd.
- *
- * Author: zccrs <zccrs@live.com>
- *
- * Maintainer: zccrs <zhangjide@deepin.com>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-#ifndef DSYSINFO_H
-#define DSYSINFO_H
-
-#include <dtkcore_global.h>
-
-#include <QLocale>
-
-DCORE_BEGIN_NAMESPACE
-
-class DSysInfoPrivate;
-class DSysInfo
-{
-public:
- enum ProductType {
- UnknownType = 0,
- Deepin,
- ArchLinux,
- CentOS,
- Debian,
- Fedora,
- LinuxMint,
- Manjaro,
- openSUSE,
- SailfishOS,
- Ubuntu
- };
-
- enum DeepinType {
- UnknownDeepin = 0,
- DeepinDesktop,
- DeepinProfessional
- };
-
-#ifdef Q_OS_LINUX
- static bool isDeepin();
- static DeepinType deepinType();
- static QString deepinTypeDisplayName(const QLocale &locale = QLocale::system());
- static QString deepinEdition();
- static QString deepinCopyright();
-#endif
-
- static QString operatingSystemName();
- static ProductType productType();
- static QString productTypeString();
- static QString productVersion();
-
- static QString computerName();
- static QString cpuModelName();
- static qint64 memoryTotalSize();
- static qint64 systemDiskSize();
-};
-
-DCORE_END_NAMESPACE
-
-#endif // DSYSINFO_H
diff --git src/dtk_build.prf src/dtk_build.prf
index 70bbf07..251e0b1 100644
--- src/dtk_build.prf
+++ src/dtk_build.prf
@@ -60,10 +60,6 @@ isEmpty(LIB_INSTALL_DIR) {
}
}
-isEmpty(BIN_INSTALL_DIR) {
- TOOL_INSTALL_DIR=$$LIB_INSTALL_DIR/libdtk-$${VER_MAJ}.$${VER_MIN}.$${VER_PAT}/D$$upper($$member($$list($$split(TARGET,)), 3, 3))$$join($$list($$member($$list($$split(TARGET,)), 4, -1)))/bin
-}
-
isEmpty(target.path): target.path = $$LIB_INSTALL_DIR
isEmpty(INCLUDE_INSTALL_DIR) {
diff --git src/dtk_cmake.prf src/dtk_cmake.prf
index 601289d..f6ea194 100644
--- src/dtk_cmake.prf
+++ src/dtk_cmake.prf
@@ -32,11 +32,7 @@ for(MODULE_DEPEND, CMAKE_MODULE_DEPENDS) {
CMAKE_MODULE_INCLUDE_DIR=$$upper($${CMAKE_MODULE})_INCLUDE_DIR
INC_DIR = $$replace(includes.path, "/", "/")
-CMAKE_MODULE_TOO_DIR=$$upper($${CMAKE_MODULE})_TOOL_DIR
-TOOL_DIR = $$TOOL_INSTALL_DIR
-
-CMAKE_CONTENT += "set($${CMAKE_MODULE_INCLUDE_DIR} $${INC_DIR})"
-CMAKE_CONTENT += "set($${CMAKE_MODULE_TOO_DIR} $${TOOL_DIR})"
+CMAKE_CONTENT += "set($${CMAKE_MODULE_INCLUDE_DIR} \"$${INC_DIR}\")"
CMAKE_CONTENT += "set($${CMAKE_MODULE}_LIBRARIES $$TARGET$$LINK_LIBRARIES)"
CMAKE_CONTENT += "include_directories(\"${"$${CMAKE_MODULE_INCLUDE_DIR}"}\")"
diff --git src/dtk_module.prf src/dtk_module.prf
index d26330d..fa76bb0 100644
--- src/dtk_module.prf
+++ src/dtk_module.prf
@@ -9,7 +9,6 @@ MODULE_ID=$$DTK_MODULE
mod_inst_pfx=$$_PRO_FILE_PWD_
MODULE_PRI = $$mod_inst_pfx/qt_lib_$${MODULE_ID}.pri
module_libs = $$target.path
-module_tools = $$TOOL_INSTALL_DIR
MODULE_INCLUDES = $$includes.path
DTK_MODULE_DEPENDS=$$find(QT, dtk*)
@@ -32,9 +31,6 @@ host_build: \
else: \
module_libs = "\$\$QT_MODULE_LIB_BASE"
}
-isEmpty(module_tools) {
- module_tools=$$module_libs/libdtk-$${VER_MAJ}.$${VER_MIN}.$${VER_PAT}/D$$upper($$member($$list($$split(TARGET,)), 3, 3))$$join($$list($$member($$list($$split(TARGET,)), 4, -1)))/bin
-}
# In addition to the library's private deps, the private module's deps
# are logically runtime deps of the public module.
runtime_deps = $$QT_PRIVATE $$QT_FOR_PRIVATE
@@ -79,7 +75,6 @@ MODULE_PRI_CONT = \
"" \
"QT.$${MODULE_ID}.name = $${TARGET}" \
"QT.$${MODULE_ID}.module = $$module_module" \
- "QT.$${MODULE_ID}.tools = $$module_tools" \
"QT.$${MODULE_ID}.libs = $$module_libs" \
$$module_master \
"QT.$${MODULE_ID}.includes = $$MODULE_INCLUDES" \
diff --git src/dtk_qmake.prf src/dtk_qmake.prf
deleted file mode 100644
index d438099..0000000
--- src/dtk_qmake.prf
+++ /dev/null
@@ -1,73 +0,0 @@
-CONFIG += host_$$QMAKE_HOST.arch
-DEFINES += Q_HOST_NAME=\\\"$$QMAKE_HOST.arch\\\" Q_HOST_$$upper($$QMAKE_HOST.arch)
-
-isEqual(TARGET, dtkcore) {
- # build tools/deepin-os-release first
- QMAKE_CONFIG_TESTS_DIR_BAK=$$QMAKE_CONFIG_TESTS_DIR
- load(configure)
- QMAKE_CONFIG_TESTS_DIR=$$_PRO_FILE_PWD_/../tools
- qtCompileTest(deepin-os-release)
- DEEPIN_OS_RELEASE_TOOL=$$_PRO_FILE_PWD_/../bin/deepin-os-release
- QMAKE_CONFIG_TESTS_DIR=$$QMAKE_CONFIG_TESTS_DIR_BAK
-} else {
- isEmpty(QT.dtkcore.tools): error(QT += dtkcore first)
- DEEPIN_OS_RELEASE_TOOL=$${QT.dtkcore.tools}/deepin-os-release
-}
-
-!exists($$DEEPIN_OS_RELEASE_TOOL): error(\"$$DEEPIN_OS_RELEASE_TOOL\" is not exists. Install \"dtkcore-bin\" first)
-
-defineReplace(formatString) {
- string = $$1
- string = $$replace(string, \\s+, _)
- string_count = $$size(string)
-
- greaterThan(string_count, 1) {
- for (item, string) {
- isEmpty(new_string): new_string = $$item
- else: new_string = $${new_string}_$${item}
- }
-
- return($$new_string)
- }
-
- return($$string)
-}
-
-DEEPIN_OS_TYPE = $$system($$DEEPIN_OS_RELEASE_TOOL --deepin-type)
-DISTRIB_ID = $$system($$DEEPIN_OS_RELEASE_TOOL --product-type)
-DISTRIB_RELEASE = $$system($$DEEPIN_OS_RELEASE_TOOL --product-version)
-
-isEmpty(DISTRIB_ID): warning(No value of the "--product-type" in the process "$$DEEPIN_OS_RELEASE_TOOL")
-else {
- DISTRIB_ID = $$formatString($$DISTRIB_ID)
-
- message("OS: $$DISTRIB_ID, Version: $$DISTRIB_RELEASE")
-
- QMAKE_PLATFORM += $$lower($$DISTRIB_ID)
-
- !isEmpty(DISTRIB_ID): DEFINES *= Q_OS_$$upper($$DISTRIB_ID)
- CONFIG *= $$QMAKE_PLATFORM
-
- isEmpty(DISTRIB_RELEASE): warning(No value of the "--product-version")
- else {
- DISTRIB_RELEASE = $$formatString($$DISTRIB_RELEASE)
- !isEmpty(DISTRIB_RELEASE): DEFINES *= Q_OS_VERSION=\\\"$$DISTRIB_RELEASE\\\"
- }
-}
-
-isEmpty(DEEPIN_OS_TYPE): warning(No value of the "--deepin-type" in the process "$$DEEPIN_OS_RELEASE_TOOL")
-else {
- DEEPIN_OS_TYPE = $$formatString($$DEEPIN_OS_TYPE)
-
- message(Deepin OS Type: $$DEEPIN_OS_TYPE)
-
- QMAKE_PLATFORM += deepin
-
- !isEmpty(DEEPIN_OS_TYPE) {
- QMAKE_PLATFORM += deepin_$$lower($$DEEPIN_OS_TYPE)
- DEFINES *= Q_OS_DEEPIN_$$upper($$DEEPIN_OS_TYPE)
- }
-
- CONFIG *= $$QMAKE_PLATFORM
- DEFINES *= Q_OS_DEEPIN
-}
diff --git src/src.pro src/src.pro
index 1c939b3..b198292 100644
--- src/src.pro
+++ src/src.pro
@@ -6,11 +6,7 @@ TARGET = dtkcore
include(dtk_build.prf)
INCLUDEPATH += $$PWD
-HEADERS += $$PWD/dtkcore_global.h \
- dsysinfo.h
-
-SOURCES += \
- dsysinfo.cpp
+HEADERS += $$PWD/dtkcore_global.h
include($$PWD/base/base.pri)
include($$PWD/util/util.pri)
@@ -80,11 +76,7 @@ defineTest(updateDtkCoreConfigFile) {
# ----------------------------------------------
# install config
-includes.files += \
- $$PWD/*.h \
- $$PWD/dtkcore_config.h \
- $$PWD/DtkCore \
- $$PWD/DSysInfo
+includes.files += $$PWD/*.h $$PWD/dtkcore_config.h $$PWD/DtkCore
INSTALLS += includes target
@@ -102,17 +94,4 @@ include(dtk_module.prf)
prf.files+= $$PWD/*.prf
prf.path = $${QT_HOST_DATA}/mkspecs/features
-
-linux {
- # dtk for qmake
- include(dtk_qmake.prf)
-
- deepin_os_release_tool.files=$$PWD/../bin/deepin-os-release
- deepin_os_release_tool.path=$$TOOL_INSTALL_DIR
-
- INSTALLS += deepin_os_release_tool
-} else {
- prf.files-=$$PWD/dtk_qmake.prf
-}
-
INSTALLS += prf
diff --git tools/deepin-os-release/deepin-os-release.pro tools/deepin-os-release/deepin-os-release.pro
deleted file mode 100644
index f56dd76..0000000
--- tools/deepin-os-release/deepin-os-release.pro
+++ /dev/null
@@ -1,12 +0,0 @@
-QT -= gui
-TEMPLATE = app
-CONFIG += qt
-
-HEADERS += ../../src/dsysinfo.h
-
-SOURCES += \
- main.cpp \
- ../../src/dsysinfo.cpp
-
-INCLUDEPATH += ../../src
-DESTDIR = $$_PRO_FILE_PWD_/../../bin
diff --git tools/deepin-os-release/main.cpp tools/deepin-os-release/main.cpp
deleted file mode 100644
index cd79e73..0000000
--- tools/deepin-os-release/main.cpp
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright (C) 2017 ~ 2018 Deepin Technology Co., Ltd.
- *
- * Author: zccrs <zccrs@live.com>
- *
- * Maintainer: zccrs <zhangjide@deepin.com>
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- */
-#include "dsysinfo.h"
-
-#include <QCoreApplication>
-#include <QCommandLineOption>
-#include <QCommandLineParser>
-#include <QThread>
-
-#include <stdio.h>
-
-DCORE_USE_NAMESPACE
-
-int main(int argc, char *argv[])
-{
- QCoreApplication app(argc, argv);
- Q_UNUSED(app)
-
- QCommandLineParser parser;
- QCommandLineOption option_all("all");
- QCommandLineOption option_deepin_type("deepin-type");
- QCommandLineOption option_deepin_edition("deepin-edition");
- QCommandLineOption option_deepin_copyright("deepin-copyright");
- QCommandLineOption option_product_type("product-type");
- QCommandLineOption option_product_version("product-version");
- QCommandLineOption option_computer_name("computer-name");
- QCommandLineOption option_cpu_model("cpu-model");
- QCommandLineOption optioin_memory_size("memory-size");
- QCommandLineOption optioin_disk_size("disk-size");
-
- parser.addOptions({option_all, option_deepin_type, option_deepin_edition,
- option_deepin_copyright, option_product_type, option_product_version,
- option_computer_name, option_cpu_model, optioin_memory_size, optioin_disk_size});
- parser.addHelpOption();
- parser.addVersionOption();
- parser.process(app);
-
- if (parser.isSet(option_all)) {
- printf("Computer Name: %s\n", qPrintable(DSysInfo::computerName()));
- printf("CPU Model: %s x %d\n", qPrintable(DSysInfo::cpuModelName()), QThread::idealThreadCount());
- printf("Memory Size: %f GiB\n", DSysInfo::memoryTotalSize() / 1024.0 / 1024 / 1024);
- printf("Disk Size: %f GiB\n", DSysInfo::systemDiskSize() / 1024.0 / 1024 / 1024);
-
- printf("Deepin Type: %s\n", qPrintable(DSysInfo::deepinTypeDisplayName(QLocale::c())));
- printf("Deepin Edition: %s\n", qPrintable(DSysInfo::deepinEdition()));
- printf("Deepin Copyright: %s\n", qPrintable(DSysInfo::deepinCopyright()));
-
- printf("Operating System Name: %s\n", qPrintable(DSysInfo::operatingSystemName()));
- printf("Product Type: %s\n", qPrintable(DSysInfo::productTypeString()));
- printf("Product Version: %s\n", qPrintable(DSysInfo::productVersion()));
- } else {
- if (parser.isSet(option_deepin_type))
- printf("%s", qPrintable(DSysInfo::deepinTypeDisplayName(QLocale::c())));
- else if (parser.isSet(option_deepin_edition))
- printf("%s", qPrintable(DSysInfo::deepinEdition()));
- else if (parser.isSet(option_deepin_copyright))
- printf("%s", qPrintable(DSysInfo::deepinCopyright()));
- else if (parser.isSet(option_product_type))
- printf("%s", qPrintable(DSysInfo::productTypeString()));
- else if (parser.isSet(option_product_version))
- printf("%s", qPrintable(DSysInfo::productVersion()));
- }
-
- return 0;
-}
diff --git tools/tools.pro tools/tools.pro
index a26c0c6..b658081 100644
--- tools/tools.pro
+++ tools/tools.pro
@@ -1,3 +1,3 @@
TEMPLATE = subdirs
-!mac:!win*: SUBDIRS += settings deepin-os-release
+!mac:!win*: SUBDIRS += settings
--
2.18.0