[med-svn] [Git][med-team/biojava4-live][master] 2 commits: add patch for bug 960654 to use simplejson >=3

Olivier Sallou gitlab at salsa.debian.org
Fri May 15 10:21:23 BST 2020



Olivier Sallou pushed to branch master at Debian Med / biojava4-live


Commits:
b488029d by Olivier Sallou at 2020-05-15T09:12:13+00:00
add patch for bug 960654 to use simplejson >=3

- - - - -
522dbf4f by Olivier Sallou at 2020-05-15T09:21:11+00:00
upload fix release

- - - - -


3 changed files:

- debian/changelog
- debian/patches/use_simple_json
- debian/rules


Changes:

=====================================
debian/changelog
=====================================
@@ -1,9 +1,12 @@
-biojava4-live (4.2.12+dfsg-3) UNRELEASED; urgency=medium
+biojava4-live (4.2.12+dfsg-3) unstable; urgency=medium
 
-  * Team upload.
+  [ Michael R. Crusoe ]
   * Don't hardcode openjdk-11 path in debian/rules
 
- -- Michael R. Crusoe <michael.crusoe at gmail.com>  Sat, 19 Jan 2019 02:52:43 -0800
+  [ Gilles Filippini <pini at debian.org> ]
+  * Tentative fix to build against json-simple 3 Closes: #960654
+
+ -- Olivier Sallou <osallou at debian.org>  Fri, 15 May 2020 09:04:30 +0000
 
 biojava4-live (4.2.12+dfsg-2) unstable; urgency=medium
 


=====================================
debian/patches/use_simple_json
=====================================
@@ -2,24 +2,42 @@ Subject: use simple_json library
 Author: Olivier Sallou <osallou at debian.org>
 Description: json.org library is not "free", use simple_json
  library and update according to API
-Last-Updated: 2012-12-02
-
---- a/biojava-ws/src/main/java/org/biojava/nbio/ws/hmmer/RemoteHmmerScan.java
-+++ b/biojava-ws/src/main/java/org/biojava/nbio/ws/hmmer/RemoteHmmerScan.java
+ .
+ [ Gilles Filippini <pini at debian.org> ]
+ Patche updated to 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 now 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
+ This change is handled using place-holders @JSON_SIMPLE_PACKAGE@ which
+ are substituted at build time by debian/rules.
+ .
+ With this trick the package is compatible with json-simple 2.x and 3.x.
+Last-Updated: 2020-05-15
+Index: biojava4-live-4.2.12+dfsg/biojava-ws/src/main/java/org/biojava/nbio/ws/hmmer/RemoteHmmerScan.java
+===================================================================
+--- biojava4-live-4.2.12+dfsg.orig/biojava-ws/src/main/java/org/biojava/nbio/ws/hmmer/RemoteHmmerScan.java
++++ biojava4-live-4.2.12+dfsg/biojava-ws/src/main/java/org/biojava/nbio/ws/hmmer/RemoteHmmerScan.java
 @@ -20,8 +20,10 @@
   */
  package org.biojava.nbio.ws.hmmer;
  
 -import net.sf.json.JSONArray;
 -import net.sf.json.JSONObject;
-+import org.json.simple.JSONArray;
-+import org.json.simple.JSONObject;
-+import org.json.simple.JSONValue;
++import @JSON_SIMPLE_PACKAGE at .JsonArray;
++import @JSON_SIMPLE_PACKAGE at .JsonObject;
++import @JSON_SIMPLE_PACKAGE at .Jsoner;
 +
  import org.biojava.nbio.core.sequence.ProteinSequence;
  import org.slf4j.Logger;
  import org.slf4j.LoggerFactory;
-@@ -136,15 +138,13 @@
+@@ -136,15 +138,13 @@ public class RemoteHmmerScan implements
  
  		SortedSet<HmmerResult> results = new TreeSet<HmmerResult>();
  		try {
@@ -27,29 +45,29 @@ Last-Updated: 2012-12-02
 -
 -			JSONObject hmresults = json.getJSONObject("results");
 -
-+			JSONObject json= (JSONObject) JSONValue.parse(result.toString());
-+			JSONObject hmresults = (JSONObject) json.get("results");
++			JsonObject json= Jsoner.deserialize(result.toString(), (JsonObject) null);
++			JsonObject hmresults = (JsonObject) json.get("results");
  
 -			JSONArray hits = hmresults.getJSONArray("hits");
-+			JSONArray hits = (JSONArray) hmresults.get("hits");
++			JsonArray hits = (JsonArray) hmresults.get("hits");
  
  			for(int i =0 ; i < hits.size() ; i++){
 -				JSONObject hit = hits.getJSONObject(i);
-+				JSONObject hit = (JSONObject) hits.get(i);
++				JsonObject hit = (JsonObject) hits.get(i);
  
  				HmmerResult hmmResult = new HmmerResult();
  
-@@ -168,11 +168,11 @@
+@@ -168,11 +168,11 @@ public class RemoteHmmerScan implements
  				hmmResult.setPvalue((Double)hit.get("pvalue"));
  				hmmResult.setScore(Float.parseFloat((String)hit.get("score")));
  
 -				JSONArray hmmdomains = hit.getJSONArray("domains");
-+				JSONArray hmmdomains = (JSONArray) hit.get("domains");
++				JsonArray hmmdomains = (JsonArray) hit.get("domains");
  
  				SortedSet<HmmerDomain> domains = new TreeSet<HmmerDomain>();
  				for ( int j= 0 ; j < hmmdomains.size() ; j++){
 -					JSONObject d = hmmdomains.getJSONObject(j);
-+					JSONObject d = (JSONObject) hmmdomains.get(j);
++					JsonObject d = (JsonObject) hmmdomains.get(j);
  					Integer is_included = getInteger(d.get("is_included"));
  					if ( is_included == 0) {
  						continue;


=====================================
debian/rules
=====================================
@@ -8,6 +8,14 @@ export LC_ALL=C.UTF-8
 
 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
+else
+JSON_SIMPLE_PACKAGE = org.json.simple
+endif
+
 %:
 	dh $@  --with javahelper
 
@@ -31,6 +39,10 @@ override_dh_auto_configure:
 	sed -e 's/BJLIB/biojava4-jcolorbrewer/g' debian/build.xml > biojava-jcolorbrewer/build.xml
 
 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),' \
+		    {} \; -print
 	cd biojava-jcolorbrewer && ant jar
 	cd biojava-forester && ant jar
 	cd biojava-core && ant jar
@@ -104,6 +116,8 @@ override_dh_clean:
 	rm -rf doc
 	find . -name "*.class" -delete
 	rm -rf buildtest
+	find . -type f -name \*.java.json-simple \
+	  -exec sh -c 'file={} && mv $$file $${file%.json-simple}' \; -print
 
 get-orig-source:
 	debian/get-orig-source



View it on GitLab: https://salsa.debian.org/med-team/biojava4-live/-/compare/bfb41b0a2c0ec58faf4baf2acfb4cb8e0c2ab9aa...522dbf4f55bda13d720da7d3d6464e99dc0b83b3

-- 
View it on GitLab: https://salsa.debian.org/med-team/biojava4-live/-/compare/bfb41b0a2c0ec58faf4baf2acfb4cb8e0c2ab9aa...522dbf4f55bda13d720da7d3d6464e99dc0b83b3
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/debian-med-commit/attachments/20200515/63274cbc/attachment-0001.html>


More information about the debian-med-commit mailing list