logo       

[OSM-dev] tiles@home, proposed patches: msg#00079

gis.openstreetmap.devel

Subject: [OSM-dev] tiles@home, proposed patches

against the current SVN version (1778)

Addressing the following problems:

tilesGen.pl
===========

ReadConf
- removing any CR or LF from input line
corrects the *nix EOL problem
- changed search expression / -> /^
keyword is now only valid if it starts on first column
- replaces @ by %40 in OsmUsername

ProcessRequestsFromServer
- corrected string comparison is "ne" not "!="

upload.pl
=========
ReadConfigFile
- same problems as in tilesGen.pl

Index: tilesGen.pl
===================================================================
--- tilesGen.pl (revision 1778)
+++ tilesGen.pl (working copy)
@@ -108,7 +108,7 @@
my ($ValidFlag,$Version,$X,$Y,$Z,$ModuleName) = split(/\|/, $Request);

# First field is always "OK" if the server has actually sent a request
- if($ValidFlag != "OK"){
+ if($ValidFlag ne "OK"){
print "Server didn't really give a good answer\n";
return;
}
@@ -140,25 +140,26 @@
my $OsmOK = 0;

while(my $Line = <$fp>){
- next if($Line =~ /^\s*#/); # Comments
+ $Line =~ s/\r//g;
+ $Line =~ s/\n//g;

- if ($Line =~ /WorkingDirectory=(.*)/) { $WorkingDirectory=$1; $OsmOK++; }
- if ($Line =~ /Inkscape=(.*)/) { $Inkscape=$1; $OsmOK++; }
- if ($Line =~ /XmlStarlet=(.*)/) { $XmlStarlet=$1; $OsmOK++; }
- if ($Line =~ /Niceness=(.*)/) { $Niceness=$1; $OsmOK++; }
+ if ($Line =~ /^WorkingDirectory=(.*)/) { $WorkingDirectory=$1; $OsmOK++; }
+ if ($Line =~ /^Inkscape=(.*)/) { $Inkscape=$1; $OsmOK++; }
+ if ($Line =~ /^XmlStarlet=(.*)/) { $XmlStarlet=$1; $OsmOK++; }
+ if ($Line =~ /^Niceness=(.*)/) { $Niceness=$1; $OsmOK++; }

- if ($Line =~ /UploadURL=(.*)/) { $UploadURL=$1; $OsmOK++; }
- if ($Line =~ /UploadUsername=(.*)/) { $UploadUsername=$1; $OsmOK++; }
- if ($Line =~ /UploadPassword=(.*)/) { $UploadPassword=$1; $OsmOK++; }
+ if ($Line =~ /^UploadURL=(.*)/) { $UploadURL=$1; $OsmOK++; }
+ if ($Line =~ /^UploadUsername=(.*)/) { $UploadUsername=$1; $OsmOK++; }
+ if ($Line =~ /^UploadPassword=(.*)/) { $UploadPassword=$1; $OsmOK++; }

- if ($Line =~ /OsmUsername=(.*)/) { $OsmUsername=$1; $OsmOK++; } #
TODO convert @ to %40
- if ($Line =~ /OsmPassword=(.*)/) { $OsmPassword=$1; $OsmOK++; }
+ if ($Line =~ /^OsmUsername=(.*)/) { $OsmUsername=$1; $OsmOK++; }
+ if ($Line =~ /^OsmPassword=(.*)/) { $OsmPassword=$1; $OsmOK++; }

- if ($Line =~ /BorderN=(.*)/) { $BorderN=$1; $OsmOK++; }
- if ($Line =~ /BorderS=(.*)/) { $BorderS=$1; $OsmOK++; }
- if ($Line =~ /BorderE=(.*)/) { $BorderE=$1; $OsmOK++; }
- if ($Line =~ /BorderW=(.*)/) { $BorderW=$1; $OsmOK++; }
- if ($Line =~ /MaxZoom=(.*)/) { $MaxZoom=$1; $OsmOK++; }
+ if ($Line =~ /^BorderN=(.*)/) { $BorderN=$1; $OsmOK++; }
+ if ($Line =~ /^BorderS=(.*)/) { $BorderS=$1; $OsmOK++; }
+ if ($Line =~ /^BorderE=(.*)/) { $BorderE=$1; $OsmOK++; }
+ if ($Line =~ /^BorderW=(.*)/) { $BorderW=$1; $OsmOK++; }
+ if ($Line =~ /^MaxZoom=(.*)/) { $MaxZoom=$1; $OsmOK++; }

}
close $fp;
@@ -166,6 +167,7 @@
if($OsmOK != 14){
die("Check your .conf file - some entries not found");
}
+ $OsmUsername =~ s/@/%40/g;
}

#-----------------------------------------------------------------------------
Index: upload.pl
===================================================================
--- upload.pl (revision 1778)
+++ upload.pl (working copy)
@@ -150,7 +150,9 @@
open(my $fp, "<", shift()) || die("Can't open config file\n");
foreach my $Line(<$fp>){
$Line =~ s/\s*#.*$//; # Strip out comments
- if($Line =~ /(\w+)=(.*)/){
+ $Line =~ s/\n//g; # removes LF
+ $Line =~ s/\r//g; # removes CR
+ if($Line =~ /^(\w+)=(.*)/){
$Config{$1} = $2;
}
}
_______________________________________________
dev mailing list
dev@xxxxxxxxxxxxxxxxx
http://lists.openstreetmap.org/cgi-bin/mailman/listinfo/dev
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise