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

Proposed by Jon Tai
Status: Merged
Merged at revision: not available
Proposed branch: lp:~jontai/openvista-gtm-integration/bug440743
Merge into: lp:openvista-gtm-integration
Diff against target: 198 lines (+58/-25)
3 files modified
docs/man1/ovimport.1 (+17/-8)
scripts/etc/bash_completion.d/openvista (+3/-3)
scripts/usr/bin/ovimport (+38/-14)
To merge this branch: bzr merge lp:~jontai/openvista-gtm-integration/bug440743
Reviewer Review Type Date Requested Status
jeff.apple Approve
Review via email: mp+15463@code.launchpad.net
To post a comment you must log in.
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=== modified file 'docs/man1/ovimport.1'
2--- docs/man1/ovimport.1 2009-07-09 23:48:40 +0000
3+++ docs/man1/ovimport.1 2009-12-01 00:20:24 +0000
4@@ -2,7 +2,9 @@
5 .SH NAME
6 ovimport \- imports routines and globals into a new OpenVista instance
7 .SH SYNOPSIS
8-.B ovimport [-h] [-V] [-q] [-f] [-r
9+.B ovimport [-h] [-V] [-q] [-f] [-c
10+.I imported|all|none
11+.B ] [-r
12 .I routines
13 .B ] [-g
14 .I globals
15@@ -34,8 +36,13 @@
16 flag is given, although imported routines and globals will overwrite any
17 routines or globals with the same name.
18 .PP
19-Routines are compiled after the routines are imported. Journaling is
20-temporarily disabled during the global import to improve performance, unless the
21+Routines are compiled after the routines are imported. By default, only
22+imported routines are compiled. You should use
23+.B -c all
24+if you want to recompile all routines or
25+.B -c none
26+if you do not want to compile any routines. Journaling is temporarily disabled
27+during the global import to improve performance, unless the
28 .B -f
29 flag was given. This is safe to do because the database is guaranteed to be
30 empty before the import, so even if the system crashes and the database is
31@@ -59,14 +66,16 @@
32 display help text and exit
33 .IP -V
34 display version information and exit
35-.IP -y
36-do not ask for confirmation
37 .IP -q
38 quiet; suppress status messages
39-.IP -j
40-after restoring the backup, apply journal entries
41 .IP -f
42-force; kill any processes accessing the database before restore
43+force; import routines and globals even if target instance is not empty
44+.IP -c
45+compile imported routines only (the default), all routines, or no routines
46+.IP -r
47+path to routine export file, archive, or directory
48+.IP -g
49+path to global export file or archive
50 .SH "REPORTING BUGS"
51 Please report any bugs you encounter at
52 .PP
53
54=== modified file 'scripts/etc/bash_completion.d/openvista'
55--- scripts/etc/bash_completion.d/openvista 2009-04-23 23:17:19 +0000
56+++ scripts/etc/bash_completion.d/openvista 2009-12-01 00:20:24 +0000
57@@ -134,10 +134,10 @@
58
59 complete -F _ovinstanceadd ovinstanceadd
60
61-# ovimport [-h] [-V] [-q] [-f] [-r] ROUTINES [-g] GLOBALS INSTANCE_NAME
62+# ovimport [-h] [-V] [-q] [-f] [-c imported|all|none] [-r] ROUTINES [-g] GLOBALS INSTANCE_NAME
63 _ovimport()
64 {
65- opts='-h -V -q -f -r -g'
66+ opts='-h -V -q -f -c -r -g'
67 allowed_nonopt_words=1
68
69 COMPREPLY=()
70@@ -157,7 +157,7 @@
71 # afterward; use a hack to exit on the next iteration of
72 # the loop
73 allowed_nonopt_words=0
74- elif [ x"${COMP_WORDS[i]}" = x"-r" ] || [ x"${COMP_WORDS[i]}" = x"-g" ]; then
75+ elif [ x"${COMP_WORDS[i]}" = x"-c" ] || [ x"${COMP_WORDS[i]}" = x"-r" ] || [ x"${COMP_WORDS[i]}" = x"-g" ]; then
76 allowed_nonopt_words=`expr $allowed_nonopt_words + 1`
77 fi
78 ;;
79
80=== modified file 'scripts/usr/bin/ovimport'
81--- scripts/usr/bin/ovimport 2009-10-31 06:23:59 +0000
82+++ scripts/usr/bin/ovimport 2009-12-01 00:20:24 +0000
83@@ -25,16 +25,17 @@
84 . /usr/lib/openvista/functions
85
86 # parse arguments
87-while getopts hVqfr:g: option; do
88+while getopts hVqfc:r:g: option; do
89 case $option in
90 h)
91 cat <<EOF
92-Usage: ovimport [-q] [-f] [-r ROUTINES] [-g GLOBALS] INSTANCE_NAME
93+Usage: ovimport [-q] [-f] [-c imported|all|none] [-r ROUTINES] [-g GLOBALS] INSTANCE_NAME
94 or ovimport -h
95 or ovimport -V
96
97 -q quiet; suppress status messages
98 -f force; import routines and globals even if target instance is not empty
99+ -c compile imported routines only (the default), all routines, or no routines
100 -r path to routine export file, archive, or directory
101 -g path to global export file or archive
102 -h display this help text and exit
103@@ -58,6 +59,9 @@
104 f)
105 force=true
106 ;;
107+ c)
108+ compile=$OPTARG
109+ ;;
110 r)
111 routines=$OPTARG
112 ;;
113@@ -82,7 +86,7 @@
114
115 # check permissions
116 in_groups || {
117- echo "ovimport: permission denied" >&2
118+ echo "ovimport: permission denied" >&2
119 exit 1
120 }
121
122@@ -111,9 +115,9 @@
123 }
124 fi
125
126-tempdir=`mktemp -d -p "$root/$instance/tmp" .ovimport.XXXXXXXXXX` ||
127+tempdir=`mktemp -d -p "$root/$instance/tmp" .ovimport.XXXXXXXXXX` ||
128 exit_with_error "ovimport" "Unable to create temporary directory"
129-
130+
131 # the EXIT handler may or may not run if we're interrupted or killed depending
132 # on the shell used (from what I've read, it does run on bash, but not on
133 # dash); use $exit to exit with the correct status in both cases
134@@ -190,7 +194,7 @@
135 real_routines=`cd "$dirname"; pwd`/"$basename"
136
137 # redirect output to a temporary file because we need to both log
138- # the output and inspect it to determine success
139+ # the output and inspect it to determine success
140 (
141 umask 007
142 mumps -run ^%RI > "$tempdir/ovimport.ri" 2>&1 <<EOF
143@@ -206,13 +210,15 @@
144
145 grep '^Restored [0-9]\{1,\} lines in [0-9]\{1,\} routines' "$tempdir/ovimport.ri" > /dev/null ||
146 exit_with_error "ovimport" "Unable to import routines"
147+
148+ awk '{ if ($0 ~ /^Restored [0-9]+ lines in [0-9]+ routines/) { capture = 0 } if (capture == 1 && NF != 0) { print $0 } if ($0 ~ /^Output directory/) { capture = 1 } }' "$tempdir/ovimport.ri" > "$tempdir/ovimport.compile"
149 ;;
150 M)
151 print_status "ovimport" "Copying routines" "$skip_status"
152
153 (
154 umask 007
155- rsync -rl --exclude '.*/' --include '*/' --include '*.m' --exclude '*' "$real_routines/" "$root/$instance/routines/"
156+ rsync -rl --exclude '.*/' --include '*/' --include '*.m' --exclude '*' --out-format='%n' "$real_routines/" "$root/$instance/routines/" > "$tempdir/ovimport.compile"
157 ) || exit_with_error "ovimport" "Unable to import routines"
158
159 # the umask is not enough to guarantee that the routines are user
160@@ -225,13 +231,31 @@
161 ;;
162 esac
163
164- print_status "ovimport" "Compiling routines" "$skip_status"
165-
166- (
167- umask 007
168- cd "$root/$instance/objects" &&
169- find "$root/$instance/routines/" -type f -name '*.m' -exec mumps {} \; 2> /dev/null
170- ) || exit_with_error "ovimport" "Unable to compile routines"
171+ case $compile in
172+ all)
173+ print_status "ovimport" "Compiling all routines" "$skip_status"
174+
175+ (
176+ umask 007
177+ cd "$root/$instance/objects" &&
178+ find "$root/$instance/routines/" -type f -name '*.m' -exec mumps {} \; 2> /dev/null
179+ ) || exit_with_error "ovimport" "Unable to compile routines"
180+ ;;
181+ none)
182+ print_status "ovimport" "Skipping routine compilation" "$skip_status"
183+ ;;
184+ *)
185+ print_status "ovimport" "Compiling imported routines" "$skip_status"
186+
187+ (
188+ umask 007
189+ cd "$root/$instance/objects" &&
190+ for routine in `cat "$tempdir/ovimport.compile" | sed 's/\.m//g'`; do
191+ mumps "../routines/$routine.m" 2> /dev/null
192+ done
193+ )
194+ ;;
195+ esac
196
197 print_status "ovimport" "Finished loading $routines into $instance" "$skip_status"
198 fi

Subscribers

People subscribed via source and target branches