[Git][debian-gis-team/jts][master] 2 commits: Tentative patch to build against json-simple 3. (closes: #960652)
Bas Couwenberg
gitlab at salsa.debian.org
Fri May 15 09:05:07 BST 2020
Bas Couwenberg pushed to branch master at Debian GIS Project / jts
Commits:
969a1d27 by Bas Couwenberg at 2020-05-15T09:55:21+02:00
Tentative patch to build against json-simple 3. (closes: #960652)
- - - - -
f360eba1 by Bas Couwenberg at 2020-05-15T09:55:43+02:00
Set distribution to unstable.
- - - - -
5 changed files:
- debian/changelog
- debian/maven.rules → debian/maven.rules.in
- + debian/patches/json-simple-3.patch
- debian/patches/series
- debian/rules
Changes:
=====================================
debian/changelog
=====================================
@@ -1,11 +1,18 @@
-jts (1.16.1+ds-2) UNRELEASED; urgency=medium
+jts (1.16.1+ds-2) unstable; urgency=medium
+ * Team upload.
+
+ [ Bas Couwenberg ]
* Bump Standards-Version to 4.5.0, no changes.
* Drop Name field from upstream metadata.
* Bump debhelper compat to 10, changes:
- Drop --parallel option, enabled by default
- -- Bas Couwenberg <sebastic at debian.org> Mon, 30 Sep 2019 19:06:50 +0200
+ [ Gilles Filippini ]
+ * Tentative patch to build against json-simple 3.
+ (closes: #960652)
+
+ -- Bas Couwenberg <sebastic at debian.org> Fri, 15 May 2020 09:55:23 +0200
jts (1.16.1+ds-1) unstable; urgency=medium
=====================================
debian/maven.rules → debian/maven.rules.in
=====================================
@@ -2,3 +2,4 @@
junit junit jar s/.*/3.x/ * *
org.locationtech.jts jts-modules pom s/.*/debian/ * *
org.apache.felix maven-bundle-plugin jar s/.*/2.5.4/ * *
+s/com.googlecode.json-simple/@JSON_SIMPLE_MAVEN@/ json-simple * s/.*/debian/ * *
=====================================
debian/patches/json-simple-3.patch
=====================================
@@ -0,0 +1,187 @@
+Description: Migrate away from deprecated json-simple 1.x classes
+ See json-simple 2.0.0 changelog:
+ > * Deprecated JSONParse and JSONValue in favor of Jsoner.
+ > * Deprecated JSONStreamAware and JSONAware in favor of Jsonable.
+ > * Deprecated JSONObject in favor of JsonObject.
+ > * Deprecated JSONArray in favor of JsonArray.
+ .
+ This patch uses the new json-simple Json* classes. It is compatible with
+ both 2.x and 3.x json-simple releases, with a few ajustments regarding
+ backward incompatible changes in json-simple 3.x:
+ - The package name, changed to com.github.cliftonlabs.json_simple
+ - The exception DeserializationExcetpion renamed as JsonException
+ These two changes are handled using place-holders @JSON_SIMPLE_PACKAGE@
+ and @JSON_EXCEPTION@ which are substituted at build time by debian/rules.
+ .
+ With these tricks the package is compatible with json-simple 2.x and 3.x.
+Author: Gilles Filippini <pini at debian.org>
+Bug-Debian: https://bugs.debian.org/960652
+
+--- a/modules/io/common/src/main/java/org/locationtech/jts/io/geojson/GeoJsonReader.java
++++ b/modules/io/common/src/main/java/org/locationtech/jts/io/geojson/GeoJsonReader.java
+@@ -18,7 +18,7 @@ import java.util.ArrayList;
+ import java.util.List;
+ import java.util.Map;
+
+-import org.json.simple.parser.JSONParser;
++import @JSON_SIMPLE_PACKAGE at .Jsoner;
+ import org.locationtech.jts.geom.CoordinateSequence;
+ import org.locationtech.jts.geom.Geometry;
+ import org.locationtech.jts.geom.GeometryFactory;
+@@ -104,11 +104,10 @@ public class GeoJsonReader {
+
+ Geometry result = null;
+
+- JSONParser parser = new JSONParser();
+ try {
+ @SuppressWarnings("unchecked")
+- Map<String, Object> geometryMap = (Map<String, Object>) parser
+- .parse(reader);
++ Map<String, Object> geometryMap = (Map<String, Object>) Jsoner
++ .deserialize(reader);
+
+ GeometryFactory geometryFactory = null;
+ if (this.gf == null) {
+@@ -119,9 +118,7 @@ public class GeoJsonReader {
+
+ result = create(geometryMap, geometryFactory);
+
+- } catch (org.json.simple.parser.ParseException e) {
+- throw new ParseException(e);
+- } catch (IOException e) {
++ } catch (@JSON_SIMPLE_PACKAGE at .@JSON_EXCEPTION@ e) {
+ throw new ParseException(e);
+ }
+
+--- a/modules/io/common/src/main/java/org/locationtech/jts/io/geojson/GeoJsonWriter.java
++++ b/modules/io/common/src/main/java/org/locationtech/jts/io/geojson/GeoJsonWriter.java
+@@ -19,8 +19,8 @@ import java.util.LinkedHashMap;
+ import java.util.List;
+ import java.util.Map;
+
+-import org.json.simple.JSONAware;
+-import org.json.simple.JSONObject;
++import @JSON_SIMPLE_PACKAGE at .Jsonable;
++import @JSON_SIMPLE_PACKAGE at .JsonObject;
+ import org.locationtech.jts.geom.CoordinateSequence;
+ import org.locationtech.jts.geom.Geometry;
+ import org.locationtech.jts.geom.GeometryCollection;
+@@ -94,14 +94,14 @@ public class GeoJsonWriter {
+ * throws an IOException when unable to write the JSON string
+ */
+ public void write(Geometry geometry, Writer writer) throws IOException {
+- Map<String, Object> map = create(geometry, isEncodeCRS);
+- JSONObject.writeJSONString(map, writer);
++ JsonObject map = create(geometry, isEncodeCRS);
++ map.toJson(writer);
+ writer.flush();
+ }
+
+- private Map<String, Object> create(Geometry geometry, boolean encodeCRS) {
++ private JsonObject create(Geometry geometry, boolean encodeCRS) {
+
+- Map<String, Object> result = new LinkedHashMap<String, Object>();
++ JsonObject result = new JsonObject();
+ result.put(GeoJsonConstants.NAME_TYPE, geometry.getGeometryType());
+
+ if (geometry instanceof Point) {
+@@ -109,11 +109,13 @@ public class GeoJsonWriter {
+
+ final String jsonString = getJsonString(point.getCoordinateSequence());
+
+- result.put(GeoJsonConstants.NAME_COORDINATES, new JSONAware() {
++ result.put(GeoJsonConstants.NAME_COORDINATES, new Jsonable() {
+
+- public String toJSONString() {
++ public String toJson() {
+ return jsonString;
+ }
++ public void toJson(Writer out) {
++ }
+ });
+
+ } else if (geometry instanceof LineString) {
+@@ -122,11 +124,13 @@ public class GeoJsonWriter {
+ final String jsonString = getJsonString(lineString
+ .getCoordinateSequence());
+
+- result.put(GeoJsonConstants.NAME_COORDINATES, new JSONAware() {
++ result.put(GeoJsonConstants.NAME_COORDINATES, new Jsonable() {
+
+- public String toJSONString() {
++ public String toJson() {
+ return jsonString;
+ }
++ public void toJson(Writer out) {
++ }
+ });
+
+ } else if (geometry instanceof Polygon) {
+@@ -185,27 +189,31 @@ public class GeoJsonWriter {
+ return result;
+ }
+
+- private List<JSONAware> makeJsonAware(Polygon poly) {
+- ArrayList<JSONAware> result = new ArrayList<JSONAware>();
++ private List<Jsonable> makeJsonAware(Polygon poly) {
++ ArrayList<Jsonable> result = new ArrayList<Jsonable>();
+
+ {
+ final String jsonString = getJsonString(poly.getExteriorRing()
+ .getCoordinateSequence());
+- result.add(new JSONAware() {
++ result.add(new Jsonable() {
+
+- public String toJSONString() {
++ public String toJson() {
+ return jsonString;
+ }
++ public void toJson(Writer out) {
++ }
+ });
+ }
+ for (int i = 0; i < poly.getNumInteriorRing(); i++) {
+ final String jsonString = getJsonString(poly.getInteriorRingN(i)
+ .getCoordinateSequence());
+- result.add(new JSONAware() {
++ result.add(new Jsonable() {
+
+- public String toJSONString() {
++ public String toJson() {
+ return jsonString;
+ }
++ public void toJson(Writer out) {
++ }
+ });
+ }
+
+@@ -227,21 +235,25 @@ public class GeoJsonWriter {
+ LineString lineString = (LineString) geometry;
+ final String jsonString = getJsonString(lineString
+ .getCoordinateSequence());
+- list.add(new JSONAware() {
++ list.add(new Jsonable() {
+
+- public String toJSONString() {
++ public String toJson() {
+ return jsonString;
+ }
++ public void toJson(Writer out) {
++ }
+ });
+ }
+ else if (geometry instanceof Point) {
+ Point point = (Point) geometry;
+ final String jsonString = getJsonString(point.getCoordinateSequence());
+- list.add(new JSONAware() {
++ list.add(new Jsonable() {
+
+- public String toJSONString() {
++ public String toJson() {
+ return jsonString;
+ }
++ public void toJson(Writer out) {
++ }
+ });
+ }
+ }
=====================================
debian/patches/series
=====================================
@@ -1 +1,2 @@
jts-core-jar,patch
+json-simple-3.patch
=====================================
debian/rules
=====================================
@@ -2,5 +2,39 @@
export JAVA_HOME := /usr/lib/jvm/default-java
+JSON_SIMPLE_VERSION = $(shell dpkg -l libjson-simple-java | grep '^ii' | awk '{print $$3}')
+JSON_SIMPLE_3 = $(shell dpkg --compare-versions '$(JSON_SIMPLE_VERSION)' '>' '3.1.1-1~' && echo yes || echo no)
+
+ifeq (yes,$(JSON_SIMPLE_3))
+ JSON_SIMPLE_PACKAGE = com.github.cliftonlabs.json_simple
+ JSON_EXCEPTION = JsonException
+ JSON_SIMPLE_MAVEN = com.github.cliftonlabs
+else
+ JSON_SIMPLE_PACKAGE = org.json.simple
+ JSON_EXCEPTION = DeserializationException
+ JSON_SIMPLE_MAVEN = com.googlecode.json-simple
+endif
+
%:
dh $@ --buildsystem=maven
+
+debian/maven.rules: debian/maven.rules.in
+ sed 's/@JSON_SIMPLE_MAVEN@/$(JSON_SIMPLE_MAVEN)/' $< >$@
+
+override_dh_auto_configure: debian/maven.rules
+ dh_auto_configure
+
+override_dh_auto_clean:
+ dh_auto_clean
+
+ find . -type f -name \*.java.json-simple \
+ -exec sh -c 'file={} && mv $$file $${file%.json-simple}' \; -print
+
+override_dh_auto_build:
+ find . -type f -name \*.java -exec grep -q 'import @JSON_SIMPLE_PACKAGE@' {} \; \
+ -exec sed -i.json-simple \
+ -e 's, at JSON_SIMPLE_PACKAGE@,$(JSON_SIMPLE_PACKAGE),' \
+ -e 's/@JSON_EXCEPTION@/$(JSON_EXCEPTION)/' \
+ {} \; -print
+
+ dh_auto_build
View it on GitLab: https://salsa.debian.org/debian-gis-team/jts/-/compare/18796e237c977fd9ab2b2c07b19a50fb9ec6f531...f360eba1924b52035062a0d8d331f0b54a83c4b0
--
View it on GitLab: https://salsa.debian.org/debian-gis-team/jts/-/compare/18796e237c977fd9ab2b2c07b19a50fb9ec6f531...f360eba1924b52035062a0d8d331f0b54a83c4b0
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/20200515/6983d250/attachment-0001.html>
More information about the Pkg-grass-devel
mailing list