[med-svn] [Git][med-team/megan-ce][master] 11 commits: Don't build class needing unpackaged Contrasts dependency

Pierre Gruet (@pgt) gitlab at salsa.debian.org
Fri Jan 14 16:28:46 GMT 2022



Pierre Gruet pushed to branch master at Debian Med / megan-ce


Commits:
7b6b15aa by Pierre Gruet at 2022-01-10T17:39:08+01:00
Don't build class needing unpackaged Contrasts dependency

- - - - -
d653d7e9 by Pierre Gruet at 2022-01-10T17:41:18+01:00
Using a replacement class for BCrypt

- - - - -
8c9a491c by Pierre Gruet at 2022-01-10T17:53:01+01:00
Making the right method calls to sis-jhdf5 classes

- - - - -
8a62fa33 by Pierre Gruet at 2022-01-10T18:10:54+01:00
Setting myself as uploader

- - - - -
f4b620fd by Pierre Gruet at 2022-01-10T18:11:22+01:00
The binary package is Architecture: all

- - - - -
b3346e95 by Pierre Gruet at 2022-01-10T18:12:31+01:00
Setting the right name for the built jar file in d/jlibs

- - - - -
3c8d5bf9 by Pierre Gruet at 2022-01-10T18:12:50+01:00
Updating the manifest in d/manifest

- - - - -
5b9bfca8 by Pierre Gruet at 2022-01-10T18:14:42+01:00
Setting Standards version to 4.6.0

- - - - -
deaa513a by Pierre Gruet at 2022-01-14T17:27:01+01:00
Adding manpage

- - - - -
a945597b by Pierre Gruet at 2022-01-14T17:28:08+01:00
Providing an executable file to launch the jar of megan, setting the manifest consistently

- - - - -
def5c3e3 by Pierre Gruet at 2022-01-14T17:28:25+01:00
Updating the list of dependencies as needed

- - - - -


12 changed files:

- + debian/bin/megan
- debian/control
- debian/jlibs
- debian/manifest
- + debian/manpages/megan.1
- + debian/megan-ce.install
- + debian/megan-ce.manpages
- + debian/patches/BCrypt_replacement.patch
- + debian/patches/altering_calls_to_sis-jhdf5.patch
- debian/patches/fix_class_path.patch
- + debian/patches/omit_ComputeContrastsCommand.patch
- debian/patches/series


Changes:

=====================================
debian/bin/megan
=====================================
@@ -0,0 +1,7 @@
+#!/bin/sh
+set -e
+
+# The upstream website recommends to launch megan by running 'ant run'.
+# We launch the software by calling java with the args in antbuild/build.xml.
+
+java -Xshare:off -server -Xmx4G -Duser.language=en -Duser.region=US -jar /usr/share/java/megan.jar "$@"


=====================================
debian/control
=====================================
@@ -1,6 +1,7 @@
 Source: megan-ce
 Maintainer: Debian Med Packaging Team <debian-med-packaging at lists.alioth.debian.org>
-Uploaders: Andreas Tille <tille at debian.org>
+Uploaders: Andreas Tille <tille at debian.org>,
+           Pierre Gruet <pgt at debian.org>
 Section: science
 Priority: optional
 Build-Depends: debhelper-compat (= 13),
@@ -12,18 +13,25 @@ Build-Depends: debhelper-compat (= 13),
                libcommons-math3-java,
                libjama-java,
                libgoogle-gson-java,
+               libjbcrypt-java,
                libopenjfx-java,
                libsis-jhdf5-java,
                libxerial-sqlite-jdbc-java
-Standards-Version: 4.1.4
+Standards-Version: 4.6.0
 Vcs-Browser: https://salsa.debian.org/med-team/megan-ce
 Vcs-Git: https://salsa.debian.org/med-team/megan-ce.git
 Homepage: https://github.com/danielhuson/megan-ce
 Rules-Requires-Root: no
 
 Package: megan-ce
-Architecture: any
-Depends: ${java:Depends},
+Architecture: all
+Depends: default-jre,
+         ${java:Depends},
+         libjloda-java,
+         libjbcrypt-java,
+         libopenjfx-java,
+         libsis-jhdf5-java,
+         libxerial-sqlite-jdbc-java,
          ${misc:Depends}
 Description: MEGAN Community Edition
  MEGAN Community Edition - Interactive exploration and analysis of large-


=====================================
debian/jlibs
=====================================
@@ -1 +1 @@
-antbuild/megan-ce.jar
+antbuild/megan.jar


=====================================
debian/manifest
=====================================
@@ -1,3 +1,3 @@
-/usr/share/java/megan-ce.jar:
- Main-Class: megan-ce.MeganRun
- Class-Path: /usr/share/java/jloda.jar /usr/share/java/colt.jar /usr/share/java/commons-codec.jar /usr/share/java/commons-math3.jar /usr/share/java/gson.jar /usr/share/java/openjfx/jre/lib/ext/jfxrt.jar /usr/share/java/jama.jar /usr/share/java/spring3-web.jar /usr/share/java/controlsfx.jar
+/usr/share/java/megan.jar:
+ Main-Class: megan.main.Megan6
+ Class-Path: /usr/share/java/colt.jar /usr/share/java/commons-math3.jar /usr/share/java/gson.jar /usr/share/java/jama.jar /usr/share/java/javafx-base.jar" /usr/share/java/javafx-controls.jar /usr/share/java/javafx-fxml.jar /usr/share/java/javafx-graphics.jar /usr/share/java/javafx-swing.jar /usr/share/java/jbcrypt.jar /usr/share/java/jloda.jar /usr/share/java/sis-jhdf5.jar /usr/share/java/xerial-sqlite-jdbc.jar


=====================================
debian/manpages/megan.1
=====================================
@@ -0,0 +1,28 @@
+.TH MEGAN 1 "January 2022"
+
+.SH NAME
+megan \- Interactive explorer and analyzer of microbiome sequencing data
+
+.SH SYNOPSIS
+.B megan
+.RI [ options ]
+
+.SH OPTIONS
+.TP
+.BR \-f, \-\-files \fIfile\fR...
+MEGAN RMA file(s) to open
+.TP
+.BR \-p, \-\-propertiesFile \fIfile\fR
+Properties file
+.TP
+.BR +w, \-\-hideMessageWindow
+Hide message window
+.TP
+.BR \-S, \-\-silentMode
+Silent mode
+.TP
+.BR \-d, \-\-debug
+Debug mode
+
+.SH SEE ALSO
+        https://uni-tuebingen.de/fakultaeten/mathematisch-naturwissenschaftliche-fakultaet/fachbereiche/informatik/lehrstuehle/algorithms-in-bioinformatics/software/megan6


=====================================
debian/megan-ce.install
=====================================
@@ -0,0 +1 @@
+debian/bin/megan usr/bin


=====================================
debian/megan-ce.manpages
=====================================
@@ -0,0 +1 @@
+debian/manpages/megan.1


=====================================
debian/patches/BCrypt_replacement.patch
=====================================
@@ -0,0 +1,34 @@
+Description: using a replacement BCrypt implementation, which is Debian-packaged
+Author: Pierre Gruet <pgt at debian.org>
+Forwarded: not-needed
+Last-Update: 2022-01-08
+
+--- a/src/megan/ms/Utilities.java
++++ b/src/megan/ms/Utilities.java
+@@ -20,8 +20,9 @@
+ 
+ package megan.ms;
+ 
+-import at.favre.lib.crypto.bcrypt.BCrypt;
+-import jloda.util.Basic;
++//import at.favre.lib.crypto.bcrypt.BCrypt;
++import org.mindrot.jbcrypt.BCrypt;
++//import jloda.util.Basic;
+ import megan.daa.connector.ClassificationBlockDAA;
+ import megan.daa.io.ByteInputStream;
+ import megan.daa.io.ByteOutputStream;
+@@ -124,10 +125,12 @@
+     }
+ 
+     public static  String computeBCryptHash(byte[] password) {
+-        return Basic.toString(BCrypt.withDefaults().hash(6, SALT, password));
++        //return Basic.toString(BCrypt.withDefaults().hash(6, SALT, password));
++        return BCrypt.hashpw(new String(password), BCrypt.gensalt(6));
+     }
+ 
+     public static boolean verify (char[] password,String bcryptHash) {
+-        return BCrypt.verifyer().verify(password,bcryptHash).verified;
++        //return BCrypt.verifyer().verify(password,bcryptHash).verified;
++        return BCrypt.checkpw(new String(password), bcryptHash);
+     }
+ }


=====================================
debian/patches/altering_calls_to_sis-jhdf5.patch
=====================================
@@ -0,0 +1,63 @@
+Description: rewriting some calls to classes of sis-jhdf5
+ Many times methods are called, which are not in the class of the object they
+ are applied to. We implement the right calls.
+Author: Pierre Gruet <pgt at debian.org>
+Forwarded: no
+Last-Update: 2022-01-09
+
+--- a/src/megan/biom/biom2/Biom2ParserTest.java
++++ b/src/megan/biom/biom2/Biom2ParserTest.java
+@@ -73,7 +73,7 @@
+                     classifications.add(taxonomyNameMetadata);
+                     // System.err.println("Elements:  " + reader.getDataSetInformation("/observation/metadata/"+taxonomyNameMetadata).getNumberOfElements());
+ 
+-                    final MDArray<String> array = reader.readStringMDArray("/observation/metadata/" + taxonomyNameMetadata);
++                    final MDArray<String> array = reader.string().readMDArray("/observation/metadata/" + taxonomyNameMetadata);
+                     /*
+                     int[] dimensions = array.dimensions();
+                     if (dimensions.length == 2) {
+--- a/src/megan/biom/biom2/ImportBiom2Taxonomy.java
++++ b/src/megan/biom/biom2/ImportBiom2Taxonomy.java
+@@ -48,7 +48,7 @@
+ 
+         for (final String metaKey : reader.getGroupMembers("/observation/metadata")) {
+             if (Basic.getIndexIgnoreCase(metaKey, keys) != -1) {
+-                pathArray = reader.readStringMDArray("/observation/metadata/" + metaKey);
++                pathArray = reader.string().readMDArray("/observation/metadata/" + metaKey);
+                 dimensions = pathArray.dimensions();
+                 if (dimensions != null && dimensions.length > 0)
+                     break;
+@@ -111,7 +111,7 @@
+     public static boolean hasTaxonomyMetadata(IHDF5Reader reader) {
+         for (final String metaKey : reader.getGroupMembers("/observation/metadata")) {
+             if (Basic.getIndexIgnoreCase(metaKey, keys) != -1) {
+-                final MDArray<String> pathArray = reader.readStringMDArray("/observation/metadata/" + metaKey);
++                final MDArray<String> pathArray = reader.string().readMDArray("/observation/metadata/" + metaKey);
+                 final int[] dimensions = pathArray.dimensions();
+                 if (dimensions != null && dimensions.length > 0)
+                     return true;
+--- a/src/megan/biom/biom2/TopLevelAttributes.java
++++ b/src/megan/biom/biom2/TopLevelAttributes.java
+@@ -93,14 +93,14 @@
+      */
+     private void read(IHDF5Reader reader) throws IOException {
+         try {
+-            id = reader.getStringAttribute("/", "id");
+-            type = reader.getStringAttribute("/", "type");
+-            formatURL = reader.getStringAttribute("/", "format-url");
+-            formatVersion = reader.getIntArrayAttribute("/", "format-version");
+-            generatedBy = reader.getStringAttribute("/", "generated-by");
+-            creationDate = reader.getStringAttribute("/", "creation-date");
+-            shape = reader.getIntArrayAttribute("/", "shape");
+-            nnz = reader.getIntAttribute("/", "nnz");
++            id = reader.string().getAttr("/", "id");
++            type = reader.string().getAttr("/", "type");
++            formatURL = reader.string().getAttr("/", "format-url");
++            formatVersion = reader.int32().getArrayAttr("/", "format-version");
++            generatedBy = reader.string().getAttr("/", "generated-by");
++            creationDate = reader.string().getAttr("/", "creation-date");
++            shape = reader.int32().getArrayAttr("/", "shape");
++            nnz = reader.int32().getAttr("/", "nnz");
+         } catch (Exception ex) {
+             System.err.println("BIOM2 parser: Some required top-level attribute(s) missing.");
+             throw new IOException(ex);


=====================================
debian/patches/fix_class_path.patch
=====================================
@@ -3,7 +3,7 @@ Last-Update: 2022-01-08
 Description: setting paths of Debian jars used during the build
 --- a/antbuild/build.xml
 +++ b/antbuild/build.xml
-@@ -22,22 +22,29 @@
+@@ -22,22 +22,30 @@
  		<property name="ant.build.javac.target" value="13"/>-->
  
  		<property name="jfxDir" value="../../javafx/lib"/>
@@ -22,6 +22,7 @@ Description: setting paths of Debian jars used during the build
 +                        <fileset dir="/usr/share/java/"  includes="javafx-fxml.jar"/>
 +                        <fileset dir="/usr/share/java/"  includes="javafx-graphics.jar"/>
 +                        <fileset dir="/usr/share/java/"  includes="javafx-swing.jar"/>
++			<fileset dir="/usr/share/java/"  includes="jbcrypt.jar"/>
 +			<fileset dir="/usr/share/java/"  includes="jloda.jar"/>
 +                        <fileset dir="/usr/share/java/"  includes="sis-jhdf5.jar"/>
 +                        <fileset dir="/usr/share/java/"  includes="xerial-sqlite-jdbc.jar"/>
@@ -38,7 +39,7 @@ Description: setting paths of Debian jars used during the build
  			<fileset dir="../antbuild"  includes="megan.jar"/>
  		</path>
  
-@@ -48,10 +55,6 @@
+@@ -48,10 +56,6 @@
  			<mkdir dir="${buildModulesDir}/megan"/>
  		</target>
  
@@ -49,7 +50,7 @@ Description: setting paths of Debian jars used during the build
  		<target name="copy_sources" depends="init">
  			<copy todir="${buildSrcDir}/megan">
  				<fileset dir="../src"/>
-@@ -98,7 +101,6 @@
+@@ -98,7 +102,6 @@
  			<delete dir="${buildModulesDir}" includeEmptyDirs="true"/>
  			<delete dir="${buildSrcDir}" includeEmptyDirs="true"/>
  			<delete file="megan.jar"/>


=====================================
debian/patches/omit_ComputeContrastsCommand.patch
=====================================
@@ -0,0 +1,203 @@
+Description: omitting a class, as its dependency Contrasts is not packaged
+Author: Pierre Gruet <pgt at debian.org>
+Forwarded: not-needed
+Last-Update: 2022-01-08
+
+--- a/src/megan/groups/commands/ComputeContrastsCommand.java
++++ /dev/null
+@@ -1,195 +0,0 @@
+-/*
+- * ComputeContrastsCommand.java Copyright (C) 2020. Daniel H. Huson
+- *
+- *  (Some files contain contributions from other authors, who are then mentioned separately.)
+- *
+- *  This program is free software: you can redistribute it and/or modify
+- *  it under the terms of the GNU General Public License as published by
+- *  the Free Software Foundation, either version 3 of the License, or
+- *  (at your option) any later version.
+- *
+- *  This program is distributed in the hope that it will be useful,
+- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+- *  GNU General Public License for more details.
+- *
+- *  You should have received a copy of the GNU General Public License
+- *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+- *
+- */
+-package megan.groups.commands;
+-
+-import contrasts.Contrasts;
+-import jloda.graph.Graph;
+-import jloda.graph.Node;
+-import jloda.graph.NodeData;
+-import jloda.swing.commands.CommandBase;
+-import jloda.swing.commands.ICommand;
+-import jloda.util.Basic;
+-import jloda.util.Pair;
+-import jloda.util.ProgramProperties;
+-import jloda.util.parse.NexusStreamParser;
+-import megan.classification.Classification;
+-import megan.classification.ClassificationManager;
+-import megan.core.Director;
+-import megan.core.Document;
+-import megan.data.IName2IdMap;
+-import megan.groups.GroupsViewer;
+-import megan.viewer.ClassificationViewer;
+-
+-import javax.swing.*;
+-import java.awt.*;
+-import java.awt.event.ActionEvent;
+-import java.awt.event.KeyEvent;
+-import java.util.List;
+-import java.util.*;
+-
+-/**
+- * * compute contrasts command
+- * * Daniel Huson, 8.2014
+- */
+-public class ComputeContrastsCommand extends CommandBase implements ICommand {
+-    public String getSyntax() {
+-        return "compute contrasts data={" + Basic.toString(ClassificationManager.getAllSupportedClassifications(), ",") + "}";
+-    }
+-
+-    /**
+-     * parses the given command and executes it
+-     *
+-     * @param np
+-     * @throws java.io.IOException
+-     */
+-    @Override
+-    public void apply(NexusStreamParser np) throws Exception {
+-        np.matchIgnoreCase("compute contrasts data=");
+-        final String viewerName = np.getWordMatchesIgnoringCase(Basic.toString(ClassificationManager.getAllSupportedClassifications(), " "));
+-        np.matchIgnoreCase(";");
+-
+-        if (getViewer() instanceof GroupsViewer) {
+-            final GroupsViewer viewer = (GroupsViewer) getViewer();
+-            final Document doc = viewer.getDir().getDocument();
+-            final Pair<String, String> twoGroupIds = viewer.getGroupsPanel().getTwoSelectedGroups();
+-            if (twoGroupIds != null) {
+-                ArrayList<String> first = new ArrayList<>();
+-                for (String sample : doc.getSampleNames()) {
+-                    if (doc.getSampleAttributeTable().getGroupId(sample).equals(twoGroupIds.getFirst()))
+-                        first.add(sample);
+-                }
+-                ArrayList<String> second = new ArrayList<>();
+-                for (String sample : doc.getSampleNames()) {
+-                    if (doc.getSampleAttributeTable().getGroupId(sample).equals(twoGroupIds.getSecond()))
+-                        second.add(sample);
+-                }
+-
+-                final String[] samples = doc.getSampleNamesAsArray();
+-
+-                if (first.size() > 0 && second.size() > 0) {
+-                    // compute data map for contrasts:
+-                    Map<String, Map<String, Double>> data = new HashMap<>();
+-                    int numberOfNodes = 0;
+-
+-
+-                    final IName2IdMap name2IdMap;
+-
+-                    final ClassificationViewer classificationViewer = (ClassificationViewer) ((Director) getDir()).getViewerByClassName(viewerName);
+-                    final Graph graph = classificationViewer.getGraph();
+-                    name2IdMap = classificationViewer.getClassification().getName2IdMap();
+-
+-                    for (Node v = graph.getFirstNode(); v != null; v = graph.getNextNode(v)) {
+-                        int classId = (Integer) v.getInfo();
+-                        if (classId > 0) {
+-                            NodeData nd = (NodeData) v.getData();
+-                            for (int t = 0; t < samples.length; t++) {
+-                                String sample = samples[t];
+-                                Map<String, Double> classId2Counts = data.computeIfAbsent(sample, k -> new HashMap<>());
+-                                classId2Counts.put(name2IdMap.get(classId), (double) (v.getOutDegree() > 0 ? nd.getAssigned()[t] : nd.getSummarized()[t]));
+-                            }
+-                            numberOfNodes++;
+-                        }
+-                    }
+-
+-                    final Contrasts contrasts = new Contrasts();
+-
+-                    try {
+-                        Basic.hideSystemErr();
+-                        contrasts.apply(data);
+-                    } finally {
+-                        Basic.restoreSystemErr();
+-                    }
+-                    executeImmediately("show window=message;");
+-                    System.out.println("\nContrasts for " + viewerName + " assignments on " + numberOfNodes + " nodes:");
+-
+-                    System.out.println("Group " + twoGroupIds.getFirst() + ": " + Basic.toString(first, ","));
+-                    System.out.println("Group " + twoGroupIds.getSecond() + ": " + Basic.toString(second, ","));
+-
+-                    System.out.println("Results for group " + twoGroupIds.getFirst() + " vs group " + twoGroupIds.getSecond() + ":");
+-                    Map<String, Double> results = contrasts.getSplitScores(first.toArray(new String[0]), second.toArray(new String[0]));
+-
+-                    SortedSet<Pair<Double, String>> sorted = new TreeSet<>();
+-                    System.out.println(String.format("%-20s\tScore", viewerName));
+-                    for (String taxon : results.keySet()) {
+-                        double value = results.get(taxon); // clamp to range -1 1
+-                        if (value < -1)
+-                            value = -1;
+-                        else if (value > 1)
+-                            value = 1;
+-                        sorted.add(new Pair<>(-value, taxon)); // negative sign to sort from high to low...
+-                    }
+-                    System.out.println("Number of results: " + sorted.size());
+-                    System.out.println("--------------------------------------");
+-                    for (Pair<Double, String> pair : sorted) {
+-                        if ((-pair.getFirst()) >= 0)
+-                            System.out.println(String.format("%-20s\t %1.4f", pair.getSecond(), (-pair.getFirst())));
+-                        else
+-                            System.out.println(String.format("%-20s\t%1.4f", pair.getSecond(), (-pair.getFirst())));
+-                    }
+-                    System.out.println("--------------------------------------");
+-                }
+-            }
+-            viewer.setIgnoreNextUpdateAll(true); // this prevents loss of selection
+-        }
+-    }
+-
+-    public void actionPerformed(ActionEvent event) {
+-        List<String> openViewers = new ArrayList<>();
+-        for (String name : ClassificationManager.getAllSupportedClassifications()) {
+-            if (((Director) getDir()).getViewerByClassName(name) != null)
+-                openViewers.add(name);
+-        }
+-        if (!openViewers.contains(Classification.Taxonomy))
+-            openViewers.add(Classification.Taxonomy);
+-
+-        if (openViewers.size() == 1) {
+-            execute("compute contrasts data=" + openViewers.get(0) + ";");
+-        } else if (openViewers.size() > 1) {
+-            String[] choices = openViewers.toArray(new String[0]);
+-            String result = (String) JOptionPane.showInputDialog(getViewer().getFrame(), "Choose viewer", "Choose viewer", JOptionPane.PLAIN_MESSAGE, ProgramProperties.getProgramIcon(), choices, choices[0]);
+-            if (result != null)
+-                execute("compute contrasts data=" + result + ";");
+-        }
+-    }
+-
+-    public boolean isApplicable() {
+-        return (getViewer() instanceof GroupsViewer) && (((GroupsViewer) getViewer()).getGroupsPanel().getTwoSelectedGroups() != null);
+-    }
+-
+-    public String getName() {
+-        return "Compute Contrasts...";
+-    }
+-
+-    public String getDescription() {
+-        return "Computes contrasts on two selected groups";
+-    }
+-
+-    public ImageIcon getIcon() {
+-        return null;
+-    }
+-
+-    public boolean isCritical() {
+-        return true;
+-    }
+-
+-    public KeyStroke getAcceleratorKey() {
+-        return KeyStroke.getKeyStroke(KeyEvent.VK_R, Toolkit.getDefaultToolkit().getMenuShortcutKeyMaskEx());
+-    }
+-}


=====================================
debian/patches/series
=====================================
@@ -2,3 +2,6 @@ build.patch
 fix_class_path.patch
 do_not_check_for_update.patch
 no_module_info.patch
+omit_ComputeContrastsCommand.patch
+BCrypt_replacement.patch
+altering_calls_to_sis-jhdf5.patch



View it on GitLab: https://salsa.debian.org/med-team/megan-ce/-/compare/04602583e555ec51cd59259c58ad2fc13b942c22...def5c3e38fed499579d0d051f5c6897af95ee35a

-- 
View it on GitLab: https://salsa.debian.org/med-team/megan-ce/-/compare/04602583e555ec51cd59259c58ad2fc13b942c22...def5c3e38fed499579d0d051f5c6897af95ee35a
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/20220114/955b50ff/attachment-0001.htm>


More information about the debian-med-commit mailing list