Debian Codegraph @

ReleaseTools/incr

raw symbols SCIP
1 #!/bin/bashscip-shell filesystem . . `/bin/bash`.
2 # Do an incremental release.
3
4 # Bail if anything bad happens.
5 set -e
6
7 unset noop
8 unset verbose
9 while [scip-shell system . . `[`. $# -gt 0 ]
10 do
11 case "$1" in
12 -n) noop=1;;
13 -v) verbose=1;;
14 *) echoscip-shell system . . echo. >&2 "Unknown option: $1"
15 exit 1
16 esac
17 shift
18 done
19
20 a_red=""
21 a_green=""
22 a_none=""
23
24 # Display text in green.
25 function greenscip-shell shell shell-project 0.0.0 green().()
26 {
27 echoscip-shell system . . echo. -n $a_green
28 echoscip-shell system . . echo. -n "$@"
29 echoscip-shell system . . echo. $a_none
30 }
31
32 # Display text in red on stderr.
33 function redscip-shell shell shell-project 0.0.0 red().()
34 {
35 echoscip-shell system . . echo. >&2 -n $a_red
36 echoscip-shell system . . echo. >&2 -n "$@"
37 echoscip-shell system . . echo. >&2 $a_none
38 }
39
40 # Execute an action. This function has its own error recovery, so
41 # it clears and re-sets -e.
42 function executescip-shell shell shell-project 0.0.0 execute().()
43 {
44 set +e
45 tf1=/tmp/ex1-$$
46 tf2=/tmp/ex2-$$
47 echoscip-shell system . . echo. ">>" "$@"
48 if [scip-shell system . . `[`. ! "$noop" ]
49 then
50 if [scip-shell system . . `[`. "$verbose" ]
51 then "$@"
52 else
53 "$@" >$tf1 2>$tf2
54 if [scip-shell system . . `[`. $? -ne 0 ]
55 then
56 catscip-shell system . . cat. $tf1
57 catscip-shell system . . cat. $tf2
58 rmscip-shell system . . rm. -f $tf1 $tf2
59 exit 1
60 fi
61 fi
62 fi
63 rmscip-shell system . . rm. -f $tf1 $tf2
64 set -e
65 }
66
67 # Make sure the repo is clean.
68 if gitscip-shell system . . git. status | grepscip-shell system . . grep. '^nothing to commit,' >/dev/nullscip-shell filesystem . . `/dev/null`.
69 then :
70 else redscip-shell shell shell-project 0.0.0 red(). "Abort: Repo is not clean."
71 exit 1
72 fi
73
74 # Figure out the current version.
75 . Common/version.txtscip-shell source . . `Common/version.txt`.
76 ver=$(echoscip-shell system . . echo. $version | sedscip-shell system . . sed. 's/[a-z].*//')
77
78 # Make sure this is a pre-release version.
79 case "$version" in
80 *pre*) ;;
81 *) redscip-shell shell shell-project 0.0.0 red(). "Abort: Version '$version' is not a pre-release."
82 exit 1
83 esac
84
85 # Make sure we are on a matching git branch.
86 git_branch=$(gitscip-shell system . . git. status | awkscip-shell system . . awk. '/^On branch/ { print $3 }scip-shell filesystem . . `/^On branch/ { print $3 }`.')
87 if [scip-shell system . . `[`. "$ver" != "$git_branch" ]
88 then redscip-shell shell shell-project 0.0.0 red(). "Abort: git branch '$git_branch' does not match version '$ver'"
89 exit 1
90 fi
91
92 # Fail.
93 #green "This should fail"
94 #execute "farble blurf"
95
96 # Clean up
97 greenscip-shell shell shell-project 0.0.0 green(). "Cleaning up"
98 executescip-shell shell shell-project 0.0.0 execute(). make clobber
99
100 # Get a clean set of Makefiles.
101 greenscip-shell shell shell-project 0.0.0 green(). "Configuring"
102 executescip-shell shell shell-project 0.0.0 execute(). ./configure -C CFLAGS="-ggdb3 -Werror -Wno-format-zero-length -fno-common"
103
104 # Update the version file.
105 new_version=$(echoscip-shell system . . echo. $version | sedscip-shell system . . sed. "s/pre/$phase/")
106 greenscip-shell shell shell-project 0.0.0 green(). "Advancing version from $version to $new_version"
107 tf=/tmp/sed$$
108 sedscip-shell system . . sed. "s/$version/$new_version/" Common/version.txt >$tf
109 [scip-shell system . . `[`. "$noop" -o "$verbose" ] && (diffscip-shell system . . diff. Common/version.txt $tf || truescip-shell system . . true.)
110 executescip-shell shell shell-project 0.0.0 execute(). cp $tf Common/version.txt
111 rmscip-shell system . . rm. -f $tf
112
113 # Build with the changed code.
114 greenscip-shell shell shell-project 0.0.0 green(). "Building"
115 executescip-shell shell shell-project 0.0.0 execute(). make -j12
116
117 # Build a Windows release, which also updates the man pages.
118 greenscip-shell shell shell-project 0.0.0 green(). "Building Windows release"
119 executescip-shell shell shell-project 0.0.0 execute(). make -f Makefile.aux windows-release
120
121 # Commit.
122 greenscip-shell shell shell-project 0.0.0 green(). "Committing $new_version"
123 executescip-shell shell shell-project 0.0.0 execute(). git add .
124 executescip-shell shell shell-project 0.0.0 execute(). git commit -m$new_version
125
126 # Build the source tarball and append it to the package zipfile.
127 greenscip-shell shell shell-project 0.0.0 green(). "Building source tarball"
128 executescip-shell shell shell-project 0.0.0 execute(). make -f Makefile.aux src.tgz
129 executescip-shell shell shell-project 0.0.0 execute(). zip wc3270/package.zip suite3270-$new_version-src.tgz
130
131 # Archive the tarball.
132 greenscip-shell shell shell-project 0.0.0 green(). "Archiving the tarball"
133 executescip-shell shell shell-project 0.0.0 execute(). cp -p suite3270-$new_version-src.tgz ../../Release/
134 left=$(echoscip-shell system . . echo. $version | sedscip-shell system . . sed. 's/\..*//')
135 right=$(echoscip-shell system . . echo. $version | sedscip-shell system . . sed. -e 's/^[0-9]*\.//' -e 's/[a-z].*//')
136 bdir=$(printfscip-shell system . . printf. "%02d.%02d" $left $right)
137 executescip-shell shell shell-project 0.0.0 execute(). ssh bgp.nu mkdir -p www/download/$bdir
138 executescip-shell shell shell-project 0.0.0 execute(). scp suite3270-$new_version-src.tgz bgp.nu:www/download/$bdir/
139
140 # Tag the release.
141 greenscip-shell shell shell-project 0.0.0 green(). "Tagging"
142 executescip-shell shell shell-project 0.0.0 execute(). git tag -a -m$new_version $new_version
143
144 # Move ahead to the next pre-release.
145 point=$(echoscip-shell system . . echo. $version | sedscip-shell system . . sed. 's/.*pre//')
146 new_point=$(exprscip-shell system . . expr. $point + 1)
147 next_version=$(echoscip-shell system . . echo. $version | sedscip-shell system . . sed. "s/pre.*/pre$new_point/")
148 greenscip-shell shell shell-project 0.0.0 green(). "Advancing version from $new_version to $next_version for ongoing development"
149 tf=/tmp/sed$$
150 sedscip-shell system . . sed. "s/$new_version/$next_version/" Common/version.txt >$tf
151 [scip-shell system . . `[`. "$noop" -o "$verbose" ] && (diffscip-shell system . . diff. Common/version.txt $tf || truescip-shell system . . true.)
152 executescip-shell shell shell-project 0.0.0 execute(). cp $tf Common/version.txt
153 rmscip-shell system . . rm. -f $tf
154 executescip-shell shell shell-project 0.0.0 execute(). git add .
155 executescip-shell shell shell-project 0.0.0 execute(). git commit -m"Start ${ver}pre${new_point}"
156
157 # Push everything out.
158 greenscip-shell shell shell-project 0.0.0 green(). "Pushing to git"
159 executescip-shell shell shell-project 0.0.0 execute(). git push xfer
160 executescip-shell shell shell-project 0.0.0 execute(). git push xfer --tags
161 executescip-shell shell shell-project 0.0.0 execute(). git push --set-upstream origin $git_branch
162 executescip-shell shell shell-project 0.0.0 execute(). git push origin --tags
163 executescip-shell shell shell-project 0.0.0 execute(). git push --set-upstream github $git_branch
164 executescip-shell shell shell-project 0.0.0 execute(). git push github --tags