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

sourcetrail: init at 2018.3.55 #47594

Merged
merged 1 commit into from Oct 30, 2018
Merged

Conversation

midchildan
Copy link
Member

Motivation for this change

Sourcetrail is a cross referencer for C/C++/Java

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)
  • Fits CONTRIBUTING.md.

$out/share/applications/sourcetrail.desktop \
--replace /usr/bin/ $out/bin/

# FIXME: not working
Copy link
Member Author

Choose a reason for hiding this comment

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

I can't seem to change the permission of default configuration files that are copied to the user's home directory upon first launch. Does anyone have a clue why this is happening?

Copy link
Member

Choose a reason for hiding this comment

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

Everything in the nix store is always read only.

Copy link
Member Author

Choose a reason for hiding this comment

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

@symphorien Do you mean even during installPhase ?

Copy link
Member

Choose a reason for hiding this comment

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

When the build is over, $out will be made read only.


dontBuild = true;

nativeBuildInputs = [ makeWrapper ];
Copy link
Member

Choose a reason for hiding this comment

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

I have a simplified version using autoPatchelfHook:
https://github.com/Mic92/nur-packages/blob/master/pkgs/sourcetrail/default.nix

This will be easier to maintain then manual patchelf/LD_LIBRARY_PATH.

Copy link
Member Author

Choose a reason for hiding this comment

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

Have you considered moving this to nixpkgs?

Copy link
Member

Choose a reason for hiding this comment

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

No, I don't use it and do not have a license.

Copy link
Member

Choose a reason for hiding this comment

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

I will remove it from NUR once it lands in nixpkgs.

@midchildan
Copy link
Member Author

midchildan commented Oct 22, 2018

I made some changes based on @Mic92's version. I still couldn't figure out how to change permissions for the initial configuration files, so I made a wrapper command that manually copies those files on first launch.


cat <<EOF > $out/bin/sourcetrail
#! ${stdenv.shell} -e
mkdir -p ~/.config/sourcetrail
Copy link
Member

@Mic92 Mic92 Oct 22, 2018

Choose a reason for hiding this comment

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

This should be skipped if $HOME is not set. Sourcetrail does not use the fallback configuration from its package itself?

Copy link
Member Author

Choose a reason for hiding this comment

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

It does, but it gets copied into the home directory without write permissions. I've tried setting write permissions for the original copy during installPhase, but then I got a "Permission denied" error.

mv -v plugin $out/share/sourcetrail

cp -rv . $out/opt
rm $out/opt/lib/libssl.so
Copy link
Member

Choose a reason for hiding this comment

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

Does a symlink works here? Then LD_LIBRARY_PATH becomes unnecessary.

$out/share/applications/sourcetrail.desktop \
--replace /usr/bin/ $out/bin/

cat <<EOF > $out/bin/sourcetrail
Copy link
Member

@Mic92 Mic92 Oct 22, 2018

Choose a reason for hiding this comment

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

The variables here are expanded at build time: The wrapper currently contains /homeless-shelter instead of $HOME.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks, that explains the problems I was having with the wrapper script.

@midchildan
Copy link
Member Author

With the wrapper script taking care of the permission problem, things seem to work okay now. It should be ready for merge.

@Mic92
Copy link
Member

Mic92 commented Oct 30, 2018

It does not yet work for java. I think this could become another pull request:

https://dl.thalheim.io/WOpRngYvf_rmV1TEZL8Ehw/Screenshot_20181030_120612.png

maybe @egraether can give us a hint how sourcetrail tries to figure out where java is.
JAVA_HOME is not enough apparently.

@Mic92 Mic92 merged commit d23d25e into NixOS:master Oct 30, 2018
@Mic92
Copy link
Member

Mic92 commented Oct 30, 2018

Ok there is a setting to specify this manually. However dlopen fails here for some reason:

Sourcetrail was unable to locate Java on this machine.
Please make sure to provide the correct Java Path in the preferences.

Error: Could not load library "/nix/store/5lcwd2h26m64f8hln9b3m29jprl06n5y-openjdk-8u181b13/lib/openjdk/jre/lib/amd64/server/libjvm.so"

@egraether
Copy link

On first start Sourcetrail tries to find the java installation with which java, then by looking at $JAVA_HOME, then some standard locations. If the libjvm.so library is found, then that path is automatically set. Otherwise you can enter it manually in the preferences.

If the dlopen fails then the only reason I can think of is that Sourcetrail and the Java library are built for different architectures. Are you using the 64bit Sourcetrail build?


src = fetchurl {
name = "sourtrail.tar.gz";
url = "https://www.sourcetrail.com/downloads/${version}/linux/64bit";
Copy link
Member

Choose a reason for hiding this comment

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

This should be the 64-bit version. jdk is also 64-bit of course.

@midchildan midchildan deleted the add-sourcetrail branch September 19, 2020 12:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants