Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

excelCompare: init at 0.6.1 #55434

Closed
wants to merge 1 commit into from

Conversation

ilikeavocadoes
Copy link
Contributor

Motivation for this change

Add utility to produce text diff of Excel files. Couldn't build from source since it requires Java version <= 6 which is not in Nixpkgs.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Assured whether relevant documentation is up to date
  • Fits CONTRIBUTING.md.

chmod 555 $out/bin/excel_cmp
mv $out/bin/excel_cmp $out/bin/excel_cmp.sh
makeWrapper $out/bin/excel_cmp.sh $out/bin/excel_cmp \
--prefix PATH : ${lib.makeBinPath [ jdk ]}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you don't need to rename excel_cmp before wrapping: wrapProgram is an equivalent of makeWrapper which wraps in place.
But reading the script it would be better to use the approach of https://nixos.org/nixpkgs/manual/#sec-language-java
that is:

  • put all jars in $out/share/excel-cmp
  • wrap java exactly as they do in the example, setting the class path to $out/share/excel-cmp/*

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review. In the example for makeWrapper, what am I supposed to put in place of org.foo.Main? I tried com.ka.spreadsheet.diff.SpreadSheetDiffer as is in the original excel_cmp startup script, but it results in Error: Could not find or load main class .nix.store.3ykvmyv0ihvdpvxvdcivld3jf89blj83-ExcelCompare-0.6.1.share.excel_cmp.commons-digester-1.8.jar.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this works for me:

diff --git a/pkgs/tools/text/excelCompare/default.nix b/pkgs/tools/text/excelCompare/default.nix
index a0ec897eb5e..b433aa5e518 100644
--- a/pkgs/tools/text/excelCompare/default.nix
+++ b/pkgs/tools/text/excelCompare/default.nix
@@ -1,4 +1,4 @@
-{stdenv, lib, fetchurl, makeWrapper, unzip, jdk}:
+{stdenv, lib, fetchurl, makeWrapper, unzip, jre}:
 
 stdenv.mkDerivation rec {
   name = "ExcelCompare-${version}";
@@ -7,16 +7,14 @@ stdenv.mkDerivation rec {
     url = "https://github.com/na-ka-na/ExcelCompare/releases/download/${version}/ExcelCompare-${version}.zip";
     sha256 = "1304qraazqm8mgjgnijzl070l0haa8jds7spnsy3xwh3vda0ka4x";
   };
-  buildInputs = [ jdk unzip makeWrapper ];
+  nativeBuildInputs = [ unzip makeWrapper ];
   sourceRoot = ".";
 
   installPhase = ''
-    mkdir -p $out
-    cp -r bin $out/bin
-    chmod 555 $out/bin/excel_cmp
-    mv $out/bin/excel_cmp $out/bin/excel_cmp.sh
-    makeWrapper $out/bin/excel_cmp.sh $out/bin/excel_cmp \
-      --prefix PATH : ${lib.makeBinPath [ jdk ]}
+    install -Dt $out/share/excelcmp bin/dist/*
+    mkdir -p $out/bin
+    makeWrapper ${jre}/bin/java $out/bin/excelcmp \
+      --add-flags "-ea -cp $out/share/excelcmp/\* com.ka.spreadsheet.diff.SpreadSheetDiffer"
   '';
 
   meta = {

the trick is to prevent the wildcard * from being expanded by the shell

url = "https://github.com/na-ka-na/ExcelCompare/releases/download/${version}/ExcelCompare-${version}.zip";
sha256 = "1304qraazqm8mgjgnijzl070l0haa8jds7spnsy3xwh3vda0ka4x";
};
buildInputs = [ jdk unzip makeWrapper ];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makewrapper and unzip should be nativeBuildInputs

@symphorien
Copy link
Member

This binary distribution redistributes a number of third party libraries: are they all redistributable under the MIT licence ?

@ilikeavocadoes
Copy link
Contributor Author

This binary distribution redistributes a number of third party libraries: are they all redistributable under the MIT licence ?

I will try and find the licenses of the third party libraries. In case they have a different license, what should I put as the meta.license?

@symphorien
Copy link
Member

meta.license can be a list, but I don't know if it means license A OR B or A AND B.

@symphorien
Copy link
Member

Also, please fix the ofborg failure, apparently meta.maintainers does not evaluate.

@ilikeavocadoes
Copy link
Contributor Author

Also, please fix the ofborg failure, apparently meta.maintainers does not evaluate.

Seems like I hadn't already added myself to maintainer list, while I thought I had. I made a pull request of it (#55512). Should I wait until it gets merged and then rebase on master?

@ilikeavocadoes
Copy link
Contributor Author

I couldn't make sense of the 3rd party licenses, nor how they should be (or should they be) included in the meta attributes, so I just removed that field for the time being.

@ilikeavocadoes
Copy link
Contributor Author

The source repo has a directory of the third party licenses: https://github.com/na-ka-na/ExcelCompare/tree/master/legal

Now the issue seems to be that how can this be included in meta? Also, I'm absolutely clueless about these licenses' implications to the redistributability of this software, as my understanding about the copyright laws is zero.

@symphorien
Copy link
Member

you can write something like

{
meta.license = with stdenv.lib.licenses; [ mit asl20 ];
}

I have no idea whether it means OR or AND.

@aanderse
Copy link
Member

aanderse commented Jul 13, 2019

@ilikeavocadoes I would suggest filling an issue upstream to get clarification on the licensing situation so we can proceed with this.

Copy link
Member

@ryantm ryantm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix evaluation errors.

@stale
Copy link

stale bot commented Jul 3, 2020

Thank you for your contributions.

This has been automatically marked as stale because it has had no activity for 180 days.

If this is still important to you, we ask that you leave a comment below. Your comment can be as simple as "still important to me". This lets people see that at least one person still cares about this. Someone will have to do this at most twice a year if there is no other activity.

Here are suggestions that might help resolve this more quickly:

  1. Search for maintainers and people that previously touched the related code and @ mention them in a comment.
  2. Ask on the NixOS Discourse.
  3. Ask on the #nixos channel on irc.freenode.net.

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jul 3, 2020
@SuperSandro2000
Copy link
Member

Closing due to inactivity. Feel free to reopen the discussion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md 8.has: package (new) 10.rebuild-darwin: 0 10.rebuild-linux: 1-10
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants