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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
|
dnl Copyright (C) 2009 Sun Microsystems, Inc.
dnl This file is free software; Sun Microsystems, Inc.
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
AC_DEFUN([PANDORA_TEST_VC_DIR],[
pandora_building_from_vc=no
if test -d ".bzr" ; then
pandora_building_from_bzr=yes
pandora_building_from_vc=yes
else
pandora_building_from_bzr=no
fi
if test -d ".svn" ; then
pandora_building_from_svn=yes
pandora_building_from_vc=yes
else
pandora_building_from_svn=no
fi
if test -d ".hg" ; then
pandora_building_from_hg=yes
pandora_building_from_vc=yes
else
pandora_building_from_hg=no
fi
if test -d ".git" ; then
pandora_building_from_git=yes
pandora_building_from_vc=yes
else
pandora_building_from_git=no
fi
])
AC_DEFUN([PANDORA_BUILDING_FROM_VC],[
m4_syscmd(PANDORA_TEST_VC_DIR [
PANDORA_RELEASE_DATE=`date +%Y.%m`
PANDORA_RELEASE_NODOTS_DATE=`date +%Y%m`
# Set some defaults
PANDORA_VC_REVNO="0"
PANDORA_VC_REVID="unknown"
PANDORA_VC_BRANCH="bzr-export"
if test "${pandora_building_from_bzr}" = "yes"; then
echo "# Grabbing changelog and version information from bzr"
PANDORA_BZR_REVNO=`bzr revno`
if test "x$PANDORA_BZR_REVNO" != "x${PANDORA_VC_REVNO}" ; then
PANDORA_VC_REVNO="${PANDORA_BZR_REVNO}"
PANDORA_VC_REVID=`bzr log -r-1 --show-ids | grep revision-id | cut -f2 -d' ' | head -1`
PANDORA_VC_BRANCH=`bzr nick`
bzr log --gnu > ChangeLog
fi
fi
if ! test -d config ; then
mkdir -p config
fi
if test "${pandora_building_from_bzr}" = "yes" -o ! -f config/pandora_vc_revinfo ; then
cat > config/pandora_vc_revinfo.tmp <<EOF
PANDORA_VC_REVNO=${PANDORA_VC_REVNO}
PANDORA_VC_REVID=${PANDORA_VC_REVID}
PANDORA_VC_BRANCH=${PANDORA_VC_BRANCH}
PANDORA_RELEASE_DATE=${PANDORA_RELEASE_DATE}
PANDORA_RELEASE_NODOTS_DATE=${PANDORA_RELEASE_NODOTS_DATE}
EOF
if ! diff config/pandora_vc_revinfo.tmp config/pandora_vc_revinfo >/dev/null 2>&1 ; then
mv config/pandora_vc_revinfo.tmp config/pandora_vc_revinfo
fi
rm -f config/pandora_vc_revinfo.tmp
fi
])
])
AC_DEFUN([_PANDORA_READ_FROM_FILE],[
$1=`grep $1 $2 | cut -f2 -d=`
])
AC_DEFUN([PANDORA_VC_VERSION],[
AC_REQUIRE([PANDORA_BUILDING_FROM_VC])
PANDORA_TEST_VC_DIR
AS_IF([test -f ${srcdir}/config/pandora_vc_revinfo],[
_PANDORA_READ_FROM_FILE([PANDORA_VC_REVNO],${srcdir}/config/pandora_vc_revinfo)
_PANDORA_READ_FROM_FILE([PANDORA_VC_REVID],${srcdir}/config/pandora_vc_revinfo)
_PANDORA_READ_FROM_FILE([PANDORA_VC_BRANCH],
${srcdir}/config/pandora_vc_revinfo)
_PANDORA_READ_FROM_FILE([PANDORA_RELEASE_DATE],
${srcdir}/config/pandora_vc_revinfo)
_PANDORA_READ_FROM_FILE([PANDORA_RELEASE_NODOTS_DATE],
${srcdir}/config/pandora_vc_revinfo)
])
AS_IF([test "x${PANDORA_VC_BRANCH}" != x"${PACKAGE}"],[
PANDORA_RELEASE_COMMENT="${PANDORA_VC_BRANCH}"
],[
PANDORA_RELEASE_COMMENT="trunk"
])
PANDORA_RELEASE_VERSION="${PANDORA_RELEASE_DATE}.${PANDORA_VC_REVNO}"
PANDORA_RELEASE_ID="${PANDORA_RELEASE_NODOTS_DATE}${PANDORA_VC_REVNO}"
VERSION="${PANDORA_RELEASE_VERSION}"
AC_DEFINE_UNQUOTED([PANDORA_RELEASE_VERSION],["${PANDORA_RELEASE_VERSION}"],
[The real version of the software])
AC_SUBST(PANDORA_VC_REVNO)
AC_SUBST(PANDORA_VC_REVID)
AC_SUBST(PANDORA_VC_BRANCH)
AC_SUBST(PANDORA_RELEASE_DATE)
AC_SUBST(PANDORA_RELEASE_NODOTS_DATE)
AC_SUBST(PANDORA_RELEASE_COMMENT)
AC_SUBST(PANDORA_RELEASE_VERSION)
AC_SUBST(PANDORA_RELEASE_ID)
])
AC_DEFUN([PANDORA_VC_INFO_HEADER],[
AC_REQUIRE([PANDORA_VC_VERSION])
m4_define([PANDORA_VC_PREFIX],m4_toupper(m4_normalize(AC_PACKAGE_NAME))[_])
AC_DEFINE_UNQUOTED(PANDORA_VC_PREFIX[VC_REVNO], [$PANDORA_VC_REVNO], [Version control revision number])
AC_DEFINE_UNQUOTED(PANDORA_VC_PREFIX[VC_REVID], ["$PANDORA_VC_REVID"], [Version control revision ID])
AC_DEFINE_UNQUOTED(PANDORA_VC_PREFIX[VC_BRANCH], ["$PANDORA_VC_BRANCH"], [Version control branch name])
AC_DEFINE_UNQUOTED(PANDORA_VC_PREFIX[RELEASE_DATE], ["$PANDORA_RELEASE_DATE"], [Release date of version control checkout])
AC_DEFINE_UNQUOTED(PANDORA_VC_PREFIX[RELEASE_NODOTS_DATE], [$PANDORA_RELEASE_NODOTS_DATE], [Numeric formatted release date of checkout])
AC_DEFINE_UNQUOTED(PANDORA_VC_PREFIX[RELEASE_COMMENT], ["$PANDORA_RELEASE_COMMENT"], [Set to trunk if the branch is the main $PACKAGE branch])
AC_DEFINE_UNQUOTED(PANDORA_VC_PREFIX[RELEASE_VERSION], ["$PANDORA_RELEASE_VERSION"], [Release date and revision number of checkout])
AC_DEFINE_UNQUOTED(PANDORA_VC_PREFIX[RELEASE_ID], [$PANDORA_RELEASE_ID], [Numeric formatted release date and revision number of checkout])
])
|