… | |
… | |
83 | or return; |
83 | or return; |
84 | |
84 | |
85 | my ($pid, $fh); |
85 | my ($pid, $fh); |
86 | unless ($pid = open $fh, "-|:utf8", "-") { |
86 | unless ($pid = open $fh, "-|:utf8", "-") { |
87 | $SIG{__DIE__} = sub { |
87 | $SIG{__DIE__} = sub { |
|
|
88 | my $msg = $_[0]; |
|
|
89 | $msg =~ s/\n+/\n/; |
88 | warn "FATAL: @_\n"; |
90 | warn "FATAL: $msg"; |
89 | CFPlus::_exit 99; |
91 | CFPlus::_exit 99; |
90 | }; |
92 | }; |
91 | |
93 | |
92 | open STDERR, ">&STDOUT"; |
94 | open STDERR, ">&STDOUT"; |
93 | binmode STDOUT, ":utf8"; |
95 | binmode STDOUT, ":utf8"; |
… | |
… | |
124 | } |
126 | } |
125 | |
127 | |
126 | if (1) { # upload a map |
128 | if (1) { # upload a map |
127 | my $mapname = $::CONN->{map_info}[0]; |
129 | my $mapname = $::CONN->{map_info}[0]; |
128 | |
130 | |
|
|
131 | my $mappath = "$mapdir/$mapname"; |
|
|
132 | |
|
|
133 | -e $mappath and die "$mappath already exists\n"; |
|
|
134 | |
129 | print "getting map revision for $mapname...\n"; |
135 | print "getting map revision for $mapname...\n"; |
130 | |
136 | |
131 | # try to get the most recent head revision, what a hack, |
137 | # try to get the most recent head revision, what a hack, |
132 | # this should have been returned while downloading *sigh* |
138 | # this should have been returned while downloading *sigh* |
133 | my $log = (check_lwp $ua->get ("$editsup->{cvs_root}/$mapname?view=log&logsort=rev"))->decoded_content; |
139 | my $log = (check_lwp $ua->get ("$editsup->{cvs_root}/$mapname?view=log&logsort=rev"))->decoded_content; |
… | |
… | |
144 | path => $mapname, |
150 | path => $mapname, |
145 | revision => $rev, |
151 | revision => $rev, |
146 | cf_login => $::PROFILE->{user}, |
152 | cf_login => $::PROFILE->{user}, |
147 | }; |
153 | }; |
148 | |
154 | |
149 | my $mappath = "$mapdir/$mapname"; |
|
|
150 | |
|
|
151 | require File::Basename; |
155 | require File::Basename; |
152 | require File::Path; |
156 | require File::Path; |
153 | |
157 | |
154 | File::Path::mkpath (File::Basename::dirname ($mappath)); |
158 | File::Path::mkpath (File::Basename::dirname ($mappath)); |
155 | open my $fh, ">:raw:perlio", "$mappath.meta" |
159 | open my $fh, ">:raw:perlio", "$mappath.meta" |
156 | or die "$mappath.meta: $!"; |
160 | or die "$mappath.meta: $!\n"; |
157 | print $fh CFPlus::to_json $meta; |
161 | print $fh CFPlus::to_json $meta; |
158 | close $fh; |
162 | close $fh; |
159 | open my $fh, ">:raw:perlio:utf8", $mappath |
163 | open my $fh, ">:raw:perlio:utf8", $mappath |
160 | or die "$mappath: $!"; |
164 | or die "$mappath: $!\n"; |
161 | print $fh $map; |
165 | print $fh $map; |
162 | close $fh; |
166 | close $fh; |
163 | |
167 | |
164 | print "saved as $mappath\n"; |
168 | print "saved as $mappath\n"; |
165 | |
169 | |