3 # usage: cut-release [-n] version-designation [make-args...]
7 echo -n "Does that look right? [y/n] "
9 if [ "$yn" = y
-o "$yn" = Y
-o "$yn" = yes -o "$yn" = YES
-o "$yn" = Yes
]; then
11 elif [ "$yn" = n
-o "$yn" = N
-o "$yn" = no
-o "$yn" = NO
-o "$yn" = No
]; then
12 echo "Aborting as per user request." >&2
20 if [ "$1" = -n ]; then
28 echo "Usage: $(basename "$0") [-n] version-designation [make-args...]" >&2
29 echo "-n does a dry run (i.e., do sanity checks and build but don't touch the repository)"
33 if ! [ -e src
/expr
/node.h
-a -e .svn
]; then
34 echo "$(basename "$0"): ERROR: You should run this from the top-level of a CVC4 subversion working directory" >&2
41 if echo "$version" |
grep '[^a-zA-Z0-9_.+(){}^%#-]' &>/dev
/null
; then
42 echo "$(basename "$0"): ERROR: Version designation \`$version' contains illegal characters" >&2
46 vs
=($
(echo "$version" |
sed 's,^\([0-9]*\)\.\([0-9]*\)\(\.\([0-9]*\)\)\?\(.*\),\1 \2 \4 \5,'))
54 echo "Release: $release"
57 version
="$major.$minor"
58 if [ "$release" != 0 ]; then
59 version
="$version.$release"
61 version
="$version$extra"
62 echo "Version: $version"
66 echo "Checking whether release \`$version' already exists..."
67 if ! svn
ls "https://subversive.cims.nyu.edu/cvc4/cvc4/tags/releases/$version" 2>&1 >/dev
/null |
grep non-existent
>/dev
/null
; then
68 echo "$(basename "$0"): ERROR: Subversion repo already contains a release \`$version'" >&2
72 echo "Checking working directory for local modifications..."
74 if [ -n "$(svn status -q configure.ac)" ]; then
75 echo "$(basename "$0"): ERROR: In dry-run mode, cannot operate properly with local modifications to \"configure.ac\", sorry" >&2
78 elif [ -n "$(svn status -q)" ]; then
79 echo "$(basename "$0"): ERROR: \"svn status\" indicates there are local modifications; please commit first" >&2
83 root
="$(svn info | grep "^Repository Root
: https
://subversive.cims.nyu.edu
/.
*" | cut -f3 -d' ')"
84 if [ -z "$root" ]; then
85 echo "$(basename "$0"): ERROR: Can't get repository root URL" 2>&1
89 echo "Checking repo for unmerged updates..."
90 if [ `svn -uq status | wc -l` -ne 1 ]; then
91 echo "$(basename "$0"): ERROR: This working directory isn't up to date" 2>&1
95 echo "Checking sources for broken public headers..."
97 $(grep -r --exclude-dir=.svn '^[ \t]*#[ \t]*include[ \t]*"[^
/]*"' src |
98 grep -v '"cvc4parser_public\.h
"' |
99 grep -v '"cvc4_public\.h
"' |
100 grep -v '"cvc4_private\.h
"' |
101 grep -v '"cvc4autoconfig\.h
"' |
102 grep -v '"cvc4parser_private\.h
"' |
105 xargs grep -l '^[ \t]*#[ \t]*include[ \t]*"cvc4.
*public\.h
"' |
107 if [ -n "$suspect_files" ]; then
108 echo "$(basename "$0"): ERROR: The following publicly-installed headers appear" 2>&1
109 echo "$(basename "$0"): ERROR: to have relative #includes and may be broken up" 2>&1
110 echo "$(basename "$0"): ERROR: on install: $suspect_files" 2>&1
114 echo "Adjusting version info lines in configure.ac..."
115 if ! grep '^m4_define(_CVC4_MAJOR, *[0-9][0-9]* *)' configure.ac
&>/dev
/null ||
116 ! grep '^m4_define(_CVC4_MINOR, *[0-9][0-9]* *)' configure.ac
&>/dev
/null ||
117 ! grep '^m4_define(_CVC4_RELEASE, *[0-9][0-9]* *)' configure.ac
&>/dev
/null ||
118 ! grep '^m4_define(_CVC4_EXTRAVERSION, *\[.*\] *)' configure.ac
&>/dev
/null
; then
119 echo "$(basename "$0"): ERROR: Cannot locate the version info lines of configure.ac" >&2
122 perl
-pi -e 's/^m4_define\(_CVC4_MAJOR, ( *)[0-9]+( *)\)/m4_define(_CVC4_MAJOR, ${1}'"$major"'$2)/;
123 s/^m4_define\(_CVC4_MINOR, ( *)[0-9]+( *)\)/m4_define(_CVC4_MINOR, ${1}'"$minor"'$2)/;
124 s/^m4_define\(_CVC4_RELEASE, ( *)[0-9]+( *)\)/m4_define(_CVC4_RELEASE, ${1}'"$release"'$2)/;
125 s/^m4_define\(_CVC4_EXTRAVERSION, ( *)\[.*\]( *)\)/m4_define(_CVC4_EXTRAVERSION, $1\['"$extra"'\]$2)/' configure.ac
127 trap 'echo; echo; echo "Aborting in error."; svn revert configure.ac; echo' EXIT
130 echo 'Made the following change to configure.ac:'
132 svn
diff configure.ac
136 if ! grep '^m4_define(_CVC4_MAJOR, *'"$major"' *)' configure.ac
&>/dev
/null ||
137 ! grep '^m4_define(_CVC4_MINOR, *'"$minor"' *)' configure.ac
&>/dev
/null ||
138 ! grep '^m4_define(_CVC4_RELEASE, *'"$release"' *)' configure.ac
&>/dev
/null ||
139 ! grep '^m4_define(_CVC4_EXTRAVERSION, *\['"$extra"'\] *)' configure.ac
&>/dev
/null
; then
140 echo "$(basename "$0"): INTERNAL ERROR: Cannot find the modified version info lines in configure.ac, bailing..." >&2
143 if [ -z "$(svn status -q configure.ac)" ]; then
144 echo "$(basename "$0"): INTERNAL ERROR: \"svn status\" indicates there are no local modifications to configure.ac; I expected the ones I just made!" >&2
148 echo "Building and checking distribution \`cvc4-$version'..."
150 version="'$version'"; \
153 mkdir "release-$version"; \
154 cd "release-$version"; \
155 ../configure production-cln-staticbinary --disable-shared --enable-unit-testing --with-cudd --with-readline; \
157 tar xf "cvc4-$version.tar.gz"; \
158 cd "cvc4-$version"; \
159 ./configure production-cln-staticbinary --disable-shared --enable-unit-testing --with-cudd --with-readline; \
161 make distcheck "$@"; \
166 if ! [ -e release-
$version/cvc4-
$version.
tar.gz
]; then
167 echo "$(basename "$0"): INTERNAL ERROR: Cannot find the distribution tarball I just built" >&2
170 if ! [ -e release-
$version/src
/main
/cvc4
]; then
171 echo "$(basename "$0"): INTERNAL ERROR: Cannot find the binary I just built" >&2
176 echo 'This release of CVC4 will identify itself as:'
178 release-
$version/src
/main
/cvc4
--version
183 echo 'This binary release of CVC4 will identify itself as being configured like this:'
185 release-
$version/src
/main
/cvc4
--show-config
190 echo "Signing tarball..."
191 cp -p "release-$version/cvc4-$version.tar.gz" .
192 gpg
-b --armor "cvc4-$version.tar.gz"
195 echo "Signing binary..."
196 cp -p "release-$version/src/main/cvc4" "cvc4-$version"
197 gpg
-b --armor "cvc4-$version"
200 echo "About to run: svn commit -m \"Cutting release $version.\""
202 $dryrun || svn commit
-m "Cutting release $version."
205 echo "About to run: svn copy -m \"Cutting release $version.\" \"$root\" \"https://subversive.cims.nyu.edu/cvc4/cvc4/tags/releases/$version\""
207 $dryrun || svn copy
-m "Cutting release $version." "$root" "https://subversive.cims.nyu.edu/cvc4/cvc4/tags/releases/$version"