Skip to content

Commit 7e6c2c3

Browse files
committed
MT#55283 improve version handling
Change-Id: I8ff496f8460c5c5e0bee6b6bb6f3d2245291c597
1 parent 14769ec commit 7e6c2c3

File tree

2 files changed

+37
-24
lines changed

2 files changed

+37
-24
lines changed

kernel-module/gen-rtpengine-kmod-flags

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,12 @@ if [ -z "${M}" ]; then
44
M=$(pwd)
55
fi
66

7-
if [ -z "${RTPENGINE_VERSION}" ] && [ -f .release-version ]; then
8-
RTPENGINE_VERSION=$(<.release-version)
7+
if [ -z "${RTPENGINE_VERSION}" ]; then
8+
if [ -f .release-version ]; then
9+
RTPENGINE_VERSION=$(<.release-version)
10+
elif [ -f ../.release-version ]; then
11+
RTPENGINE_VERSION=$(<../.release-version)
12+
fi
913
fi
1014

1115
if [ -z "${RTPENGINE_VERSION}" ]; then
@@ -20,18 +24,23 @@ if [ -z "${RTPENGINE_VERSION}" ]; then
2024
fi
2125
if [ "${have_dpkg_parsechangelog}" = yes ]; then
2226
deb_version="$(dpkg-parsechangelog -l"${deb_changelog}" | awk '/^Version: / {print $2}')"
27+
RTPENGINE_VERSION="${deb_version}"
2328
fi
29+
2430
git_br_commit="git-$(cd "${M}" && git rev-parse --abbrev-ref --symbolic-full-name HEAD 2> /dev/null)-$(cd "${M}" && git rev-parse --short HEAD 2> /dev/null)"
2531

26-
if [ "${have_dpkg_parsechangelog}" = yes ]; then
27-
RTPENGINE_VERSION+=" ${deb_version}"
28-
fi
2932
if [ "${git_br_commit}" != "git--" ]; then
30-
RTPENGINE_VERSION+=" ${git_br_commit}"
33+
if [ -n "${RTPENGINE_VERSION}" ]; then
34+
RTPENGINE_VERSION+=" "
35+
fi
36+
RTPENGINE_VERSION+="${git_br_commit}"
3137
fi
38+
fi
3239

33-
if [ -z "${RTPENGINE_VERSION}" ]; then
34-
RTPENGINE_VERSION="undefined"
35-
fi
40+
if [ -z "${RTPENGINE_VERSION}" ]; then
41+
RTPENGINE_VERSION="undefined"
42+
fi
43+
44+
if [ -n "${RTPENGINE_VERSION}" ]; then
3645
echo "RTPENGINE_VERSION := ${RTPENGINE_VERSION}"
3746
fi

utils/gen-common-flags

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,33 +19,37 @@ if [ -z "${top_srcdir}" ]; then
1919
top_srcdir=.
2020
fi
2121

22-
have_dpkg_parsechangelog=no
23-
if command -v dpkg-parsechangelog >/dev/null; then
24-
have_dpkg_parsechangelog=yes
25-
fi
26-
27-
if [ -z "${RTPENGINE_VERSION}" ] && [ -f .release-version ]; then
28-
RTPENGINE_VERSION=$(<.release-version)
22+
if [ -z "${RTPENGINE_VERSION}" ] && [ -f "${top_srcdir}"/.release-version ]; then
23+
RTPENGINE_VERSION=$(<"${top_srcdir}"/.release-version)
2924
fi
3025

3126
if [ -z "${RTPENGINE_VERSION}" ]; then
27+
have_dpkg_parsechangelog=no
28+
if command -v dpkg-parsechangelog >/dev/null; then
29+
have_dpkg_parsechangelog=yes
30+
fi
3231
if [ "${have_dpkg_parsechangelog}" = yes ]; then
3332
deb_version="$(dpkg-parsechangelog -l"${top_srcdir}"/debian/changelog | awk '/^Version: / { print $2 }')"
33+
RTPENGINE_VERSION="${deb_version}"
3434
fi
35+
3536
git_br_commit="git-$(git rev-parse --abbrev-ref --symbolic-full-name HEAD 2> /dev/null)-$(git rev-parse --short HEAD 2> /dev/null)"
3637

37-
if [ "${have_dpkg_parsechangelog}" = yes ]; then
38-
RTPENGINE_VERSION+=" ${deb_version}"
39-
fi
4038
if [ "${git_br_commit}" != "git--" ]; then
41-
RTPENGINE_VERSION+=" ${git_br_commit}"
39+
if [ -n "${RTPENGINE_VERSION}" ]; then
40+
RTPENGINE_VERSION+=" "
41+
fi
42+
RTPENGINE_VERSION+="${git_br_commit}"
4243
fi
44+
fi
4345

44-
if [ -z "${RTPENGINE_VERSION}" ]; then
45-
RTPENGINE_VERSION=" undefined"
46-
fi
46+
if [ -z "${RTPENGINE_VERSION}" ]; then
47+
RTPENGINE_VERSION=" undefined"
48+
fi
49+
50+
if [ -n "${RTPENGINE_VERSION}" ]; then
51+
echo "RTPENGINE_VERSION := ${RTPENGINE_VERSION}"
4752
fi
48-
echo "RTPENGINE_VERSION := ${RTPENGINE_VERSION}"
4953

5054
CFLAGS_DEFAULT=
5155
CPPFLAGS_DEFAULT=

0 commit comments

Comments
 (0)