From 80eb312322bf0f260136a8886e65f88285e4a21a Mon Sep 17 00:00:00 2001 From: Iceyer Date: Thu, 25 Oct 2018 09:39:34 +0800 Subject: [PATCH] fix: auto get version Change-Id: I42bd6d1641e53e22cf82dd1ded4de76fd93bc572 --- debian/rules | 8 ++++++-- src/CMakeLists.txt | 4 ++++ src/app/deepin_appstore.cpp | 2 +- src/base/consts.cpp | 1 - src/base/consts.h | 1 - 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/debian/rules b/debian/rules index 82540dfb..a00be001 100755 --- a/debian/rules +++ b/debian/rules @@ -3,15 +3,19 @@ export DH_VERBOSE=1 export QT_SELECT=qt5 +VERSION = $(shell dpkg-parsechangelog -ldebian/changelog -SVersion | sed 's/.*.is.//g') +_PACK_VER = $(shell echo $(VERSION) | awk -F'[+_~-]' '{print $$1}') +CONFIG_VERSION = $(_PACK_VER) + %: dh $@ --parallel ifeq ($(DEB_BUILD_ARCH), amd64) override_dh_auto_configure: - dh_auto_configure -- -DCMAKE_BUILD_TYPE=Release -DUSE_SYSTEM_RESOURCES=ON + dh_auto_configure -- -DCMAKE_BUILD_TYPE=Release -DUSE_SYSTEM_RESOURCES=ON -DCONFIG_VERSION=$(CONFIG_VERSION) else override_dh_auto_configure: - dh_auto_configure -- -DCMAKE_BUILD_TYPE=Release -DUSE_SYSTEM_RESOURCES=ON -DBUILD_WEB_RESOURCES=OFF + dh_auto_configure -- -DCMAKE_BUILD_TYPE=Release -DUSE_SYSTEM_RESOURCES=ON -DBUILD_WEB_RESOURCES=OFF -DCONFIG_VERSION=$(CONFIG_VERSION) endif override_dh_auto_build: diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3bae2cfc..9a4a7b30 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -13,6 +13,10 @@ else() -DSETTINGS_FILE="${CMAKE_CURRENT_SOURCE_DIR}/resources/settings.ini") endif() +if (CONFIG_VERSION) + add_definitions(-DVERSION=${CONFIG_VERSION}) +endif() + add_subdirectory(dbus) add_subdirectory(resources) diff --git a/src/app/deepin_appstore.cpp b/src/app/deepin_appstore.cpp index 9c35dd7d..0e912a85 100644 --- a/src/app/deepin_appstore.cpp +++ b/src/app/deepin_appstore.cpp @@ -97,7 +97,7 @@ int main(int argc, char** argv) { app.setProductIcon(QIcon(dstore::kImageDeepinAppStore)); app.setOrganizationName("deepin"); app.setOrganizationDomain("deepin.org"); - app.setApplicationVersion(dstore::kAppVersion); + app.setApplicationVersion(Dtk::Widget::DApplication::buildVersion("5.0.0.0")); app.setApplicationName(dstore::kAppName); app.loadTranslator(); app.setApplicationDisplayName(QObject::tr("Deepin Store")); diff --git a/src/base/consts.cpp b/src/base/consts.cpp index b98a7a8b..740bc2f3 100644 --- a/src/base/consts.cpp +++ b/src/base/consts.cpp @@ -20,7 +20,6 @@ namespace dstore { const char kAppName[] = "deepin-appstore"; -const char kAppVersion[] = "5.0.2.2"; #ifndef NDEBUG const char kIndexPage[] = "http://localhost:4200"; diff --git a/src/base/consts.h b/src/base/consts.h index f2f63514..646aeb7f 100644 --- a/src/base/consts.h +++ b/src/base/consts.h @@ -23,7 +23,6 @@ namespace dstore { extern const char kAppName[]; -extern const char kAppVersion[]; extern const char kIndexPage[]; // Get user cache directory.