3 # usage: cut-release [-n] version-designation [make-args...]
11 echo -n "Does that look right? [y/n] "
16 if [ "$yn" = y
-o "$yn" = Y
-o "$yn" = yes -o "$yn" = YES
-o "$yn" = Yes
]; then
18 elif [ "$yn" = n
-o "$yn" = N
-o "$yn" = no
-o "$yn" = NO
-o "$yn" = No
]; then
19 echo "Aborting as per user request." >&2
27 if [ "$1" = -n ]; then
31 echo '************************* DRY RUN *************************'
37 echo "Usage: $(basename "$0") [-n] version-designation [make-args...]" >&2
38 echo "-n does a dry run (i.e., do sanity checks and build but don't touch the repository)"
42 if ! [ -e src
/expr
/node.h
-a -e .git
]; then
43 echo "$(basename "$0"): ERROR: You should run this from the top-level of a CVC4 git working directory" >&2
50 if echo "$version" |
grep '[^a-zA-Z0-9_.+(){}^%#-]' &>/dev
/null
; then
51 echo "$(basename "$0"): ERROR: Version designation \`$version' contains illegal characters" >&2
55 eval "declare -a vs=($(echo "$version" | sed 's,^\([0-9]*\)\.\([0-9]*\)\(\.\([0-9]*\)\)\?\(.*\),[0]=\1 [1]=\2 [2]=\4 [3]=\5,'))"
57 minor
=${vs[1]}; if [ -z "$minor" ]; then minor
=0; fi
58 release
=${vs[2]}; if [ -z "$release" ]; then release
=0; fi
63 echo "Release: $release"
66 version
="$major.$minor"
67 if [ "$release" != 0 ]; then
68 version
="$version.$release"
70 version
="$version$extra"
71 echo "Version: $version"
75 echo "Checking whether release \`$version' already exists..."
76 if [ -n "`git tag -l "$version"`" ]; then
77 echo "$(basename "$0"): ERROR: Git repo already contains a release \`$version'" >&2
81 echo "Checking working directory for local modifications..."
83 if [ -n "$(git status -s configure.ac)" ]; then
84 echo "$(basename "$0"): ERROR: In dry-run mode, cannot operate properly with local modifications to \"configure.ac\", sorry" >&2
87 elif [ -n "$(git status -s | grep -v '^ *M *\(NEWS\|README\|AUTHORS\|RELEASE-NOTES\|INSTALL\|THANKS\|library_versions\|contrib/cut-release\)$')" ]; then
88 echo "$(basename "$0"): ERROR: \"git status\" indicates there are local modifications; please commit first" >&2
92 echo "Checking repo for unmerged updates..."
94 if git status
-sb |
grep -q '^## .* \[.*behind '; 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=.git '^[ \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" 2>&1
114 echo "$(basename "$0"): ERROR: after install: $suspect_files" 2>&1
118 for updatefile
in NEWS README AUTHORS RELEASE-NOTES INSTALL THANKS
; do
119 echo "Checking $updatefile file for recent updates..."
120 if [ -n "$(git status -s $updatefile)" ]; then
121 echo "+ It's locally modified."
123 git log
-n 1 --date=local --pretty=format
:'+ Last changed on %ad (%ar)' $updatefile
127 echo "You should make sure to put some notes in the NEWS file for"
128 echo "release $version, indicating the most important changes since the"
132 echo "You should make sure there are no new authors to list for $version."
135 echo "You should ensure that $updatefile is appropriately updated"
136 echo "for $version before continuing. (Maybe it even lists the previous"
137 echo "version number!)"
141 isthatright
"Continue without updating $updatefile"
145 echo "Adjusting version info lines in configure.ac..."
146 if ! grep '^m4_define(_CVC4_MAJOR, *[0-9][0-9]* *)' configure.ac
&>/dev
/null ||
147 ! grep '^m4_define(_CVC4_MINOR, *[0-9][0-9]* *)' configure.ac
&>/dev
/null ||
148 ! grep '^m4_define(_CVC4_RELEASE, *[0-9][0-9]* *)' configure.ac
&>/dev
/null ||
149 ! grep '^m4_define(_CVC4_EXTRAVERSION, *\[.*\] *)' configure.ac
&>/dev
/null
; then
150 echo "$(basename "$0"): ERROR: Cannot locate the version info lines of configure.ac" >&2
153 perl
-pi -e 's/^m4_define\(_CVC4_MAJOR, ( *)[0-9]+( *)\)/m4_define(_CVC4_MAJOR, ${1}'"$major"'$2)/;
154 s/^m4_define\(_CVC4_MINOR, ( *)[0-9]+( *)\)/m4_define(_CVC4_MINOR, ${1}'"$minor"'$2)/;
155 s/^m4_define\(_CVC4_RELEASE, ( *)[0-9]+( *)\)/m4_define(_CVC4_RELEASE, ${1}'"$release"'$2)/;
156 s/^m4_define\(_CVC4_EXTRAVERSION, ( *)\[.*\]( *)\)/m4_define(_CVC4_EXTRAVERSION, $1\['"$extra"'\]$2)/' configure.ac
158 trap 'echo; echo; echo "Aborting in error."; git co -- configure.ac; echo' EXIT
161 echo 'Made the following change to configure.ac:'
163 git
diff configure.ac
167 if ! grep '^m4_define(_CVC4_MAJOR, *'"$major"' *)' configure.ac
&>/dev
/null ||
168 ! grep '^m4_define(_CVC4_MINOR, *'"$minor"' *)' configure.ac
&>/dev
/null ||
169 ! grep '^m4_define(_CVC4_RELEASE, *'"$release"' *)' configure.ac
&>/dev
/null ||
170 ! grep '^m4_define(_CVC4_EXTRAVERSION, *\['"$extra"'\] *)' configure.ac
&>/dev
/null
; then
171 echo "$(basename "$0"): INTERNAL ERROR: Cannot find the modified version info lines in configure.ac, bailing..." >&2
174 if [ -z "$(git status -s configure.ac)" ]; then
175 echo "$(basename "$0"): INTERNAL ERROR: \"git status\" indicates there are no local modifications to configure.ac; I expected the ones I just made!" >&2
179 echo "Building and checking distribution \`cvc4-$version'..."
181 version="'$version'"; \
183 ./autogen.sh || echo "autoconf failed; does library_versions have something to match $version?"; \
184 mkdir "release-$version"; \
185 cd "release-$version"; \
186 ../configure production-staticbinary --disable-shared --enable-unit-testing --with-readline --with-portfolio; \
188 tar xf "cvc4-$version.tar.gz"; \
189 cd "cvc4-$version"; \
190 ./configure production-staticbinary --disable-shared --enable-unit-testing --with-readline --with-portfolio; \
192 make distcheck "$@"; \
197 if ! [ -e release-
$version/cvc4-
$version.
tar.gz
]; then
198 echo "$(basename "$0"): INTERNAL ERROR: Cannot find the distribution tarball I just built" >&2
201 if ! [ -e release-
$version/cvc4-
$version/builds
/src
/main
/cvc4
]; then
202 echo "$(basename "$0"): INTERNAL ERROR: Cannot find the binary I just built" >&2
207 echo 'This release of CVC4 will identify itself as:'
209 release-
$version/cvc4-
$version/builds
/src
/main
/cvc4
--version
214 echo 'This binary release of CVC4 will identify itself as being configured like this:'
216 release-
$version/cvc4-
$version/builds
/src
/main
/cvc4
--show-config
221 echo "Signing tarball..."
222 cp -p "release-$version/cvc4-$version.tar.gz" .
223 gpg
-b --armor "cvc4-$version.tar.gz"
226 #echo "Signing cvc4 binary..."
227 #cp -p "release-$version/cvc4-$version/builds/src/main/cvc4" "cvc4-$version"
228 #gpg -b --armor "cvc4-$version"
231 #echo "Signing pcvc4 binary..."
232 #cp -p "release-$version/src/main/pcvc4" "pcvc4-$version"
233 #gpg -b --armor "pcvc4-$version"
237 echo '************************* DRY RUN *************************'
241 echo "About to run: git commit -am \"Cutting release $version.\""
243 $dryrun || git commit
-am "Cutting release $version."
246 echo "About to run: git tag \"$version\""
248 $dryrun || git tag
"$version"
252 if git status
-bs |
grep -q '^## master\($\| *\|\.\.\.\)'; then
253 if [ "$release" = 0 ]; then
254 echo "About to run: git branch \"$version.x\""
256 $dryrun || git branch
"$version.x"
257 andbranch
=", the $version.x branch,"
259 echo "Not branching, because this is a minor release (i.e., not a \"dot-oh\""
260 echo "release), so I'm guessing you have a devel branch outside of master"
261 echo "somewhere? You can still make a branch manually, of course."
264 echo "Not branching, because it appears there already is a branch"
265 echo "to work with for version $version ..? (You're not on master.)"
266 echo "You can still make a branch manually, of course."
270 echo "Done. Next steps are to:"
272 echo "1. push to GitHub (don't forget to push master$andbranch and the $version tag)"
273 echo "2. upload source and binaries"
274 echo "3. advertise these packages"
275 echo "4. add a $version release and next-milestone to Bugzilla."
276 echo "5. change $version to pre-release in master$andbranch"
277 echo " (in configure.ac) and update library_versions and NEWS."