3 # usage: cut-release [-n] version-designation [make-args...]
8 echo -n "Does that look right? [y/n] "
13 if [ "$yn" = y
-o "$yn" = Y
-o "$yn" = yes -o "$yn" = YES
-o "$yn" = Yes
]; then
15 elif [ "$yn" = n
-o "$yn" = N
-o "$yn" = no
-o "$yn" = NO
-o "$yn" = No
]; then
16 echo "Aborting as per user request." >&2
24 if [ "$1" = -n ]; then
32 echo "Usage: $(basename "$0") [-n] version-designation [make-args...]" >&2
33 echo "-n does a dry run (i.e., do sanity checks and build but don't touch the repository)"
37 if ! [ -e src
/expr
/node.h
-a -e .svn
]; then
38 echo "$(basename "$0"): ERROR: You should run this from the top-level of a CVC4 subversion working directory" >&2
45 if echo "$version" |
grep '[^a-zA-Z0-9_.+(){}^%#-]' &>/dev
/null
; then
46 echo "$(basename "$0"): ERROR: Version designation \`$version' contains illegal characters" >&2
50 eval "declare -a vs=($(echo "$version" | sed 's,^\([0-9]*\)\.\([0-9]*\)\(\.\([0-9]*\)\)\?\(.*\),[0]=\1 [1]=\2 [2]=\4 [3]=\5,'))"
52 minor
=${vs[1]}; if [ -z "$minor" ]; then minor
=0; fi
53 release
=${vs[2]}; if [ -z "$release" ]; then release
=0; fi
58 echo "Release: $release"
61 version
="$major.$minor"
62 if [ "$release" != 0 ]; then
63 version
="$version.$release"
65 version
="$version$extra"
66 echo "Version: $version"
70 echo "Checking whether release \`$version' already exists..."
71 if ! svn
ls "https://subversive.cims.nyu.edu/cvc4/cvc4/tags/releases/$version" 2>&1 >/dev
/null |
grep non-existent
>/dev
/null
; then
72 echo "$(basename "$0"): ERROR: Subversion repo already contains a release \`$version'" >&2
76 echo "Checking working directory for local modifications..."
78 if [ -n "$(svn status -q configure.ac)" ]; then
79 echo "$(basename "$0"): ERROR: In dry-run mode, cannot operate properly with local modifications to \"configure.ac\", sorry" >&2
82 elif [ -n "$(svn status -q | grep -v '^M *[0-9]* *NEWS$')" ]; then
83 echo "$(basename "$0"): ERROR: \"svn status\" indicates there are local modifications; please commit first" >&2
87 root
="$(svn info | grep "^Repository Root
: https
://subversive.cims.nyu.edu
/.
*" | cut -f3 -d' ')"
88 if [ -z "$root" ]; then
89 echo "$(basename "$0"): ERROR: Can't get repository root URL" 2>&1
93 echo "Checking repo for unmerged updates..."
94 if [ `svn -uq status | grep -v '^M *[0-9]* *NEWS$' | wc -l` -ne 1 ]; then
95 echo "$(basename "$0"): ERROR: This working directory isn't up to date" 2>&1
99 echo "Checking sources for broken public headers..."
101 $(grep -r --exclude-dir=.svn '^[ \t]*#[ \t]*include[ \t]*"[^
/]*"' src |
102 grep -v '"cvc4parser_public\.h
"' |
103 grep -v '"cvc4_public\.h
"' |
104 grep -v '"cvc4_private\.h
"' |
105 grep -v '"cvc4autoconfig\.h
"' |
106 grep -v '"cvc4parser_private\.h
"' |
109 xargs grep -l '^[ \t]*#[ \t]*include[ \t]*"cvc4.
*public\.h
"' |
111 if [ -n "$suspect_files" ]; then
112 echo "$(basename "$0"): ERROR: The following publicly-installed headers appear" 2>&1
113 echo "$(basename "$0"): ERROR: to have relative #includes and may be broken up" 2>&1
114 echo "$(basename "$0"): ERROR: on install: $suspect_files" 2>&1
118 echo "Checking NEWS file for recent updates..."
119 if [ -n "$(svn status -q NEWS)" ]; then
120 echo "+ It's locally modified."
123 svn info NEWS |
grep '^Last Changed Date: '
125 echo "You should probably make sure to put some notes in the NEWS file"
126 echo "for this release, indicating the most important changes from the"
129 isthatright
"Continue without updating NEWS"
132 echo "Adjusting version info lines in configure.ac..."
133 if ! grep '^m4_define(_CVC4_MAJOR, *[0-9][0-9]* *)' configure.ac
&>/dev
/null ||
134 ! grep '^m4_define(_CVC4_MINOR, *[0-9][0-9]* *)' configure.ac
&>/dev
/null ||
135 ! grep '^m4_define(_CVC4_RELEASE, *[0-9][0-9]* *)' configure.ac
&>/dev
/null ||
136 ! grep '^m4_define(_CVC4_EXTRAVERSION, *\[.*\] *)' configure.ac
&>/dev
/null
; then
137 echo "$(basename "$0"): ERROR: Cannot locate the version info lines of configure.ac" >&2
140 perl
-pi -e 's/^m4_define\(_CVC4_MAJOR, ( *)[0-9]+( *)\)/m4_define(_CVC4_MAJOR, ${1}'"$major"'$2)/;
141 s/^m4_define\(_CVC4_MINOR, ( *)[0-9]+( *)\)/m4_define(_CVC4_MINOR, ${1}'"$minor"'$2)/;
142 s/^m4_define\(_CVC4_RELEASE, ( *)[0-9]+( *)\)/m4_define(_CVC4_RELEASE, ${1}'"$release"'$2)/;
143 s/^m4_define\(_CVC4_EXTRAVERSION, ( *)\[.*\]( *)\)/m4_define(_CVC4_EXTRAVERSION, $1\['"$extra"'\]$2)/' configure.ac
145 trap 'echo; echo; echo "Aborting in error."; svn revert configure.ac; echo' EXIT
148 echo 'Made the following change to configure.ac:'
150 svn
diff configure.ac
154 if ! grep '^m4_define(_CVC4_MAJOR, *'"$major"' *)' configure.ac
&>/dev
/null ||
155 ! grep '^m4_define(_CVC4_MINOR, *'"$minor"' *)' configure.ac
&>/dev
/null ||
156 ! grep '^m4_define(_CVC4_RELEASE, *'"$release"' *)' configure.ac
&>/dev
/null ||
157 ! grep '^m4_define(_CVC4_EXTRAVERSION, *\['"$extra"'\] *)' configure.ac
&>/dev
/null
; then
158 echo "$(basename "$0"): INTERNAL ERROR: Cannot find the modified version info lines in configure.ac, bailing..." >&2
161 if [ -z "$(svn status -q configure.ac)" ]; then
162 echo "$(basename "$0"): INTERNAL ERROR: \"svn status\" indicates there are no local modifications to configure.ac; I expected the ones I just made!" >&2
166 echo "Building and checking distribution \`cvc4-$version'..."
168 version="'$version'"; \
170 ./autogen.sh || echo "autoconf failed; does library_versions have something to match $version?"; \
171 mkdir "release-$version"; \
172 cd "release-$version"; \
173 ../configure production-staticbinary --disable-shared --enable-unit-testing --without-cudd --with-readline --with-portfolio; \
175 tar xf "cvc4-$version.tar.gz"; \
176 cd "cvc4-$version"; \
177 ./configure production-staticbinary --disable-shared --enable-unit-testing --without-cudd --with-readline --with-portfolio; \
179 make distcheck "$@"; \
184 if ! [ -e release-
$version/cvc4-
$version.
tar.gz
]; then
185 echo "$(basename "$0"): INTERNAL ERROR: Cannot find the distribution tarball I just built" >&2
188 if ! [ -e release-
$version/cvc4-
$version/builds
/src
/main
/cvc4
]; then
189 echo "$(basename "$0"): INTERNAL ERROR: Cannot find the binary I just built" >&2
194 echo 'This release of CVC4 will identify itself as:'
196 release-
$version/cvc4-
$version/builds
/src
/main
/cvc4
--version
201 echo 'This binary release of CVC4 will identify itself as being configured like this:'
203 release-
$version/cvc4-
$version/builds
/src
/main
/cvc4
--show-config
208 echo "Signing tarball..."
209 cp -p "release-$version/cvc4-$version.tar.gz" .
210 gpg
-b --armor "cvc4-$version.tar.gz"
213 #echo "Signing cvc4 binary..."
214 #cp -p "release-$version/cvc4-$version/builds/src/main/cvc4" "cvc4-$version"
215 #gpg -b --armor "cvc4-$version"
218 #echo "Signing pcvc4 binary..."
219 #cp -p "release-$version/src/main/pcvc4" "pcvc4-$version"
220 #gpg -b --armor "pcvc4-$version"
223 echo "About to run: svn commit -m \"Cutting release $version.\""
225 $dryrun || svn commit
-m "Cutting release $version."
228 echo "About to run: svn copy -m \"Cutting release $version.\" \"$root\" \"https://subversive.cims.nyu.edu/cvc4/cvc4/tags/releases/$version\""
230 $dryrun || svn copy
-m "Cutting release $version." "$root" "https://subversive.cims.nyu.edu/cvc4/cvc4/tags/releases/$version"
233 if [ "$(svn info | grep '^URL: https://subversive.cims.nyu.edu/cvc4/cvc4/trunk$')" ]; then
234 if [ "$release" = 0 ]; then
235 echo "About to run: svn copy -m \"Branching release $version for bugfixes.\" \"https://subversive.cims.nyu.edu/cvc4/cvc4/tags/releases/$version\" \"https://subversive.cims.nyu.edu/cvc4/cvc4/branches/releases/$version.x\""
237 $dryrun || svn copy
-m "Branching release $version for bugfixes." "https://subversive.cims.nyu.edu/cvc4/cvc4/tags/releases/$version" "https://subversive.cims.nyu.edu/cvc4/cvc4/branches/releases/$version.x"
239 echo "Not branching, because this is a minor release (i.e., not a \"dot-oh\""
240 echo "release), so I'm guessing you have a devel repository outside of trunk"
241 echo "somewhere? You can still make a branch manually, of course."
244 echo "Not branching, because it appears there already is a branch"
245 echo "to work with for version $version ..? (You're not on trunk.)"
246 echo "You can still make a branch manually, of course."
250 echo "Done. Next steps are to upload and advertise these packages and to add"
251 echo "a $version release to Bugzilla."