[Git][debian-gis-team/mkgmap][master] 4 commits: New upstream version 0.0.0+svn4810
Bas Couwenberg (@sebastic)
gitlab at salsa.debian.org
Mon Nov 1 04:41:13 GMT 2021
Bas Couwenberg pushed to branch master at Debian GIS Project / mkgmap
Commits:
38342b4f by Bas Couwenberg at 2021-11-01T05:33:00+01:00
New upstream version 0.0.0+svn4810
- - - - -
6d0850ae by Bas Couwenberg at 2021-11-01T05:33:16+01:00
Update upstream source from tag 'upstream/0.0.0+svn4810'
Update to upstream version '0.0.0+svn4810'
with Debian dir 5a5ee678d2d34310a16b1b36915dad9a12bd1fe7
- - - - -
c0f9a087 by Bas Couwenberg at 2021-11-01T05:33:31+01:00
New upstream SVN snapshot.
- - - - -
53d1904a by Bas Couwenberg at 2021-11-01T05:34:10+01:00
Set distribution to unstable.
- - - - -
10 changed files:
- debian/changelog
- doc/options.txt
- resources/help/en/options
- resources/mkgmap-version.properties
- src/uk/me/parabola/mkgmap/CommandArgs.java
- src/uk/me/parabola/mkgmap/combiners/FileInfo.java
- src/uk/me/parabola/mkgmap/combiners/GmapiBuilder.java
- src/uk/me/parabola/mkgmap/combiners/MdrBuilder.java
- src/uk/me/parabola/mkgmap/combiners/TdbBuilder.java
- src/uk/me/parabola/mkgmap/main/Main.java
Changes:
=====================================
debian/changelog
=====================================
@@ -1,3 +1,9 @@
+mkgmap (0.0.0+svn4810-1) unstable; urgency=medium
+
+ * New upstream SVN snapshot.
+
+ -- Bas Couwenberg <sebastic at debian.org> Mon, 01 Nov 2021 05:34:01 +0100
+
mkgmap (0.0.0+svn4807-1) unstable; urgency=medium
* New upstream SVN snapshot.
=====================================
doc/options.txt
=====================================
@@ -72,6 +72,19 @@ into {user}\AppData\Roaming\Garmin\Maps or \ProgramData\Garmin\Maps
and the map will be available to Garmin PC programs.
The directory name is --family-name with extension .gmap.
+;--gmapi-minimal[=<include-pattern>]
+: Special option for map providers to reduce disk writes when updating. Works like
+--gmapi but does not write Product data for input files which are provided as
+*.img. It is assumed that the content of those files wasn't changed and thus
+doesn't need a rewrite. The optional include-pattern is a regular expression
+which can be used to specify *.img files for which a write should be forced. The
+pattern is used on the full path to the input file. The global index files and
+the *.tdb file will still contain all needed references.
+: Example usage with pattern:
+:: --gmapi-minimal=.*4711[0-9]{4}\.img
+:: This pattern matches file names between 47110000.img and 47119999.img
+:: and ignores the path.
+
;-c filename
;--read-config=filename
: Each line of the named file contains a command option in the form
=====================================
resources/help/en/options
=====================================
@@ -71,6 +71,20 @@ filename
map will be available to Garmin PC programs. The directory name is
--family-name with extension .gmap.
+--gmapi-minimal[=<include-pattern>]
+ Special option for map providers to reduce disk writes when updating. Works
+ like --gmapi but does not write Product data for input files which are
+ provided as *.img. It is assumed that the content of those files wasn't
+ changed and thus doesn't need a rewrite. The optional include-pattern is a
+ regular expression which can be used to specify *.img files for which a
+ write should be forced. The pattern is used on the full path to the input
+ file. The global index files and the *.tdb file will still contain all
+ needed references.
+ Example usage with pattern:
+ --gmapi-minimal=.*4711[0-9]{4}\.img
+ This pattern matches file names between 47110000.img and 47119999.img
+ and ignores the path.
+
-c filename
--read-config=filename
Each line of the named file contains a command option in the form
=====================================
resources/mkgmap-version.properties
=====================================
@@ -1,2 +1,2 @@
-svn.version: 4807
-build.timestamp: 2021-09-14T09:45:24+0100
+svn.version: 4810
+build.timestamp: 2021-10-25T08:27:43+0100
=====================================
src/uk/me/parabola/mkgmap/CommandArgs.java
=====================================
@@ -27,7 +27,7 @@ public class CommandArgs {
for (String listOpt : Arrays.asList("mdr7-excl", "mdr7-del", "poi-excl-index", "location-autofill",
"overview-levels", "levels", "name-tag-list", "polygon-size-limits", "dem", "dem-dists", "drive-on",
"dead-ends", "add-pois-to-lines", "coastlinefile", "generate-sea", "nearby-poi-rules",
- "line-types-with-direction")) {
+ "line-types-with-direction", "gmapi-minimal")) {
stringToList(get(listOpt, null), listOpt);
}
}
=====================================
src/uk/me/parabola/mkgmap/combiners/FileInfo.java
=====================================
@@ -32,6 +32,7 @@ import uk.me.parabola.imgfmt.Utils;
import uk.me.parabola.imgfmt.app.Area;
import uk.me.parabola.imgfmt.app.BufferedImgFileReader;
import uk.me.parabola.imgfmt.app.lbl.LBLFileReader;
+import uk.me.parabola.imgfmt.app.map.MapReader;
import uk.me.parabola.imgfmt.app.srt.Sort;
import uk.me.parabola.imgfmt.app.trergn.TREFileReader;
import uk.me.parabola.imgfmt.app.trergn.TREHeader;
@@ -85,6 +86,7 @@ public class FileInfo {
private int codePage;
private int sortOrderId;
private int demsize;
+ private MapReader mapReader;
private FileInfo(String filename, FileKind kind) {
this.filename = filename;
@@ -475,4 +477,17 @@ public class FileInfo {
public void setDemsize(int demsize) {
this.demsize = demsize;
}
+
+ public MapReader getMapReader() throws FileNotFoundException {
+ if (mapReader == null)
+ mapReader = new MapReader(filename);
+ return mapReader;
+ }
+
+ public void closeMapReader() {
+ if (mapReader != null) {
+ Utils.closeFile(mapReader);
+ mapReader = null;
+ }
+ }
}
=====================================
src/uk/me/parabola/mkgmap/combiners/GmapiBuilder.java
=====================================
@@ -34,6 +34,7 @@ import uk.me.parabola.imgfmt.fs.DirectoryEntry;
import uk.me.parabola.imgfmt.fs.FileSystem;
import uk.me.parabola.imgfmt.fs.ImgChannel;
import uk.me.parabola.imgfmt.sys.ImgFS;
+import uk.me.parabola.log.Logger;
import uk.me.parabola.mkgmap.CommandArgs;
import static java.nio.file.StandardOpenOption.*;
@@ -45,9 +46,11 @@ import static java.nio.file.StandardOpenOption.*;
* each .img file.
*/
public class GmapiBuilder implements Combiner {
+ private static final Logger log = Logger.getLogger(GmapiBuilder.class);
private static final String NS = "http://www.garmin.com/xmlschemas/MapProduct/v1";
private final Map<String, Combiner> combinerMap;
+ private final Map<String, String> sourceMap;
private Path gmapDir;
private final Map<Integer, ProductInfo> productMap = new HashMap<>();
@@ -58,8 +61,13 @@ public class GmapiBuilder implements Combiner {
private String typFile;
- public GmapiBuilder(Map<String, Combiner> combinerMap) {
+ private boolean forceWrite;
+ private String mustWritePattern;
+
+
+ public GmapiBuilder(Map<String, Combiner> combinerMap, Map<String, String> sourceMap) {
this.combinerMap = combinerMap;
+ this.sourceMap = sourceMap;
}
/**
@@ -75,6 +83,9 @@ public class GmapiBuilder implements Combiner {
productVersion = (short) args.get("product-version", 100);
gmapDir = Paths.get(args.getOutputDir(), String.format("%s.gmap", familyName));
+ forceWrite = args.exists("gmapi");
+
+ mustWritePattern = args.get("gmapi-minimal", null);
}
/**
@@ -93,8 +104,10 @@ public class GmapiBuilder implements Combiner {
// Unzip the image into the product tile directory.
try {
- if (info.isImg())
- unzipImg(fn, mapname, productId);
+ if (info.isImg()) {
+ if (forceWrite || shouldWrite(info))
+ unzipImg(fn, mapname, productId);
+ }
else if (info.getKind() == FileKind.TYP_KIND)
typFile = info.getFilename();
@@ -103,6 +116,23 @@ public class GmapiBuilder implements Combiner {
}
}
+ private boolean shouldWrite(FileInfo info) {
+ String fn = info.getFilename();
+ String source = sourceMap.get(fn);
+ if (!source.equals(fn)) {
+ log.diagnostic("gmapi-minimal: Writing freshly compiled file " + fn);
+ return true;
+ }
+ if (mustWritePattern != null) {
+ if (fn.matches(mustWritePattern)) {
+ log.diagnostic("gmapi-minimal: Writing old file " + fn + " because it matches pattern " + mustWritePattern);
+ return true;
+ }
+ }
+ log.diagnostic("gmapi-minimal: Skipping file " + fn);
+ return false;
+ }
+
/**
* The complete map set has been processed. Finish off anything that needs
* doing.
@@ -157,7 +187,7 @@ public class GmapiBuilder implements Combiner {
unzipImg(srcImgName, destDir);
}
- private static void unzipImg(String srcImgName, Path destDir) throws IOException {
+ private void unzipImg(String srcImgName, Path destDir) throws IOException {
FileSystem fs = ImgFS.openFs(srcImgName);
for (DirectoryEntry ent : fs.list()) {
String fullname = ent.getFullName();
@@ -168,7 +198,8 @@ public class GmapiBuilder implements Combiner {
continue;
Files.createDirectories(destDir);
- copyToFile(f, destDir.resolve(name));
+ Path out = destDir.resolve(name);
+ copyToFile(f, out);
}
}
}
=====================================
src/uk/me/parabola/mkgmap/combiners/MdrBuilder.java
=====================================
@@ -155,9 +155,8 @@ public class MdrBuilder implements Combiner {
mdrFile.addMap(info.getHexname(), info.getCodePage());
String filename = info.getFilename();
- MapReader mr = null;
try {
- mr = new MapReader(filename);
+ MapReader mr = info.getMapReader();
AreaMaps maps = new AreaMaps();
@@ -172,8 +171,6 @@ public class MdrBuilder implements Combiner {
addZips(mr);
} catch (FileNotFoundException e) {
throw new ExitException("Could not open " + filename + " when creating mdr file");
- } finally {
- Utils.closeFile(mr);
}
}
=====================================
src/uk/me/parabola/mkgmap/combiners/TdbBuilder.java
=====================================
@@ -135,10 +135,9 @@ public class TdbBuilder implements Combiner {
for (String m : msgs)
tdb.addCopyright(m);
- MapReader mapReader = null;
String filename = finfo.getFilename();
try{
- mapReader = new MapReader(filename);
+ MapReader mapReader = finfo.getMapReader();
msgs = mapReader.getCopyrights();
boolean found = false;
@@ -157,8 +156,6 @@ public class TdbBuilder implements Combiner {
} catch (FileNotFoundException e) {
throw new ExitException("Could not open " + filename + " when creating tdb file");
- } finally {
- Utils.closeFile(mapReader);
}
=====================================
src/uk/me/parabola/mkgmap/main/Main.java
=====================================
@@ -104,6 +104,7 @@ public class Main implements ArgumentProcessor {
private volatile int programRC = 0;
private final Map<String, Combiner> combinerMap = new HashMap<>();
+ private final Map<String, String> sourceMap = new HashMap<>();
private boolean informationDisplayed = false;
/**
@@ -297,6 +298,7 @@ public class Main implements ArgumentProcessor {
}
});
task.setArgs(args);
+ task.setSource(filename);
futures.add(task);
}
@@ -618,6 +620,7 @@ public class Main implements ArgumentProcessor {
final Map<String, Integer> nameToHex = new HashMap<>();
for (FilenameTask f : filenames) {
if (f.getFilename().endsWith(".img")) {
+ sourceMap.put(f.getFilename(), f.getSource());
int hex;
try {
hex = FileInfo.getFileInfo(f.getFilename() ).getHexname();
@@ -675,6 +678,7 @@ public class Main implements ArgumentProcessor {
continue;
c.onMapEnd(fileInfo);
}
+ fileInfo.closeMapReader();
} catch (FileNotFoundException e) {
throw new MapFailedException("could not open file " + e.getMessage());
}
@@ -706,10 +710,13 @@ public class Main implements ArgumentProcessor {
boolean indexOpt = args.exists("index");
boolean gmapsuppOpt = args.exists("gmapsupp");
boolean tdbOpt = args.exists("tdbfile");
- boolean gmapiOpt = args.exists("gmapi");
+ boolean gmapiOpt = args.exists("gmapi") || args.exists("gmapi-minimal");
boolean nsisOpt = args.exists("nsis");
- for (String opt : Arrays.asList("gmapi", "nsis")) {
+ if (args.exists("gmapi") && args.exists("gmapi-minimal")) {
+ throw new ExitException("Options --gmapi and --gmapi-minimal are mutually exclusive");
+ }
+ for (String opt : Arrays.asList("gmapi", "nsis", "gmapi-minimal")) {
if (!createTdbFiles && args.exists(opt)) {
throw new ExitException("Options --" + opt + " and --no-tdbfiles are mutually exclusive");
}
@@ -729,7 +736,7 @@ public class Main implements ArgumentProcessor {
addCombiner("mdx", new MdxBuilder());
}
if (gmapiOpt) {
- addCombiner("gmapi", new GmapiBuilder(combinerMap));
+ addCombiner("gmapi", new GmapiBuilder(combinerMap, sourceMap));
}
if (nsisOpt) {
addCombiner("nsis", new NsisBuilder(combinerMap));
@@ -772,6 +779,7 @@ public class Main implements ArgumentProcessor {
private static class FilenameTask extends FutureTask<String> {
private CommandArgs args;
private String filename;
+ private String source;
private FilenameTask(Callable<String> callable) {
super(callable);
@@ -794,7 +802,16 @@ public class Main implements ArgumentProcessor {
}
public String toString() {
- return filename;
+ return source + " -> " + filename;
+ }
+
+ public void setSource(String source) {
+ this.source = source;
}
+
+ public String getSource() {
+ return source;
+ }
+
}
}
View it on GitLab: https://salsa.debian.org/debian-gis-team/mkgmap/-/compare/2c74ad90c3379908f8c4504160529972c2adf792...53d1904a8de3c4feb4df85ea26f713fdb5bb1f49
--
View it on GitLab: https://salsa.debian.org/debian-gis-team/mkgmap/-/compare/2c74ad90c3379908f8c4504160529972c2adf792...53d1904a8de3c4feb4df85ea26f713fdb5bb1f49
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20211101/67d3778a/attachment-0001.htm>
More information about the Pkg-grass-devel
mailing list