Annotation of embedaddon/ntp/scripts/UpdatePoint, revision 1.1.1.1
1.1 misho 1: #! /bin/sh
2:
3: # showusage is set to 1 on any command-line syntax error
4: showusage=0
5: # are we playing by stable or dev rules?
6: repo=
7: # test is set to 1 if -t/--test is given to prevent modifications
8: test=0
9:
10: case "$#" in
11: 1) repo=$1
12: ;;
13: 2) repo=$2
14: case $1 in
15: -t|--test)
16: test=1
17: ;;
18: *)
19: showusage=1
20: ;;
21: esac
22: ;;
23: *) showusage=1
24: ;;
25: esac
26:
27: case "$repo" in
28: dev|stable)
29: ;;
30: '')
31: showusage=1
32: ;;
33: *) echo "Unexpected repo type: <$repo>!"
34: showusage=1
35: ;;
36: esac
37:
38: case "$showusage" in
39: 1) echo "Usage: $0 [-t] <stable|dev>"
40: echo "No changes are made to packageinfo.sh if -t is given."
41: exit 1
42: ;;
43: esac
44:
45:
46: set -e
47:
48: . ./packageinfo.sh
49:
50: case "$repotype" in
51: $repo)
52: ;;
53: *) echo "You indicated repo type <$repo> but packageinfo.sh"
54: echo "indicates <$repotype>."
55: exit 1
56: ;;
57: esac
58:
59: ver_repo_mismatch=1
60:
61: case "$minor" in
62: 1|3|5|7|9)
63: case "$repo" in
64: dev)
65: ver_repo_mismatch=0
66: ;;
67: stable)
68: ;;
69: esac
70: ;;
71: 0|2|4|6|8)
72: case "$repo" in
73: dev)
74: ;;
75: stable)
76: ver_repo_mismatch=0
77: ;;
78: esac
79: ;;
80: esac
81:
82: case "$ver_repo_mismatch" in
83: 1) echo "Minor version <$minor> mismatches repotype <$repo>."
84: exit 1
85: ;;
86: esac
87:
88: # Do we want to bump the point?
89: bp=1
90: # Do we want to bump the beta point?
91: bbp=0
92: # Do we want to change the RC point? (n=no, z=empty rcpoint and zero
93: # betapoint, i=incr)
94: crcp=n
95: # Do we want to change the prerelease value?
96: setpr=0
97:
98: # for stable:
99: # if we are not in a beta or RC state, enter beta unless point is NEW.
100: # if we are in a beta state:
101: # - bump the beta point
102: # else if we are in an RC state:
103: # - if rcpoint is GO:
104: # - - set rcpoint= (empty)
105: # - - set prerelease= (empty)
106: # - - set betapoint=0
107: # - else
108: # - - if rcpoint==(empty)
109: # - - - (bump-point) and set rcpoint to 0 (and fall thru, so -RC1 is first)
110: # - - bump the RC point
111:
112: # for dev, we only want to bump-point and possibly clear prerelease,
113: # but we do not modify rcpoint nor betapoint.
114:
115: case "$repo" in
116: dev)
117: case "$point" in
118: [Nn][Ee][Ww])
119: crcp=z
120: ;;
121: *)
122: # crcp=n
123: ;;
124: esac
125: # bp=1
126: ;;
127: stable)
128: case "$prerelease" in
129: '')
130: case "$betapoint::$rcpoint::$point" in
131: *::*::NEW)
132: # new minor release (no p)
133: crcp=z
134: # bp=1
135: ;;
136: 0::::*)
137: # start of first beta cycle for the next point release
138: setpr=1
139: newpr=beta
140: # bp=1
141: bbp=1
142: ;;
143: 0::[Gg][Oo]::*)
144: # skip all -beta and -RC prereleases to the next point.
145: crcp=z
146: setpr=1
147: newpr=
148: # bp=1
149: # bbp=0
150: ;;
151: *) echo "betapoint is <$betapoint>, rcpoint is <$rcpoint>"
152: echo "betapoint must be 0 and rcpoint must be empty to start the"
153: echo "beta cycle."
154: exit 1
155: ;;
156: esac
157: ;;
158: beta)
159: case "$betapoint::$rcpoint" in
160: [1-9]*::*)
161: bp=0
162: bbp=1
163: ;;
164: 0::) echo "betapoint is 0, rcpoint emtpy, and prerelease is beta."
165: echo "You probably intended prerelease= (that is, empty). It"
166: echo "will then be changed to beta by this script, starting the"
167: echo "first beta for the next point release."
168: exit 1
169: ;;
170: *)
171: bp=0
172: bbp=1
173: ;;
174: esac
175: case "$rcpoint" in
176: [Gg][Oo])
177: echo "prerelease is beta, rcpoint is GO, disallowed."
178: echo "rcpoint GO is allowed only when prerelease is RC or empty."
179: exit 1
180: ;;
181: esac
182: ;;
183: rc|RC)
184: case "$rcpoint" in
185: '')
186: case "$betapoint" in
187: 0) # bp=1
188: ;;
189: *) bp=0
190: ;;
191: esac
192: crcp=i
193: ;;
194: [1-9]*)
195: bp=0
196: crcp=i
197: ;;
198: [Gg][Oo])
199: bp=0
200: crcp=z
201: setpr=1
202: newpr=
203: ;;
204: *) echo "Unexpected value for 'rcpoint' <$rcpoint>!"
205: exit 1
206: ;;
207: esac
208: ;;
209: *)
210: echo "prerelease <$prerelease> unexpected"
211: exit 1
212: ;;
213: esac
214: ;;
215: *) echo "impossible: repo <$repo>!"
216: exit 1
217: ;;
218: esac
219:
220: case "$bp::$point" in
221: 0::*)
222: newpoint=$point
223: ;;
224: 1::[1-9]*)
225: newpoint=`expr $point + 1`
226: ;;
227: 1::)
228: newpoint=1
229: ;;
230: 1::[Nn][Ee][Ww])
231: newpoint=
232: ;;
233: *) echo "Unexpected value for 'point' <$point>!"
234: exit 1
235: ;;
236: esac
237:
238: case "$bbp::$betapoint" in
239: 0::*)
240: newbetapoint=$betapoint
241: ;;
242: 1::[0-9]*)
243: newbetapoint=`expr $betapoint + 1`
244: ;;
245: *) echo "Unexpected value for 'betapoint' <$betapoint>!"
246: exit 1
247: ;;
248: esac
249:
250: case "$crcp::$rcpoint" in
251: n::*)
252: newrcpoint=$rcpoint
253: ;;
254: i::)
255: newrcpoint=1
256: ;;
257: i::[0-9]*)
258: newrcpoint=`expr $rcpoint + 1`
259: ;;
260: z::*)
261: newrcpoint=
262: newbetapoint=0
263: ;;
264: *) echo "Unexpected value for 'crcp::rcpoint' <$crcp::$rcpoint>!"
265: exit 1
266: ;;
267: esac
268:
269: case "$setpr" in
270: 0)
271: newpr=$prerelease
272: esac
273:
274: # display results
275: printf "prerelease $prerelease"
276: case "$newpr" in
277: $prerelease)
278: printf "\n"
279: ;;
280: *) printf " -> $newpr\n"
281: ;;
282: esac
283: printf "point $point"
284: case "$newpoint" in
285: $point)
286: printf "\n"
287: ;;
288: *) printf " -> $newpoint\n"
289: ;;
290: esac
291: printf "betapoint $betapoint"
292: case "$newbetapoint" in
293: $betapoint)
294: printf "\n"
295: ;;
296: *) printf " -> $newbetapoint\n"
297: ;;
298: esac
299: printf "rcpoint $rcpoint"
300: case "$newrcpoint" in
301: $rcpoint)
302: printf "\n"
303: ;;
304: *) printf " -> $newrcpoint\n"
305: ;;
306: esac
307:
308: printf "Previous version: "
309: scripts/VersionName
310:
311: # apply packageinfo.sh changes
312:
313: sed -e "s/^point=.*/point=$newpoint/" \
314: -e "s/^betapoint=.*/betapoint=$newbetapoint/" \
315: -e "s/^rcpoint=.*/rcpoint=$newrcpoint/" \
316: -e "s/^prerelease=.*/prerelease=$newpr/" \
317: < packageinfo.sh \
318: > packageinfo.sh+
319:
320: case "$test" in
321: 0)
322: mv packageinfo.sh+ packageinfo.sh
323: printf "Updated version: "
324: scripts/VersionName
325: ;;
326: *)
327: printf "Next version would be: "
328: scripts/VersionName -p ./packageinfo.sh+
329: rm packageinfo.sh+
330: ;;
331: esac
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>