Merge lp:~jontai/openvista-gtm-integration/bug519041 into lp:openvista-gtm-integration

Proposed by Jon Tai
Status: Merged
Merged at revision: not available
Proposed branch: lp:~jontai/openvista-gtm-integration/bug519041
Merge into: lp:openvista-gtm-integration
Diff against target: 276 lines (+183/-19)
8 files modified
docs/man1/ovcompile.1 (+43/-0)
packages/deb/Ubuntu/10.04/openvista-gtm-integration/debian/openvista-utils.manpages (+1/-0)
packages/deb/Ubuntu/9.04/openvista-gtm-integration/debian/openvista-utils.manpages (+1/-0)
packages/deb/Ubuntu/9.10/openvista-gtm-integration/debian/openvista-utils.manpages (+1/-0)
scripts/etc/bash_completion.d/openvista (+1/-0)
scripts/usr/bin/ovcompile (+113/-0)
scripts/usr/bin/ovimport (+21/-10)
scripts/usr/sbin/ovrestore (+2/-9)
To merge this branch: bzr merge lp:~jontai/openvista-gtm-integration/bug519041
Reviewer Review Type Date Requested Status
jeff.apple Approve
Review via email: mp+18965@code.launchpad.net
To post a comment you must log in.
125. By Jon Tai

move the temporary gtmroutines setting into the subshell for consistency -- in the futurei, if ovcompile needs to do more stuff after the compile, gtmroutines will go back to "normal" after the subshell

Revision history for this message
jeff.apple (jeff-apple) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'docs/man1/ovcompile.1'
2--- docs/man1/ovcompile.1 1970-01-01 00:00:00 +0000
3+++ docs/man1/ovcompile.1 2010-02-10 00:00:35 +0000
4@@ -0,0 +1,43 @@
5+.TH ovcompile 1 "9 Feb 2010" Linux "User Manuals"
6+.SH NAME
7+ovcompile \- (re)compile routines in an OpenVista instance
8+.SH SYNOPSIS
9+.B ovcompile [-h] [-V]
10+.I instance_name
11+.SH DESCRIPTION
12+.B ovcompile
13+(re)compiles all routines in an OpenVista instance.
14+.PP
15+Routines should be compiled before users access the system, otherwise
16+compilation errors will be shown to the user.
17+.B ovimport
18+and
19+.B ovrestore
20+both compile routines automatically when they are run. If routines are
21+manually copied into an OpenVista instance, or if the version of GT.M an
22+instance is using is upgraded,
23+.B ovcompile
24+should be used to force all routines to be recompiled.
25+.SH OPTIONS
26+.IP -h
27+display help text and exit
28+.IP -V
29+display version information and exit
30+.SH "EXIT VALUES"
31+.IP 0
32+Success
33+.IP 1
34+Permission denied
35+.IP 2
36+Invalid command syntax
37+.IP 3
38+Invalid argument to option
39+.SH "REPORTING BUGS"
40+Please report any bugs you encounter at
41+.PP
42+https://bugs.launchpad.net/openvista-gtm-integration
43+.SH AUTHOR
44+Jonathan Tai <jon.tai@medsphere.com>
45+.SH "SEE ALSO"
46+.BR ovimport (1)
47+.BR ovrestore (8)
48
49=== modified file 'packages/deb/Ubuntu/10.04/openvista-gtm-integration/debian/openvista-utils.manpages'
50--- packages/deb/Ubuntu/10.04/openvista-gtm-integration/debian/openvista-utils.manpages 2010-01-16 22:24:12 +0000
51+++ packages/deb/Ubuntu/10.04/openvista-gtm-integration/debian/openvista-utils.manpages 2010-02-10 00:00:35 +0000
52@@ -12,3 +12,4 @@
53 docs/man1/ovimport.1
54 docs/man1/ovcheckperms.1
55 docs/man1/ovgetvar.1
56+docs/man1/ovcompile.1
57
58=== modified file 'packages/deb/Ubuntu/9.04/openvista-gtm-integration/debian/openvista-utils.manpages'
59--- packages/deb/Ubuntu/9.04/openvista-gtm-integration/debian/openvista-utils.manpages 2009-12-12 01:28:35 +0000
60+++ packages/deb/Ubuntu/9.04/openvista-gtm-integration/debian/openvista-utils.manpages 2010-02-10 00:00:35 +0000
61@@ -12,3 +12,4 @@
62 docs/man1/ovimport.1
63 docs/man1/ovcheckperms.1
64 docs/man1/ovgetvar.1
65+docs/man1/ovcompile.1
66
67=== modified file 'packages/deb/Ubuntu/9.10/openvista-gtm-integration/debian/openvista-utils.manpages'
68--- packages/deb/Ubuntu/9.10/openvista-gtm-integration/debian/openvista-utils.manpages 2009-12-12 01:28:35 +0000
69+++ packages/deb/Ubuntu/9.10/openvista-gtm-integration/debian/openvista-utils.manpages 2010-02-10 00:00:35 +0000
70@@ -12,3 +12,4 @@
71 docs/man1/ovimport.1
72 docs/man1/ovcheckperms.1
73 docs/man1/ovgetvar.1
74+docs/man1/ovcompile.1
75
76=== modified file 'scripts/etc/bash_completion.d/openvista'
77--- scripts/etc/bash_completion.d/openvista 2009-12-17 01:09:28 +0000
78+++ scripts/etc/bash_completion.d/openvista 2010-02-10 00:00:35 +0000
79@@ -80,6 +80,7 @@
80 complete -F _openvista ovpurgejournals
81 complete -F _openvista ovswitchjournals
82 complete -F _openvista ovcheckperms
83+complete -F _openvista ovcompile
84
85 # ovbackup [-h] [-V] [-q] INSTANCE_NAME
86 _ovbackup()
87
88=== added file 'scripts/usr/bin/ovcompile'
89--- scripts/usr/bin/ovcompile 1970-01-01 00:00:00 +0000
90+++ scripts/usr/bin/ovcompile 2010-02-10 00:00:35 +0000
91@@ -0,0 +1,113 @@
92+#!/bin/bash
93+
94+# This script (re)compiles all routines in an OpenVista instance.
95+
96+
97+# Copyright (C) 2010 Medsphere Systems Corporation
98+#
99+# This program is free software; you can redistribute it and/or modify it solely
100+# under the terms of the GNU Affero General Public License version 3 as published
101+# by the Free Software Foundation.
102+#
103+# This program is distributed in the hope that it will be useful, but WITHOUT
104+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
105+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
106+# for more details.
107+#
108+# You should have received a copy of the GNU Affero General Public License
109+# along with this program. If not, see <http://www.gnu.org/licenses>.
110+#
111+# You can contact Medsphere Systems Corporation headquarters at 1917 Palomar
112+# Oaks Way, Suite 200, Carlsbad, CA 92008 or at legal@medsphere.com.
113+
114+
115+# common functions
116+. /usr/lib/openvista/functions
117+
118+# parse arguments
119+while getopts hV option; do
120+ case $option in
121+ h)
122+ cat <<EOF
123+Usage: ovcompile INSTANCE_NAME
124+ or ovcompile -h
125+ or ovcompile -V
126+
127+ -h display this help text and exit
128+ -V display version information and exit
129+EOF
130+ exit 0
131+ ;;
132+ V)
133+ cat <<EOF
134+ovcompile 0.8.7
135+Copyright (C) 2010 Medsphere Systems Corporation
136+
137+ovcompile is powered by Medsphere and part of a suite of open source
138+utilities licensed under the AGPL, available at http://medsphere.org.
139+EOF
140+ exit 0
141+ ;;
142+ esac
143+done
144+shift `expr $OPTIND - 1`
145+
146+# check command syntax
147+if [ -z "$1" ]; then
148+ echo "ovcompile: missing OpenVista instance name" >&2
149+ echo "Try 'ovcompile -h' for more information" >&2
150+ exit 2
151+fi
152+
153+# check permissions
154+in_groups || {
155+ echo "ovcompile: permission denied" >&2
156+ exit 1
157+}
158+
159+# check for for valid arguments (requires correct permissions to do; must happen after permission checks)
160+set_gtm_env "$1" || {
161+ echo "ovcompile: $instance: Not an OpenVista instance" >&2
162+ exit 3
163+}
164+
165+tempdir=`mktemp -d -p "$root/$instance/tmp" .ovcompile.XXXXXXXXXX` ||
166+exit_with_error "ovcompile" "Unable to create temporary directory"
167+
168+# the EXIT handler may or may not run if we're interrupted or killed depending
169+# on the shell used (from what I've read, it does run on bash, but not on
170+# dash); use $exit to exit with the correct status in both cases
171+trap 'rm -rf "$tempdir"; exit ${exit:-0}' EXIT
172+
173+trap 'rm -rf "$tempdir"; exit ${exit:=130}' INT
174+trap 'rm -rf "$tempdir"; exit ${exit:=143}' TERM
175+
176+# we use mumps to compile all the files via auto-zlink; this will ensure that
177+# the correct version of the routine is compiled if more than one version
178+# exists in a different tier and that the object file is compiled to the right
179+# place.
180+
181+(
182+ umask 007
183+
184+ # create a temporary mumps routine to do the compilation. we used to do this
185+ # all one one line, but then we couldn't handle errors in the FOR loop.
186+ cat > "$tempdir/MSCOVCOMPILE.m" <<EOF
187+MSCOVCOMPILE
188+ N %ZR D SILENT^%RSEL("*")
189+ N \$ETRAP S \$ETRAP="S \$ECODE="""" Q"
190+ N R S R=""
191+ F S R=\$O(%ZR(R)) Q:R="" D
192+ . ZLINK \$S(\$E(R)="%":"_"_\$E(R,2,\$L(R)),1:R)
193+EOF
194+
195+ # prepend the temporary directory to gtmroutines
196+ gtmroutines="$tempdir $gtmroutines"
197+ export gtmroutines
198+
199+ # call the temporary routine
200+ echo -e 'D ^MSCOVCOMPILE\nH\n' | mumps -dir 2>&1 \
201+ | grep -v '^$' | grep -v '>$' \
202+ | logger -p user.info -t "ovcompile[$$]"
203+)
204+
205
206=== modified file 'scripts/usr/bin/ovimport'
207--- scripts/usr/bin/ovimport 2010-01-11 20:58:19 +0000
208+++ scripts/usr/bin/ovimport 2010-02-10 00:00:35 +0000
209@@ -278,15 +278,8 @@
210 # -t target) that %RSEL will come up empty and no routines will be
211 # compiled.
212
213- # use mumps to compile all the files via auto-zlink; this will ensure that the
214- # correct version of the routine is compiled if more than one version exists
215- # in a different tier and that the object file is compiled to the right place.
216- (
217- umask 007
218- echo -e 'D SILENT^%RSEL("*") S R="" F S R=$O(%ZR(R)) Q:R="" ZLINK $S($E(R)="%":"_"_$E(R,2,$L(R)),1:R)\nH\n' | mumps -dir 2>&1 \
219- | grep -v '^$' | grep -v '>$' \
220- | logger -p user.info -t "ovimport[$$]"
221- )
222+ # call ovcompile to do the actual work
223+ ovcompile "$instance"
224 ;;
225 none)
226 print_status "ovimport" "Skipping routine compilation" "$skip_status"
227@@ -296,8 +289,26 @@
228
229 (
230 umask 007
231+
232+ # create a temporary mumps routine to do the compilation. we used to do this
233+ # all one one line, but then we couldn't handle errors in the FOR loop.
234+ cat > "$tempdir/MSCOVIMPORT.m" <<EOF
235+MSCOVIMPORT
236+ N LIST S LIST="$tempdir/ovimport.compile.uniq"
237+ O LIST:(readonly) U LIST
238+ N \$ETRAP S \$ETRAP="S \$ECODE="""" Q"
239+ N ROUTINE F R ROUTINE Q:ROUTINE="" D
240+ . ZLINK ROUTINE
241+ C LIST
242+ U \$P
243+EOF
244+
245+ # prepend the temporary directory to gtmroutines
246+ gtmroutines="$tempdir $gtmroutines"
247+ export gtmroutines
248+
249 cat "$tempdir/ovimport.compile" | sort | uniq > "$tempdir/ovimport.compile.uniq"
250- echo -e 'S LIST="'"$tempdir/ovimport.compile.uniq"'"\nO LIST:(readonly) U LIST F R ROUTINE Q:ROUTINE="" ZLINK ROUTINE\nC LIST U $P\nH\n' | mumps -dir 2>&1 \
251+ echo -e 'D ^MSCOVIMPORT\nH\n' | mumps -dir 2>&1 \
252 | tee "$tempdir/ovimport.zlink" \
253 | grep -v '^$' | grep -v '>$' \
254 | logger -p user.info -t "ovimport[$$]"
255
256=== modified file 'scripts/usr/sbin/ovrestore'
257--- scripts/usr/sbin/ovrestore 2010-01-11 20:58:19 +0000
258+++ scripts/usr/sbin/ovrestore 2010-02-10 00:00:35 +0000
259@@ -292,15 +292,8 @@
260 find "$root/$instance/objects/" -type f -name '*.o' -exec rm -f {} \; ||
261 exit_with_error "ovrestore" "Unable to remove existing object files"
262
263-# use mumps to compile all the files via auto-zlink; this will ensure that the
264-# correct version of the routine is compiled if more than one version exists
265-# in more than one tier and that the object file is compiled to the right place.
266-(
267- umask 007
268- echo -e 'D SILENT^%RSEL("*") S R="" F S R=$O(%ZR(R)) Q:R="" ZLINK $S($E(R)="%":"_"_$E(R,2,$L(R)),1:R)\nH\n' | mumps -dir 2>&1 \
269- | grep -v '^$' | grep -v '>$' \
270- | logger -p user.info -t "ovrestore[$$]"
271-)
272+# call ovcompile to do the actual work
273+ovcompile "$instance"
274
275 # if we're not applying journals, shut off journaling on the old database so
276 # that there's a clean break, then move the journal file out of the way

Subscribers

People subscribed via source and target branches