Changeset 28769 in osm for applications/editors/josm
- Timestamp:
- 2012-10-03T23:53:54+02:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/i18n/launchpad.pl
r28491 r28769 26 26 my $agent = "JOSM_Launchpad/1.$revision"; 27 27 28 my $count = 0;#11;29 28 my $cleanall = 0;#1; 30 my $upload = 0;#1;31 29 32 30 if($#ARGV != 0) … … 47 45 { 48 46 system "ant"; 49 makeupload();50 47 } 51 48 } … … 53 50 { 54 51 potupload(); 52 } 53 elsif($ARGV[0] eq "uploadall") 54 { 55 makeupload(); 56 } 57 elsif($ARGV[0] eq "approveall") 58 { 59 approveall(dologin()); 55 60 } 56 61 elsif($ARGV[0] eq "download") … … 76 81 } 77 82 83 sub approveall 84 { 85 my ($mech) = @_; 86 print "Trying to approve upload.\n"; 87 $mech->get("https://translations.launchpad.net/josm/trunk/+imports?field.filter_status=NEEDS_REVIEW&field.filter_extension=all"); 88 my @links; 89 foreach my $line (split("\n", $mech->content())) 90 { 91 push (@links, $1) if $line =~ /href="(\/\+imports\/\d+)"/; 92 } 93 if(!@links) 94 { 95 warn "No upload found in import list, upload possibly failed."; 96 } 97 else 98 { 99 foreach my $link (@links) 100 { 101 eval 102 { 103 print "Approve $link upload.\n"; 104 $mech->get("https://translations.launchpad.net$link"); 105 $mech->form_with_fields("field.potemplate"); 106 $mech->select("field.potemplate", "josm"); 107 $mech->click_button(name => "field.actions.approve"); 108 }; 109 print $@ if $@; 110 } 111 } 112 } 113 78 114 sub makeupload 79 115 { 80 if($upload) 81 { 82 my $outdate = `date -u +"%Y-%m-%dT%H_%M_%S"`; 83 chomp $outdate; 84 mkdir "build/josm"; 85 system "cp po/*.po po/josm.pot build/josm"; 86 chdir "build"; 87 if(!$count) 88 { 89 system "tar -cjf ../launchpad_upload_josm_$outdate.tar.bz2 josm"; 90 } 91 else 92 { 93 my @files = sort glob("josm/*.po"); 94 my $num = 1; 95 while($#files >= 0) 96 { 97 my @f = splice(@files, 0, $count); 98 system "tar -cjf ../launchpad_upload_josm_${outdate}_$num.tar.bz2 josm/josm.pot ".join(" ",@f); 99 ++$num; 100 } 101 } 102 system "rm -rv josm"; 103 chdir ".."; 104 } 116 my $count = 11; 117 my $outdate = `date -u +"%Y-%m-%dT%H_%M_%S"`; 118 my $mech = dologin(); 119 $outdate =~ s/[\r\n]+//; 120 mkdir "build/josm"; 121 system "cp po/*.po po/josm.pot build/josm"; 122 chdir "build"; 123 print "Starting upload ($outdate).\n"; 124 if(!$count) 125 { 126 system "tar -cjf launchpad_upload_josm_$outdate.tar.bz2 josm"; 127 $mech->get("https://translations.launchpad.net/josm/trunk/+translations-upload"); 128 $mech->submit_form(with_fields => {"file" => "launchpad_upload_josm_$outdate.tar.bz2"}); 129 sleep(10); 130 } 131 else 132 { 133 my @files = sort glob("josm/*.po"); 134 my $num = 1; 135 while($#files >= 0) 136 { 137 my @f = splice(@files, 0, $count); 138 my $file = "launchpad_upload_josm_${outdate}_$num.tar.bz2"; 139 print "Create file $file.\n"; 140 system "tar -cjf $file ".join(" ",@f); 141 print "Upload file $file.\n"; 142 $mech->get("https://translations.launchpad.net/josm/trunk/+translations-upload"); 143 $mech->submit_form(with_fields => {"file" => $file}); 144 sleep(10); 145 ++$num; 146 } 147 } 148 system "rm -rv josm"; 149 chdir ".."; 150 approveall($mech); 105 151 } 106 152
Note:
See TracChangeset
for help on using the changeset viewer.