From 7460fe5721352e7d7284aee891cb12cd57450d3d Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sat, 11 Oct 2014 22:25:53 +0000 Subject: getmap (11oct14) git-svn-id: svn://tug.org/texlive/trunk@35355 c570f23f-e606-0410-a88d-b1316a301751 --- .../texlive/linked_scripts/getmap/getmapdl.lua | 157 +++++++++++++++++++-- .../texk/texlive/linked_scripts/texlive/tlmgr.pl | 12 +- 2 files changed, 155 insertions(+), 14 deletions(-) (limited to 'Build/source') diff --git a/Build/source/texk/texlive/linked_scripts/getmap/getmapdl.lua b/Build/source/texk/texlive/linked_scripts/getmap/getmapdl.lua index 0ca4ac6bbb3..841574e91d7 100644 --- a/Build/source/texk/texlive/linked_scripts/getmap/getmapdl.lua +++ b/Build/source/texk/texlive/linked_scripts/getmap/getmapdl.lua @@ -38,9 +38,10 @@ local PITCH = "" local LANGUAGE = "" local GPFILE = "" local KMLFILE = "" +local BOUND = 0.1 local OFILE = "getmap" local QUIET = "false" -local VERSION = "v1.4 (18/09/2014)" +local VERSION = "v1.5 (07/10/2014)" function pversion() print("getmapdl.lua " .. VERSION) @@ -130,6 +131,10 @@ getmapdl.lua [options] -K specify the kml file + gps2gps mode only: + + -B specify the bound for reducing way points (default: 0.1) + ]]) pversion() end @@ -185,6 +190,23 @@ function printepl(epltable) print(stingwithoutcontrolcharacters) end +function isnotnumber(number) + if tonumber(number) == nil then + return true + else + return false + end +end + +function dbtbound(Onum, num, bound) + local absdiff = math.abs(tonumber(Onum) - tonumber(num)) + if absdiff >= tonumber(bound) then + return true + else + return false + end +end + do local newarg = {} local i, limit = 1, #arg @@ -258,6 +280,9 @@ do elseif arg[i] == "-K" then KMLFILE = arg[i+1] i = i + 1 + elseif arg[i] == "-B" then + BOUND = arg[i+1] + i = i + 1 elseif arg[i] == "-o" then OFILE = arg[i+1] i = i + 1 @@ -368,6 +393,8 @@ if MODE == "gpx2gps" then if string.match(line, "") then @@ -377,26 +404,128 @@ if MODE == "gpx2gps" then os.exit(0) end +if MODE == "gps2gps" then + local file = GPFILE + local bound = BOUND + local incount = 0 + local outcount = 0 + local routecount = 1 + local latitude + local longitude + local Olatitude + local Olongitude + local Llatitude + local Llongitude + local ignorenextline = false + local firstroute = true + + for line in io.lines(file) + do + latitude, longitude = line:match("([^,]+),([^,]+)") + if ignorenextline == true then + line = "" + ignorenextline = false + end + -- if line contains "Point:" then gps coordinates + -- in the next line must be ignored! + if line:match("Point:") then + ignorenextline = true + end + if line:match("Route:") then + if firstroute == true then + firstroute = false + routecount = 0 + else + -- print last pair of coordinates + print(Llatitude .. "," .. Llongitude) + outcount = outcount + 1 + io.stderr:write("\nRoute " .. routecount .. ": reduced gps coordinates (Bound = " .. bound .. "): " .. incount .. " -> " .. outcount) + end + incount = 0 + outcount = 0 + routecount = routecount + 1 + print("\n" .. line .. "\n") + line = "" + end + if line == "" or isnotnumber(latitude) or isnotnumber(longitude) + then + -- empty line or no gps coordinates -> do nothing + else + latitude = round(latitude,5) + longitude = round(longitude,5) + Llatitude = latitude + Llongitude = longitude + incount = incount + 1 + if incount == 1 then + Olatitude = latitude + Olongitude = longitude + print(Olatitude .. "," .. Olongitude) + outcount = outcount + 1 + else + if dbtbound(Olatitude,latitude,bound) or dbtbound(Olongitude,longitude,bound) then + print(latitude .. "," .. longitude) + outcount = outcount + 1 + Olatitude = latitude + Olongitude = longitude + end + end + end + end + -- print last pair of coordinates + print(Llatitude .. "," .. Llongitude) + outcount = outcount + 1 + io.stderr:write("\nRoute " .. routecount .. ": reduced gps coordinates (Bound = " .. bound .. "): " .. incount .. " -> " .. outcount) + os.exit(0) +end + if MODE == "gps2epl" then local file = GPFILE local Olatitude = 0 local Olongitude = 0 local epl = {} + local firstroute = true for line in io.lines(file) do local latitude local longitude local encnum + latitude, longitude = line:match("([^,]+),([^,]+)") - latitude = round(latitude,5)*100000 - longitude = round(longitude,5)*100000 - encnum = encodeNumber(latitude - Olatitude) - table.insert(epl,encnum) - encnum = encodeNumber(longitude - Olongitude) - table.insert(epl,encnum) - Olatitude = latitude - Olongitude = longitude + if ignorenextline == true then + line = "" + ignorenextline = false + end + -- if line contains "Point:" then gps coordinates + -- in the next line must be ignored! + if line:match("Point:") then + ignorenextline = true + end + if line:match("Route:") then + if firstroute == true then + firstroute = false + else + printepl(epl) + Olatitude = 0 + Olongitude = 0 + epl = {} + end + print("\n" .. line .. "\n") + line = "" + end + if line == "" or isnotnumber(latitude) or isnotnumber(longitude) + then + -- empty line or no gps coordinates -> do nothing + else + latitude = round(latitude,5)*100000 + longitude = round(longitude,5)*100000 + encnum = encodeNumber(latitude - Olatitude) + table.insert(epl,encnum) + encnum = encodeNumber(longitude - Olongitude) + table.insert(epl,encnum) + Olatitude = latitude + Olongitude = longitude + end end printepl(epl) os.exit(0) @@ -452,11 +581,13 @@ if MODE == "kml2gps" or MODE == "kml2epl" then end for cocsv in string.gmatch(colist, "%S+") do longitude, latitude, altitude = cocsv:match("([^,]+),([^,]+),([^,]+)") + latitude = round(latitude,5) + longitude = round(longitude,5) if MODE == "kml2epl" then local encnum if cotype == "route" then - latitude = round(latitude,5)*100000 - longitude = round(longitude,5)*100000 + latitude = latitude*100000 + longitude = longitude*100000 encnum = encodeNumber(latitude - Olatitude) table.insert(epl,encnum) encnum = encodeNumber(longitude - Olongitude) @@ -717,7 +848,11 @@ if not ofile then end print("\n\ngetmapdl.lua:") print("url = " .. IMGURL) +print("url length = " .. string.len(IMGURL) .. " bytes") print("output = " .. UOFILE) +if string.len(IMGURL) > 2048 then + getmap_error(23, "URL exceeds length limit of 2048 bytes!") +end ret, msg = http.request{ url = IMGURL, sink = ltn12.sink.file(ofile) diff --git a/Build/source/texk/texlive/linked_scripts/texlive/tlmgr.pl b/Build/source/texk/texlive/linked_scripts/texlive/tlmgr.pl index d7996f562dd..c3e17e4533c 100755 --- a/Build/source/texk/texlive/linked_scripts/texlive/tlmgr.pl +++ b/Build/source/texk/texlive/linked_scripts/texlive/tlmgr.pl @@ -1,12 +1,12 @@ #!/usr/bin/env perl -# $Id: tlmgr.pl 34227 2014-05-23 13:13:03Z karl $ +# $Id: tlmgr.pl 35326 2014-10-07 21:55:46Z karl $ # # Copyright 2008-2014 Norbert Preining # This file is licensed under the GNU General Public License version 2 # or any later version. -my $svnrev = '$Revision: 34227 $'; -my $datrev = '$Date: 2014-05-23 15:13:03 +0200 (Fri, 23 May 2014) $'; +my $svnrev = '$Revision: 35326 $'; +my $datrev = '$Date: 2014-10-07 23:55:46 +0200 (Tue, 07 Oct 2014) $'; my $tlmgrrevision; my $prg; if ($svnrev =~ m/: ([0-9]+) /) { @@ -7298,6 +7298,12 @@ If the package on the server is older than the package already installed (e.g., if the selected mirror is out of date), C does not downgrade. Also, packages for uninstalled platforms are not installed. +C saves a copy of the C file used for an update +with a suffix representing the repository url, as in +CI. These can be useful for +fallback information, but if you don't like them accumulating (e.g., +on each run C might resolve to a new host, resulting in +a different hash), it's harmless to delete them. =head1 USER MODE -- cgit v1.2.3