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

Add perl to nix-shell #507

Merged
merged 1 commit into from Dec 19, 2018
Merged

Add perl to nix-shell #507

merged 1 commit into from Dec 19, 2018

Conversation

gdeest
Copy link
Contributor

@gdeest gdeest commented Dec 10, 2018

This PR fixes a mostly innocuous error when running tests regarding missing Perl:

[nix-shell:~/code/rules_haskell]$ bazel test tests/haskell_test/...
INFO: Analysed 2 targets (0 packages loaded).
INFO: Found 1 target and 1 test target...
haskell_test fired
external/bazel_tools/tools/test/test-setup.sh: line 160: perl: command not found
INFO: Elapsed time: 0.247s, Critical Path: 0.11s
INFO: 1 process: 1 processwrapper-sandbox.
INFO: Build completed successfully, 2 total actions
//tests/haskell_test:haskell_test                                        PASSED in 0.0s

INFO: Build completed successfully, 2 total actions

It seems Bazel expects Perl to be in PATH for minor things, such as regexp-based editing.

@Profpatsch mentioned that we could instead file a patch upstream to remove the dependencies. We could have that discussion here.

@mboes
Copy link
Member

mboes commented Dec 10, 2018

Cannot reproduce.

$ nix-shell --pure
[nix-shell:~/src/tweag/rules_haskell]$ bazel test //tests/haskell_test/...
/nix/store/rxl8zia74r3sz9ndy624shhp2kfzxh0a-all-haskell-packages.bzl
/nix/store/jzl6qh6wrvzwfrgw6i6jra17j1bdw9k4-bazel-cc-toolchain
INFO: Build options have changed, discarding analysis cache.
/nix/store/whh4d9yplnpm7pykmhb7v1fn3y63v9rp-glibc-locales-2.27
/nix/store/npy34yz3g7fnxrjh75kv5xxjk3cihsdi-base-bazel
/nix/store/8ybvb7g8b1g7as2jsafxhrl3qs8r35rp-ghc-prim-bazel
/nix/store/gmlsj5ia6yzjxf71hvm665y83c9wq330-rts-bazel
/nix/store/wg5py8hw4pfff2hq0xva4bm3vwwhy4yx-ghc-bazel
/nix/store/6imipp19z62ybv3xpr5wqgrpampdsgzd-c2hs-bazel
/nix/store/ciicimzyc3gy792h34lijgrv82z3cgwv-integer-gmp-bazel
INFO: Analysed 2 targets (32 packages loaded).
INFO: Found 1 target and 1 test target...
INFO: Elapsed time: 38.687s, Critical Path: 0.08s
INFO: 1 process: 1 processwrapper-sandbox.
INFO: Build completed successfully, 2 total actions
//tests/haskell_test:haskell_test                                        PASSED in 0.1s

INFO: Build completed successfully, 2 total actions

On latest master.

@gdeest
Copy link
Contributor Author

gdeest commented Dec 11, 2018

I still witness the issue on latest master. @regnat - I think you witnessed it as well ?

@Profpatsch
Copy link
Contributor

Profpatsch commented Dec 13, 2018

This regex is used twice in the bazel_tools to escape the content of a CDATA field for test output:

# Unused if EXPERIMENTAL_SPLIT_XML_GENERATION is set.
function encode_output_file {
  if [ -f "$1" ]; then
    # Replace invalid XML characters and invalid sequence in CDATA
    # cf. https://stackoverflow.com/a/7774512/4717701
    perl -CSDA -pe's/[^\x9\xA\xD\x20-\x{D7FF}\x{E000}-\x{FFFD}\x{10000}-\x{10FFFF}]+/?/g;' "$1" \
      | sed 's|]]>|]]>]]<![CDATA[>|g'
  fi
}

According to https://stackoverflow.com/questions/7772430/how-to-remove-invalid-characters-from-an-xml-file-using-sed-or-perl/7774512#7774512 it can be replaced with a sed script.

As far as I saw that is also the last remaining usage of perl in bazel for now.

@mboes mboes merged commit 8248187 into master Dec 19, 2018
@mboes mboes deleted the add-perl-to-nix-shell branch December 19, 2018 12:36
@Profpatsch
Copy link
Contributor

We can remove it again once bazelbuild/bazel#4691 is in bazel.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants