File: validate-release-version

package info (click to toggle)
syslog-ng 4.8.1-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 20,456 kB
  • sloc: ansic: 177,631; python: 13,035; cpp: 11,611; makefile: 7,012; sh: 5,147; java: 3,651; xml: 3,344; yacc: 1,377; lex: 599; perl: 193; awk: 190; objc: 162
file content (37 lines) | stat: -rwxr-xr-x 1,196 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash

set -e

cd /source

VERSION=$1
MAJOR=$(echo ${VERSION} | cut -d. -f1)
MINOR=$(echo ${VERSION} | cut -d. -f2)

function validate_VERSION_file() {
	if [ "`cat VERSION.txt`" != "${VERSION}" ]; then
		echo "The VERSION.txt file in the root of the source tree does not have the version number to be released ${VERSION}. Please commit a version bump change first (or use prepare-release)."
		exit 1
	fi
}

function grep_pattern_in_versioning_h() {
	VERSIONING_H="lib/versioning.h"
	PATTERN=$1

	if ! grep --perl-regexp "${PATTERN}" ${VERSIONING_H} > /dev/null; then
		echo "${PATTERN} was not found in ${VERSIONING_H}"
		exit 1
	fi
}

function validate_versioning_h_file() {
	grep_pattern_in_versioning_h "^#define VERSION_${MAJOR}_${MINOR} \"syslog-ng ${MAJOR}.${MINOR}\"$"
	grep_pattern_in_versioning_h "^#define VERSION_VALUE_${MAJOR}_${MINOR} 0x[a-f0-9]{4}$"
	grep_pattern_in_versioning_h "^#define VERSION_VALUE_CURRENT +VERSION_VALUE_${MAJOR}_${MINOR}$"
	grep_pattern_in_versioning_h "^#define VERSION_STR_CURRENT +\"${MAJOR}.${MINOR}\"$"
	grep_pattern_in_versioning_h "^#define VERSION_PRODUCT_CURRENT VERSION_${MAJOR}_${MINOR}$"
}

validate_VERSION_file
validate_versioning_h_file