aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandru N. Onea <alexandru.onea@harman.com>2019-04-09 21:51:27 +0300
committerAlexandru N. Onea <alexandru.onea@harman.com>2019-04-09 22:16:23 +0300
commit52a7957cabc961d25b2eb765c34ca4e06844e197 (patch)
tree0fd89457d8fa85b7fd429f2c413f06eb354883bb
parent891c04d70b30ed4533785469b8bd2f5d6c17a68c (diff)
Add check action to version-bump.sh; Activate checks
-rw-r--r--CMakeLists.txt6
-rw-r--r--Makefile7
-rw-r--r--meson.build7
-rwxr-xr-xscripts/version-bump.sh20
4 files changed, 38 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index cb31c58..c927706 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -17,6 +17,12 @@ add_library("tinyalsa" ${HDRS} ${SRCS})
target_compile_options("tinyalsa" PRIVATE -Wall -Wextra -Werror -Wfatal-errors)
target_include_directories("tinyalsa" PRIVATE "include")
+add_custom_command(TARGET "tinyalsa"
+ POST_BUILD
+ COMMENT "Checking version against the changelog"
+ WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
+ COMMAND ${PROJECT_SOURCE_DIR}/scripts/version-bump.sh check)
+
macro(ADD_EXAMPLE EXAMPLE)
add_executable(${EXAMPLE} ${ARGN})
target_link_libraries(${EXAMPLE} "tinyalsa")
diff --git a/Makefile b/Makefile
index 4de58df..ea9bfef 100644
--- a/Makefile
+++ b/Makefile
@@ -7,8 +7,10 @@ export LIBDIR ?= $(PREFIX)/lib
export BINDIR ?= $(PREFIX)/bin
export MANDIR ?= $(PREFIX)/share/man
-export TINYALSA_VERSION_MAJOR = $(shell scripts/version-bump.sh -s print major)
-export TINYALSA_VERSION = $(shell scripts/version-bump.sh -s print )
+export VERSIONSCRIPT = $(shell pwd)/scripts/version-bump.sh
+
+export TINYALSA_VERSION_MAJOR = $(shell $(VERSIONSCRIPT) -s print major)
+export TINYALSA_VERSION = $(shell $(VERSIONSCRIPT) -s print )
.PHONY: all
all:
@@ -16,6 +18,7 @@ all:
$(MAKE) -C utils
$(MAKE) -C doxygen
$(MAKE) -C examples
+ $(VERSIONSCRIPT) check
.PHONY: clean
clean:
diff --git a/meson.build b/meson.build
index dda722d..04edda5 100644
--- a/meson.build
+++ b/meson.build
@@ -10,6 +10,13 @@ tinyalsa = library('tinyalsa',
version: meson.project_version(),
install: true)
+log_version = run_command(find_program('scripts/version-bump.sh'), 'check')
+if log_version.returncode() != 0
+ error(log_version.stderr())
+endif
+
+message(log_version.stdout())
+
# For use as a Meson subproject
tinyalsa_dep = declare_dependency(link_with: tinyalsa,
include_directories: include_directories('include'))
diff --git a/scripts/version-bump.sh b/scripts/version-bump.sh
index 287580b..05fbf37 100755
--- a/scripts/version-bump.sh
+++ b/scripts/version-bump.sh
@@ -6,6 +6,7 @@
#
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
VERSION_FILE="include/tinyalsa/version.h"
+CHANGELOG_FILE="debian/changelog"
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#
@@ -154,6 +155,21 @@ bump_version()
return 0
}
+check_version()
+{
+ get_version
+
+ LOG_VERSION=$(grep -m 1 "^tinyalsa (" ${CHANGELOG_FILE}| sed "s/[^0-9.]*//g")
+ REF_VERSION="${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}"
+
+ if [ "${LOG_VERSION}" != "${REF_VERSION}" ]; then
+ die "Changelog version (${LOG_VERSION}) does not match package version (${REF_VERSION})."
+ fi
+
+ printf "Changelog version (${LOG_VERSION}) OK!${LF}"
+ return 0
+}
+
# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
#
# Command Line parsing
@@ -175,6 +191,10 @@ parse_command()
bump_version "$2"
exit $?
;;
+ check)
+ check_version
+ exit $?
+ ;;
*)
die "Unsupported action \"$1\"."
;;