summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorKai Blin <kai@samba.org>2007-06-26 09:10:30 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:23:35 -0500
commit97746f8db0ee80b94378567350f7b2b5f4b3e467 (patch)
treecd24b88dd63729f3bf7c97b4cb7ce678d3f4496c /source3
parente1319eb0e8f9e5b53b5f535c6e55751922db90f6 (diff)
downloadsamba-97746f8db0ee80b94378567350f7b2b5f4b3e467.tar.gz
samba-97746f8db0ee80b94378567350f7b2b5f4b3e467.tar.bz2
samba-97746f8db0ee80b94378567350f7b2b5f4b3e467.zip
r23606: Merge Samba4 mkversion.sh to Samba3.
(This used to be commit 6566e24c13aaf974b756c230d4890357e7adf73d)
Diffstat (limited to 'source3')
-rwxr-xr-xsource3/script/mkversion.sh153
1 files changed, 108 insertions, 45 deletions
diff --git a/source3/script/mkversion.sh b/source3/script/mkversion.sh
index 64f1a778ae..cfd6b506d4 100755
--- a/source3/script/mkversion.sh
+++ b/source3/script/mkversion.sh
@@ -16,12 +16,19 @@ SOURCE_DIR=$3
SAMBA_VERSION_MAJOR=`sed -n 's/^SAMBA_VERSION_MAJOR=//p' $SOURCE_DIR$VERSION_FILE`
SAMBA_VERSION_MINOR=`sed -n 's/^SAMBA_VERSION_MINOR=//p' $SOURCE_DIR$VERSION_FILE`
SAMBA_VERSION_RELEASE=`sed -n 's/^SAMBA_VERSION_RELEASE=//p' $SOURCE_DIR$VERSION_FILE`
+
SAMBA_VERSION_REVISION=`sed -n 's/^SAMBA_VERSION_REVISION=//p' $SOURCE_DIR$VERSION_FILE`
+
+SAMBA_VERSION_TP_RELEASE=`sed -n 's/^SAMBA_VERSION_TP_RELEASE=//p' $SOURCE_DIR$VERSION_FILE`
SAMBA_VERSION_PRE_RELEASE=`sed -n 's/^SAMBA_VERSION_PRE_RELEASE=//p' $SOURCE_DIR$VERSION_FILE`
SAMBA_VERSION_RC_RELEASE=`sed -n 's/^SAMBA_VERSION_RC_RELEASE=//p' $SOURCE_DIR$VERSION_FILE`
+
SAMBA_VERSION_IS_SVN_SNAPSHOT=`sed -n 's/^SAMBA_VERSION_IS_SVN_SNAPSHOT=//p' $SOURCE_DIR$VERSION_FILE`
+
+SAMBA_VERSION_RELEASE_NICKNAME=`sed -n 's/^SAMBA_VERSION_RELEASE_NICKNAME=//p' $SOURCE_DIR$VERSION_FILE`
+
SAMBA_VERSION_VENDOR_SUFFIX=`sed -n 's/^SAMBA_VERSION_VENDOR_SUFFIX=//p' $SOURCE_DIR$VERSION_FILE`
-SAMBA_VENDOR_PATCH=`sed -n 's/^SAMBA_VENDOR_PATCH=//p' $SOURCE_DIR$VERSION_FILE`
+SAMBA_VERSION_VENDOR_PATCH=`sed -n 's/^SAMBA_VERSION_VENDOR_PATCH=//p' $SOURCE_DIR$VERSION_FILE`
echo "/* Autogenerated by script/mkversion.sh */" > $OUTPUT_FILE
@@ -37,12 +44,15 @@ SAMBA_VERSION_STRING="${SAMBA_VERSION_MAJOR}.${SAMBA_VERSION_MINOR}.${SAMBA_VERS
##
-## maybe add "3.0.22a" or "3.0.22pre1" or "3.0.22rc1"
+## maybe add "3.0.22a" or "4.0.0tp11" or "3.0.22pre1" or "3.0.22rc1"
## We do not do pre or rc version on patch/letter releases
##
if test -n "${SAMBA_VERSION_REVISION}";then
SAMBA_VERSION_STRING="${SAMBA_VERSION_STRING}${SAMBA_VERSION_REVISION}"
echo "#define SAMBA_VERSION_REVISION \"${SAMBA_VERSION_REVISION}\"" >> $OUTPUT_FILE
+elif test -n "${SAMBA_VERSION_TP_RELEASE}";then
+ SAMBA_VERSION_STRING="${SAMBA_VERSION_STRING}tp${SAMBA_VERSION_TP_RELEASE}"
+ echo "#define SAMBA_VERSION_TP_RELEASE ${SAMBA_VERSION_TP_RELEASE}" >> $OUTPUT_FILE
elif test -n "${SAMBA_VERSION_PRE_RELEASE}";then
## maybe add "3.0.22pre2"
SAMBA_VERSION_STRING="${SAMBA_VERSION_STRING}pre${SAMBA_VERSION_PRE_RELEASE}"
@@ -53,70 +63,123 @@ elif test -n "${SAMBA_VERSION_RC_RELEASE}";then
fi
##
-## Add the vendor string if present
-##
-if test -n "${SAMBA_VERSION_VENDOR_SUFFIX}";then
- echo "#define SAMBA_VERSION_VENDOR_SUFFIX ${SAMBA_VERSION_VENDOR_SUFFIX}" >> $OUTPUT_FILE
- if test -n "${SAMBA_VENDOR_PATCH}";then
- echo "#define SAMBA_VENDOR_PATCH ${SAMBA_VENDOR_PATCH}" >> $OUTPUT_FILE
- fi
-fi
-
-
-
-##
## SVN revision number?
##
if test x"${SAMBA_VERSION_IS_SVN_SNAPSHOT}" = x"yes";then
_SAVE_LANG=${LANG}
LANG=""
- HAVESVN=no
- svn info ${SOURCE_DIR} >/dev/null 2>&1 && HAVESVN=yes
- TMP_REVISION=`(svn info ${SOURCE_DIR} 2>/dev/null || svk info ${SOURCE_DIR} 2>/dev/null) |grep 'Last Changed Rev.*:' |sed -e 's/Last Changed Rev.*: \([0-9]*\).*/\1/'`
- if test x"${HAVESVN}" = x"no";then
+ HAVEVER="no"
+
+ if test x"${HAVEVER}" != x"yes";then
+ HAVESVN=no
+ SVN_INFO=`svn info ${SOURCE_DIR} 2>/dev/null`
+ TMP_REVISION=`echo -e "${SVN_INFO}" | grep 'Last Changed Rev.*:' |sed -e 's/Last Changed Rev.*: \([0-9]*\).*/\1/'`
+ if test -n "$TMP_REVISION"; then
+ HAVESVN=yes
+ HAVEVER=yes
+ fi
+ fi
+
+ if test x"${HAVEVER}" != x"yes";then
HAVESVK=no
- svk info ${SOURCE_DIR} >/dev/null 2>&1 && HAVESVK=yes
- TMP_MIRRORED_REVISION=`(svk info ${SOURCE_DIR} 2>/dev/null) |grep 'Mirrored From:.*samba\.org.*' |sed -e 's/Mirrored From: .* Rev\..* \([0-9]*\).*/\1/'`
- if test -n "$TMP_MIRRORED_REVISION"; then
- TMP_SVK_REVISION_STR="${TMP_REVISION}-${USER}@${HOSTNAME}-[SVN-${TMP_MIRRORED_REVISION}]"
- else
- TMP_SVK_REVISION_STR="${TMP_REVISION}-${USER}@${HOSTNAME}"
+ SVK_INFO=`svk info ${SOURCE_DIR} 2>/dev/null`
+ TMP_REVISION=`echo -e "${SVK_INFO}" | grep 'Last Changed Rev.*:' |sed -e 's/Last Changed Rev.*: \([0-9]*\).*/\1/'`
+ if test -n "$TMP_REVISION"; then
+ HAVESVK=yes
+ HAVEVER=yes
+ fi
+ TMP_MIRRORED_REVISION=`echo -e "${SVK_INFO}" | grep 'Mirrored From:.*samba\.org.*' |sed -e 's/Mirrored From: .* Rev\..* \([0-9]*\).*/\1/'`
+ fi
+
+ if test x"${HAVEVER}" != x"yes";then
+ HAVEBZR=no
+ BZR_INFO=`bzr version-info --check-clean ${SOURCE_DIR} 2>/dev/null`
+ TMP_REVISION=`echo -e "${BZR_INFO}" | grep 'revno:' |sed -e 's/revno: \([0-9]*\).*/\1/'`
+ if test -n "$TMP_REVISION"; then
+ HAVEBZR=yes
+ HAVEVER=yes
fi
- if test x"${HAVESVK}" = x"no";then
- HAVEBZR=no
- bzr revno > /dev/null 2>&1 && HAVEBZR=yes
- TMP_BZR_REVNO=`bzr revno 2> /dev/null`
- TMP_BZR_NICK=`bzr nick 2> /dev/null`
- TMP_BZR_REVISION_STR="${TMP_BZR_NICK}-${TMP_BZR_REVNO}"
+ TMP_MIRRORED_REVISION=`echo -e "${BZR_INFO}" | grep 'revision-id: svn-v1:.*@0c0555d6-39d7-0310-84fc-f1cc0bd64818' |sed -e 's/revision-id: svn-v1:\([0-9]*\)@0c0555d6-39d7-0310-84fc-f1cc0bd64818.*/\1/'`
+ TMP_BRANCH_NICK=`echo -e "${BZR_INFO}" | grep 'branch-nick:' |sed -e 's/branch-nick: \(.*\)$/\1/'`
+ TMP_CLEAN_TREE=`echo -e "${BZR_INFO}" | grep 'clean:' |sed -e 's/clean: \([a-zA-Z]*\).*/\1/'`
+ fi
+
+ if test x"${HAVEVER}" != x"yes";then
+ HAVEGIT=no
+ GIT_INFO=`git show --abbrev-commit HEAD 2>/dev/null`
+ TMP_REVISION=`echo -e "${GIT_INFO}" | grep 'commit ' |sed -e 's/commit \([0-9a-f]*\).*/\1/'`
+ if test -n "$TMP_REVISION";then
+ HAVEGIT=yes
+ HAVEVER=yes
fi
+ TMP_MIRRORED_REVISION=`echo -e "${GIT_INFO}" | grep 'git-svn-id' |sed -e 's#^[ ^t]*git-svn-id: svn+ssh://svn.samba.org/data/svn/samba/branches/\(SAMBA_[34]_[0-9]\(_[0-9]\+\)\?@[0-9]*\).*#\1#'`
fi
+
if test x"${HAVESVN}" = x"yes";then
- SAMBA_VERSION_STRING="${SAMBA_VERSION_STRING}-SVN-build-${TMP_REVISION}"
- echo "#define SAMBA_VERSION_SVN_REVISION ${TMP_REVISION}" >> $OUTPUT_FILE
+ SAMBA_VERSION_STRING="${SAMBA_VERSION_STRING}-SVN-build-${TMP_REVISION}"
+ echo "#define SAMBA_VERSION_SVN_REVISION ${TMP_REVISION}" >> $OUTPUT_FILE
elif test x"${HAVESVK}" = x"yes";then
- SAMBA_VERSION_STRING="${SAMBA_VERSION_STRING}-SVK-build-${TMP_SVK_REVISION_STR}"
+ if test -n "$TMP_MIRRORED_REVISION"; then
+ TMP_SVK_REVISION_STR="${TMP_REVISION}-${USER}@${HOSTNAME}-[SVN-${TMP_MIRRORED_REVISION}]"
+ else
+ TMP_SVK_REVISION_STR="${TMP_REVISION}-${USER}@${HOSTNAME}"
+ fi
+ SAMBA_VERSION_STRING="${SAMBA_VERSION_STRING}-SVK-build-${TMP_SVK_REVISION_STR}"
elif test x"${HAVEBZR}" = x"yes";then
- SAMBA_VERSION_STRING="${SAMBA_VERSION_STRING}-BZR-build-${TMP_BZR_REVISION_STR}"
+ TMP_BZR_REVISION_STR="${TMP_REVISION}"
+
+ if test -n "$TMP_BRANCH_NICK"; then
+ TMP_BZR_REVISION_STR="${TMP_BZR_REVISION_STR}${TMP_MOD_STR}@${TMP_BRANCH_NICK}"
+ fi
+
+ if test -n "$TMP_MIRRORED_REVISION"; then
+ TMP_BZR_REVISION_STR="${TMP_BZR_REVISION_STR}-[SVN-${TMP_MIRRORED_REVISION}]"
+ fi
+
+ if test x"$TMP_CLEAN_TREE" != x"True"; then
+ TMP_BZR_REVISION_STR="${TMP_BZR_REVISION_STR}-[modified]"
+ fi
+
+ SAMBA_VERSION_STRING="${SAMBA_VERSION_STRING}-BZR-${TMP_BZR_REVISION_STR}"
+ elif test x"${HAVEGIT}" = x"yes";then
+ TMP_GIT_REVISION_STR="${TMP_REVISION}"
+
+ if test -n "$TMP_MIRRORED_REVISION"; then
+ TMP_GIT_REVISION_STR="${TMP_GIT_REVISION_STR}-[SVN-${TMP_MIRRORED_REVISION}]"
+ fi
+
+ SAMBA_VERSION_STRING="${SAMBA_VERSION_STRING}-GIT-${TMP_GIT_REVISION_STR}"
else
- SAMBA_VERSION_STRING="${SAMBA_VERSION_STRING}-SVN-build-UNKNOWN"
+ SAMBA_VERSION_STRING="${SAMBA_VERSION_STRING}-SVN-build-UNKNOWN"
fi
LANG=${_SAVE_LANG}
fi
echo "#define SAMBA_VERSION_OFFICIAL_STRING \"${SAMBA_VERSION_STRING}\"" >> $OUTPUT_FILE
-echo "#define SAMBA_VERSION_STRING samba_version_string()" >> $OUTPUT_FILE
-
-echo "$0: 'include/version.h' created for Samba(\"${SAMBA_VERSION_STRING}\")"
-
+##
+## Add the vendor string if present
+##
if test -n "${SAMBA_VERSION_VENDOR_SUFFIX}";then
- echo -n "$0: with VENDOR_SUFFIX = \""
- echo -n ${SAMBA_VERSION_VENDOR_SUFFIX} | sed 's/"//g'
- if test -n ${SAMBA_VENDOR_PATCH}; then
- echo -n "-${SAMBA_VENDOR_PATCH}"
- fi
- echo "\""
+ echo "#define SAMBA_VERSION_VENDOR_SUFFIX ${SAMBA_VERSION_VENDOR_SUFFIX}" >> $OUTPUT_FILE
+ SAMBA_VERSION_STRING="${SAMBA_VERSION_STRING}-${SAMBA_VERSION_VENDOR_SUFFIX}"
+ if test -n "${SAMBA_VERSION_VENDOR_PATCH}";then
+ echo "#define SAMBA_VERSION_VENDOR_PATCH ${SAMBA_VERSION_VENDOR_PATCH}" >> $OUTPUT_FILE
+ SAMBA_VERSION_STRING="${SAMBA_VERSION_STRING}-${SAMBA_VERSION_VENDOR_PATCH}"
+ fi
fi
+##
+## Add a release nickname
+##
+if test -n "${SAMBA_VERSION_RELEASE_NICKNAME}";then
+ echo "#define SAMBA_VERSION_RELEASE_NICKNAME ${SAMBA_VERSION_RELEASE_NICKNAME}" >> $OUTPUT_FILE
+ SAMBA_VERSION_STRING="${SAMBA_VERSION_STRING} (${SAMBA_VERSION_RELEASE_NICKNAME})"
+fi
+
+echo "#define SAMBA_VERSION_STRING samba_version_string()" >> $OUTPUT_FILE
+
+echo "$0: '$OUTPUT_FILE' created for Samba(\"${SAMBA_VERSION_STRING}\")"
+
exit 0