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

rPackages.littler: fix build #51282

Merged
merged 1 commit into from Dec 6, 2018
Merged

rPackages.littler: fix build #51282

merged 1 commit into from Dec 6, 2018

Conversation

ckauhaus
Copy link
Contributor

@ckauhaus ckauhaus commented Nov 30, 2018

Motivation for this change

The littler build was completely broken. Fix littler by providing necessary deps and moving build artefacts into bin, man, doc.

Usage:

nix-env -iA nixpkgs.rPackages.littler
# or put rPackages.littler into environment.systemPacakges
man r
r

Provides an alias lr for non-case-preserving filesystems (think Darwin) as proposed by the package author.

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) -> N/A (build was broken before)
  • Assured whether relevant documentation is up to date
  • Fits CONTRIBUTING.md.

littler = old.littler.overrideAttrs (attrs: with pkgs; {
buildInputs = [ pcre lzma zlib bzip2 icu which ] ++ attrs.buildInputs;
propagatedBuildInputs = [ which ] ++ attrs.propagatedBuildInputs;
outputs = [ "out" "man" "doc" ];
Copy link
Member

Choose a reason for hiding this comment

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

No other R package provides those outputs, so don't think it's a good idea to add them here because nobody will expect those outputs to exist.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you think I should just leave split-outputs out (put everything into $out) or that this package should rather do to top-level all-packages.nix? It differs from most other R packages in the way that it provides a separate entry point into the R ecosystem.

@@ -950,6 +950,18 @@ let
preConfigure = "patchShebangs configure";
});

littler = old.littler.overrideAttrs (attrs: with pkgs; {
buildInputs = [ pcre lzma zlib bzip2 icu which ] ++ attrs.buildInputs;
propagatedBuildInputs = [ which ] ++ attrs.propagatedBuildInputs;
Copy link
Member

Choose a reason for hiding this comment

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

Why does this package have to propagate which?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because it won't build otherwise. Example error output in case this is left out:

** testing if installed package can be loaded
Error: package or namespace load failed for 'littler':
 .onAttach failed in attachNamespace() for 'littler', details:
  call: system(paste(which, shQuote(names[i])), intern = TRUE, ignore.stderr = TRUE)
  error: error in running command
Error: loading failed

Taking it one level back it seems that access to which is actually a core dependency of R. There are 15+ package overrides present in https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/r-modules/default.nix that put which into propagatedBuildInputs on a per-package basis. Perhaps it would even cleaner to move which from buildInputs to propagatedBuildInputs in https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/science/math/R/default.nix#L18. Thoughts?

propagatedBuildInputs = [ which ] ++ attrs.propagatedBuildInputs;
outputs = [ "out" "man" "doc" ];
postInstall = ''
install -D inst/bin/r $out/bin/r
Copy link
Member

Choose a reason for hiding this comment

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

The install process copies dozens of files into $out, albeit into strange locations. Now, this code will add even more files, some of them clearly duplicates. I think it would be better to clean up the generated output, i.e. remove files that aren't needed and move others into the right place.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I'll clean it up. But we should probably decide upon the questions at top.

littler gives a wrapped called `r` (or `lr` for non-case-preserving
systems like Darwin) which works as shebang or pipe target.

The build was completely broken before (missing deps).

Symlink executables and manpage into standard locations so that this
packages also works in `environment.systemPackages`.
@ckauhaus
Copy link
Contributor Author

ckauhaus commented Dec 6, 2018

@peti Second attempt.

Things changed:

  • which is now a build-time not run-time dependency
  • removed multiple outputs
  • de-duplicated $out: bin and man now symlink into their R library locations
  • clean up: removed script-tests since they aren't useful here
  • left docs, examples and html in place since most other R packages do the same.

Now acceptable?

@peti peti merged commit 3b44504 into NixOS:master Dec 6, 2018
@ckauhaus ckauhaus deleted the r-littler branch December 7, 2018 09:00
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

3 participants