Fixed paths. (mail_prepare_spools,mail_cleanup_spools): new procedures.
Showing
1 changed file
with
44 additions
and
6 deletions
... | @@ -23,6 +23,12 @@ if [info exists TOOL_EXECUTABLE] { | ... | @@ -23,6 +23,12 @@ if [info exists TOOL_EXECUTABLE] { |
23 | if ![info exists MAIL] { | 23 | if ![info exists MAIL] { |
24 | if ![is_remote host] { | 24 | if ![is_remote host] { |
25 | set MAIL [findfile $base_dir/../mail "$base_dir/../mail" [transform mail]] | 25 | set MAIL [findfile $base_dir/../mail "$base_dir/../mail" [transform mail]] |
26 | set MAIL_SPOOL_SOURCE "$srcdir/spool" | ||
27 | set MAIL_FOLDER_SOURCE "$srcdir/folder" | ||
28 | set MAIL_SPOOL_DIR "$objdir/data/spool" | ||
29 | set MAIL_FOLDER_DIR "$objdir/data/folder" | ||
30 | set MAIL_RC_DIR "$srcdir/etc" | ||
31 | set MAKESPOOL "$srcdir/makespool" | ||
26 | } else { | 32 | } else { |
27 | if [info exists host_board] { | 33 | if [info exists host_board] { |
28 | if [board_info $host_board exists top_builddir] { | 34 | if [board_info $host_board exists top_builddir] { |
... | @@ -38,18 +44,24 @@ if ![info exists MAIL] { | ... | @@ -38,18 +44,24 @@ if ![info exists MAIL] { |
38 | perror "for instructions on how to set up it." | 44 | perror "for instructions on how to set up it." |
39 | exit 1 | 45 | exit 1 |
40 | } | 46 | } |
47 | set MAIL_RC_DIR "[board_info $host_board srcdir]/etc" | ||
48 | set MAIL_SPOOL_SOURCE "[board_info $host_board srcdir]/spool" | ||
49 | set MAIL_FOLDER_SOURCE "[board_info $host_board srcdir]/folder" | ||
50 | set MAIL_SPOOL_DIR "[board_info $host_board objdir]/data/spool" | ||
51 | set MAIL_FOLDER_DIR "[board_info $host_board objdir]/data/folder" | ||
52 | set MAKESPOOL "[board_info $host_board srcdir]/makespool" | ||
41 | } | 53 | } |
42 | } | 54 | } |
43 | 55 | ||
44 | verbose "using MAIL = $MAIL" 2 | 56 | verbose "using MAIL = $MAIL" 2 |
45 | 57 | ||
46 | if ![info exists MAILFLAGS] { | 58 | if ![info exists MAILFLAGS] { |
47 | set MAILFLAGS "--nosum --norc --mail-spool $srcdir/spool" | 59 | set MAILFLAGS "--nosum --norc --mail-spool $MAIL_SPOOL_DIR" |
48 | } | 60 | } |
49 | 61 | ||
50 | #FIXME: | 62 | #FIXME: this doesn't work with remote testing |
51 | set env(MAILRC) $srcdir/etc/mail.rc | 63 | set env(MAILRC) $MAIL_RC_DIR/mail.rc |
52 | set env(MBOX) $srcdir/spool/mbox | 64 | set env(MBOX) "$MAIL_SPOOL_DIR/mbox" |
53 | 65 | ||
54 | # The variable mail_prompt is a regexp which matches the mail prompt. | 66 | # The variable mail_prompt is a regexp which matches the mail prompt. |
55 | global mail_prompt | 67 | global mail_prompt |
... | @@ -59,6 +71,31 @@ if ![info exists mail_prompt] then { | ... | @@ -59,6 +71,31 @@ if ![info exists mail_prompt] then { |
59 | 71 | ||
60 | ### Only procedures should come after this point. | 72 | ### Only procedures should come after this point. |
61 | 73 | ||
74 | proc mail_prepare_spools {} { | ||
75 | global MAIL_SPOOL_SOURCE | ||
76 | global MAIL_SPOOL_DIR | ||
77 | global MAIL_FOLDER_SOURCE | ||
78 | global MAIL_FOLDER_DIR | ||
79 | global MAKESPOOL | ||
80 | |||
81 | set output [remote_exec host "$MAKESPOOL \ | ||
82 | $MAIL_SPOOL_SOURCE $MAIL_SPOOL_DIR\ | ||
83 | $MAIL_FOLDER_SOURCE $MAIL_FOLDER_DIR"] | ||
84 | } | ||
85 | |||
86 | proc mail_cleanup_spools {} { | ||
87 | global MAIL_SPOOL_SOURCE | ||
88 | global MAIL_SPOOL_DIR | ||
89 | global MAIL_FOLDER_SOURCE | ||
90 | global MAIL_FOLDER_DIR | ||
91 | global MAKESPOOL | ||
92 | |||
93 | if { $MAIL_SPOOL_SOURCE != $MAIL_SPOOL_DIR } { | ||
94 | set output [remote_exec host "$MAKESPOOL -r \ | ||
95 | $MAIL_SPOOL_DIR $MAIL_FOLDER_DIR"] | ||
96 | } | ||
97 | } | ||
98 | |||
62 | proc default_mail_version {} { | 99 | proc default_mail_version {} { |
63 | global MAIL | 100 | global MAIL |
64 | global MAILFLAGS | 101 | global MAILFLAGS |
... | @@ -96,6 +133,7 @@ proc default_mail_start {args} { | ... | @@ -96,6 +133,7 @@ proc default_mail_start {args} { |
96 | global expect_out | 133 | global expect_out |
97 | 134 | ||
98 | default_mail_version | 135 | default_mail_version |
136 | mail_prepare_spools | ||
99 | 137 | ||
100 | set sw $args | 138 | set sw $args |
101 | append sw " " | 139 | append sw " " |
... | @@ -107,7 +145,7 @@ proc default_mail_start {args} { | ... | @@ -107,7 +145,7 @@ proc default_mail_start {args} { |
107 | } | 145 | } |
108 | 146 | ||
109 | set mail_cmd "$MAIL $MAILFLAGS $args" | 147 | set mail_cmd "$MAIL $MAILFLAGS $args" |
110 | verbose "MAILRC is $srcdir/etc/mail.rc" 2 | 148 | verbose "MAILRC is $srcdir/etc/mail.rc" 2 |
111 | verbose "Spawning $mail_cmd" | 149 | verbose "Spawning $mail_cmd" |
112 | 150 | ||
113 | set res [remote_spawn host $mail_cmd] | 151 | set res [remote_spawn host $mail_cmd] |
... | @@ -156,7 +194,7 @@ proc mail_send { string } { | ... | @@ -156,7 +194,7 @@ proc mail_send { string } { |
156 | proc mail_command { cmd } { | 194 | proc mail_command { cmd } { |
157 | set res [mail_send "$cmd\n"] | 195 | set res [mail_send "$cmd\n"] |
158 | mail_expect 30 { | 196 | mail_expect 30 { |
159 | -ex "${cmd}\r\n" { } | 197 | -ex "\r\n" { } |
160 | default { | 198 | default { |
161 | perror "mail_command for target failed"; | 199 | perror "mail_command for target failed"; |
162 | return -1 | 200 | return -1 | ... | ... |
-
Please register or sign in to post a comment