… | |
… | |
80 | |
80 | |
81 | sub editor_invoke { |
81 | sub editor_invoke { |
82 | my $editsup = $::CONN && $::CONN->{editor_support} |
82 | my $editsup = $::CONN && $::CONN->{editor_support} |
83 | or return; |
83 | or return; |
84 | |
84 | |
85 | # putting the password into the env is somewhat tasteless |
|
|
86 | # local $ENV{CFPLUS_LOGIN} = $::PROFILE->{user}; |
|
|
87 | # local $ENV{CFPLUS_PASSWORD} = $::PROFILE->{password}; |
|
|
88 | # local $ENV{CFPLUS_UPLOAD} = $::CONN->{upload}; |
|
|
89 | |
|
|
90 | my ($pid, $fh); |
85 | my ($pid, $fh); |
91 | unless ($pid = open $fh, "-|:utf8", "-") { |
86 | unless ($pid = open $fh, "-|:utf8", "-") { |
92 | $SIG{__DIE__} = sub { |
87 | $SIG{__DIE__} = sub { |
93 | warn "@_\n"; |
88 | warn "FATAL: @_\n"; |
94 | CFPlus::_exit 99; |
89 | CFPlus::_exit 99; |
95 | }; |
90 | }; |
96 | |
91 | |
97 | open STDERR, ">&STDOUT"; |
92 | open STDERR, ">&STDOUT"; |
98 | binmode STDOUT, ":utf8"; |
93 | binmode STDOUT, ":utf8"; |
… | |
… | |
141 | my $rev = $1; |
136 | my $rev = $1; |
142 | |
137 | |
143 | print "downloading revision $rev...\n"; |
138 | print "downloading revision $rev...\n"; |
144 | |
139 | |
145 | my $map = (check_lwp $ua->get ("$editsup->{cvs_root}/$mapname?rev=$rev"))->decoded_content; |
140 | my $map = (check_lwp $ua->get ("$editsup->{cvs_root}/$mapname?rev=$rev"))->decoded_content; |
|
|
141 | |
|
|
142 | my $meta = { |
|
|
143 | %$editsup, |
|
|
144 | path => $mapname, |
|
|
145 | revision => $rev, |
|
|
146 | cf_login => $::PROFILE->{user}, |
|
|
147 | }; |
|
|
148 | |
|
|
149 | my $mappath = "$mapdir/$mapname"; |
|
|
150 | |
|
|
151 | require File::Basename; |
|
|
152 | require File::Path; |
|
|
153 | |
|
|
154 | File::Path::mkpath (File::Basename::dirname ($mappath)); |
|
|
155 | open my $fh, ">:raw:perlio", "$mappath.meta" |
|
|
156 | or die "$mappath.meta: $!"; |
|
|
157 | print $fh CFPlus::to_json $meta; |
|
|
158 | close $fh; |
|
|
159 | open my $fh, ">:raw:perlio:utf8", $mappath |
|
|
160 | or die "$mappath: $!"; |
|
|
161 | print $fh $map; |
|
|
162 | close $fh; |
|
|
163 | |
|
|
164 | print "saved as $mappath\n"; |
|
|
165 | |
|
|
166 | print "invoking editor...\n"; |
|
|
167 | exec "/root/s2/gce $mappath";#d# |
146 | |
168 | |
147 | # now upload it |
169 | # now upload it |
148 | # require HTTP::Request::Common; |
170 | # require HTTP::Request::Common; |
149 | # |
171 | # |
150 | # my $res = $ua->post ( |
172 | # my $res = $ua->post ( |
… | |
… | |
171 | # } |
193 | # } |
172 | } else { |
194 | } else { |
173 | die "viewvc parse error, unable to detect revision\n"; |
195 | die "viewvc parse error, unable to detect revision\n"; |
174 | } |
196 | } |
175 | } |
197 | } |
176 | |
|
|
177 | print "invoking editor...\n"; |
|
|
178 | exec "/root/s2/gce";#d# |
|
|
179 | |
198 | |
180 | CFPlus::_exit; |
199 | CFPlus::_exit; |
181 | } |
200 | } |
182 | |
201 | |
183 | my $buffer; |
202 | my $buffer; |