From 416f2e64a42249ad8476a9ee2416b9fd07f2ea73 Mon Sep 17 00:00:00 2001 From: Iceyer Date: Mon, 15 Jan 2018 17:22:52 +0800 Subject: [PATCH] feat: set version form changelog Change-Id: Idbb461e79cc2d91536c99748066f75ca104ee086 --- debian/rules | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/debian/rules b/debian/rules index 7550ee17f..562517afb 100755 --- a/debian/rules +++ b/debian/rules @@ -2,22 +2,35 @@ DPKG_EXPORT_BUILDFLAGS = 1 include /usr/share/dpkg/default.mk export QT_SELECT = qt5 + DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) version=$(shell dpkg-query --showformat='$${Version}' --show libdframeworkdbus-dev) COMPARE_VERSION=$(shell dpkg --compare-versions 0.4.2-1 ge-nl $(version); echo $$?) +ifneq (,$(wildcard .git/config)) + CONFIG_VERSION= +else + VERSION = $(shell dpkg-parsechangelog -ldebian/changelog -SVersion) + _PACK_VER = $(shell echo $(VERSION) | awk -F'[+_~-]' '{print $$1}') + _BUILD_VER = $(shell echo $(VERSION) | awk -F'[+_~-]' '{print $$2}' | sed 's/[^0-9]//g') + ifeq ($(_BUILD_VER),) + CONFIG_VERSION = $(_PACK_VER) + else + CONFIG_VERSION = $(_PACK_VER).$(_BUILD_VER) + endif +endif %: dh $@ --parallel ifeq ($(COMPARE_VERSION), 1) override_dh_auto_configure: - dh_auto_configure -- LIB_INSTALL_DIR=/usr/lib/$(DEB_HOST_MULTIARCH) + dh_auto_configure -- LIB_INSTALL_DIR=/usr/lib/$(DEB_HOST_MULTIARCH) VERSION=$(CONFIG_VERSION) endif ifeq ($(COMPARE_VERSION), 0) override_dh_auto_configure: - dh_auto_configure -- LIB_INSTALL_DIR=/usr/lib/$(DEB_HOST_MULTIARCH) DBUS_VERSION_0_4_2=YES + dh_auto_configure -- LIB_INSTALL_DIR=/usr/lib/$(DEB_HOST_MULTIARCH) VERSION=$(CONFIG_VERSION) DBUS_VERSION_0_4_2=YES endif override_dh_makeshlibs: