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

#104970: Update and rename perl.xml to perl.md #105175

Merged
merged 1 commit into from Dec 7, 2020
Merged

#104970: Update and rename perl.xml to perl.md #105175

merged 1 commit into from Dec 7, 2020

Conversation

StefanSchroeder
Copy link
Contributor

Motivation for this change

Addresses #104970, conversion of Docbook language-support for Perl to CommonMark.

@ryantm

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • 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 nixpkgs-review --run "nixpkgs-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)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@StefanSchroeder
Copy link
Contributor Author

I have deliberately not updated the index.xml, because I expect that the PR will be rejected. But I am interested in the review comments to improve it before actually merging it.

@ryantm
Copy link
Member

ryantm commented Nov 27, 2020

I think you should update the index it makes it easier to test it.

@ryantm ryantm linked an issue Nov 27, 2020 that may be closed by this pull request
@ryantm
Copy link
Member

ryantm commented Nov 27, 2020

perl.md needs to be called perl.section.md

```
to take the Perl installation from the `PATH` environment variable, or invoke Perl directly with:

```
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
```
```ShellSession

Please use ShellSession for these ones.

@@ -0,0 +1,181 @@
# Perl
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
# Perl
# Perl {#sec-language-perl}

We don't want to break anchor links.


## Packaging Perl programs

Nixpkgs provides a function *buildPerlPackage*, a generic package builder function for any Perl package that has a standard *Makefile.PL*. It’s implemented in
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Nixpkgs provides a function *buildPerlPackage*, a generic package builder function for any Perl package that has a standard *Makefile.PL*. It’s implemented in
Nixpkgs provides a function `buildPerlPackage`, a generic package builder function for any Perl package that has a standard `Makefile.PL`. It’s implemented in

I think it's more idiomatic in Markdown to use literals instead of emphasis for this kind of thing.

Copy link
Contributor

Choose a reason for hiding this comment

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

Also the indentation looks weird.

Perl packages from CPAN are defined in
[pkgs/top-level/perl-packages.nix](https://github.com/NixOS/nixpkgs/blob/master/pkgs/top-level/perl-packages.nix) rather than `pkgs/all-packages.nix`. Most Perl packages are so straight-forward to build that they are defined here directly, rather than having a separate function for each package called from `perl-packages.nix`. However, more complicated packages should be put in a separate file, typically in `pkgs/development/perl-modules`. Here is an example of the former:

```
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
```
```nix

Bunch of places need this change.

@StefanSchroeder
Copy link
Contributor Author

I have updated the files (index.xml & perl.section.md) but I don't know what to do next.
Do I need to file another PR?

@ryantm
Copy link
Member

ryantm commented Nov 28, 2020

Do I need to file another PR?

No, your changes got reflected in this one. I'll take a look in a bit, thanks!

@StefanSchroeder
Copy link
Contributor Author

I hadn't seen the "Commit suggestion" button before. That's so much quicker!

}
```

Dependencies on other Perl packages can be specified in the ´buildInputs´ and ´propagatedBuildInputs´ attributes.
Copy link
Contributor

Choose a reason for hiding this comment

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

Somehow backticks got turned to forward ticks.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's weird, no idea how that happened. Fixed multiple occurrences.

So what does ´buildPerlPackage´ do? It does the following:

1. In the configure phase, it calls `perl Makefile.PL` to generate a Makefile. You can set the variable `makeMakerFlags` to pass flags to `Makefile.PL`
2. It adds the contents of the <envar>PERL5LIB</envar> environment variable to `#! .../bin/perl` line of Perl scripts as `-I<replaceable>dir</replaceable>` flags. This ensures that a script can find its dependencies. (This can cause this shebang line to become too long for Darwin to handle; see the note below.)
Copy link
Contributor

Choose a reason for hiding this comment

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

Replaceables have not been replaced.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed and . Multiple instances.

This will remove the `-I` flags from the shebang line, rewrite them in the `use lib` form, and put them on the next line instead.
This function can be given any number of Perl scripts as arguments; it will modify them in-place.

## Generation from CPAN {#ssec-generation-from-CPAN}
Copy link
Contributor

Choose a reason for hiding this comment

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

This section and the one below previously belonged under “Packaging Perl programs”. Is this change intentional?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, it was not intentional. When looking at the XML source it's difficult to keep track of this kind of detail. It's fixed by increasing the section level from '##' to '###'. Hope that's supported.

@StefanSchroeder
Copy link
Contributor Author

I'll fix it coming weekend.

This happens when the script expects Perl to be installed at `/usr/bin/perl`, which is not the case when using Perl from nixpkgs.
You can fix the script by changing the first line to:

```ShellSession
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a perl snippet.


If you are always using the script in places where `nix-shell` is available, you can embed the `nix-shell` invocation in the shebang like this:

```ShellSession
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here.


## Packaging Perl programs {#ssec-perl-packaging}

Nixpkgs provides a function `buildPerlPackage`, a generic package builder function for any Perl package that has a standard `Makefile.PL`. It’s implemented in
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are the lines split frequently? Try using the formatter from #105243

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wasn't aware that there is a formatter. I will try it out next.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jtolnar I am unable to squash my commits. Trying to follow the instructions here https://medium.com/@mittalyashu/how-to-squash-commits-in-a-github-pull-request-97b36576eacb leads to a tremendous amount of merge conflicts by commits that I didn't make... Please advise.
"Auto-merging pkgs/top-level/all-packages.nix
CONFLICT (content): Merge conflict in pkgs/top-level/all-packages.nix
error: could not apply a64d7d8... Revert "Revert "texinfo: revert to version 6.5 on Darwin""
"

Copy link
Contributor

Choose a reason for hiding this comment

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

For squashing, I would suggest rebasing onto the parent commit of your first commit instead of master. That way you will have less commits to worry about.

git rebase -i c7a82285f6c63816b66e78fa1b66fb2bfbe67f8f^

But note that you will need to rebase onto master anyway, to resolve the conflict in index.xml.

@jtojnar
Copy link
Contributor

jtojnar commented Dec 4, 2020

Also, could you please squash the changes?

@StefanSchroeder
Copy link
Contributor Author

StefanSchroeder commented Dec 6, 2020

@jtojnar: This is a shoutout to @jtojnar for kindly and patiently guiding me through the commit process of my first contribution. (I don't know what I am doing here. Luckily on the internet no one knows you're a dog.)

@jtojnar
Copy link
Contributor

jtojnar commented Dec 7, 2020

Thanks.

I have rebased it since another merge conflict sneaked in and will merge this after the CI finishes,

@jtojnar jtojnar merged commit 6571462 into NixOS:master Dec 7, 2020
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.

Convert Perl from Docbook to CommonMark
3 participants