-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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 package #1339
Add perl package #1339
Conversation
Non-boolean variants should be working, they were mixed in with the cflags support. |
@becker33 Really? I don't see anything in the documentation and I haven't heard anything about non-boolean variants. If they existed, I imagine most of the MPI packages would be rewritten immediately haha.
Did you run
If you want to keep track of the version or be able to change the version, I think your best bet is to add it as a separate package that depends on perl.
@davydden added a if self.run_tests:
make('test') |
The way I understand it, |
They are working. Apparently I forgot about them when I wrote the documentation. I’ll look at the documentation and find a place for them. |
They’re in the documentation. Check the basic_usage guide. |
Interesting. I'll open a separate issue for this, but I would be interested in implementing this for MPI, since most of the variants are mutually exclusive. |
@becker33 -- I saw the example in the basic usage guide (first para in the variants section...) but wasn't able to figure out how to fish the value of a variant out of the specification and found a related pull request that still seemed to be in progress. Sorry I mis-represented the state of the world. I'm an unsophisticated Python programmer (for now...). I did a bit of grep and acking looking for other packages that would show me how to access it, but .... Given [momentarily putting aside the issue of whether this should be a variant or another package or...] something like this:
how would I access the value of the variant? |
@adamjstewart -- w.r.t. header info. I started from JustinToo's work, not something fresh. Looking at e.g. the R/package.py, I can't use the "Copyright ... Lawrence Livermore ..." bit though, nor the "Created by Todd Gamblin". Do I need to do "contributor" paperwork, or..... The initial file created by |
You can use it. Every single package in all of Spack uses it, whether or not it was created by @tgamblin or someone who works at LLNL. Honestly, I don't know why we need this in every file. I feel like the LICENSE file in $SPACK_ROOT is plenty, but maybe @tgamblin can fill me in on the legalities.
|
To access the value of a non-boolean variant foo from the install method, use
To test whether a variant foo has value bar in a package.py file, use
Hope that helps! |
@adamjstewart -- w.r.t. extensions and Perl. I'm still fairly confused about how extensions work, I don't think that they're going to work in the Perl world and I'm nearly certain that they're not the right solution to including a copy of cpanm into each Perl (part of my opinionated Perl practices). Stacking or pooling modules that weren't installed in a coherent manner (the same interpreter, the same stack of library directories) is not reliable. A number of perl modules involve compiled C code. Modules that have been compiled with one I think that Perl modules/distributions are finer grained than the other dynamic languages' equivalents. You don't just install Moose, you install all of its missing dependencies too. If you then install an isolated tree of some other unrelated distribution (perhaps Rose::DB) it will drag in all of its prerequisites. How do you merge those two trees? What happens if some extension was activated when Moose was installed but then inactivated? Where are Moose's dependencies now? Worse, there may be versioning conflicts between modules in the two deployments. The Perl language's ability to specify versions for prerequisites is weak (just "unspecified" or "must be at least X"). Some tools (cpanm, dzil) have richer models but they're not ubiquitous. This makes sharing tricky. Proper perl-based things are installed using perl tools. If I build and test a package with a particular perl, it's safe to assume that it will work with that perl. Installers like There are also some historical issues and bugs in how the installers figure out whether they need to install a module (or an updated version of one) vis a vis what's in a particular perl's core. Over the years, I've adopted a fairly uptight approach to supporting complex perl things in complex environments, no coupling. I install and share perl+cpanm and keep it unsullied. Every project maintains it's own project specific local library with all of its non-core dependencies, accessed via the I strongly discourage layering multiple directories onto The inconvenience of each project (each developer, often...) installing {its,her,his} own copy of a package is minor, but we revel in not being taken down by someone else's changes. TL;DR (wow, you made it this far). I'm open to seeing extensions work for Perl but want to be sure to provide access to an unsullied perl core+cpanm. |
@becker33 -- Thanks! (now I've learned something new today!) |
@adamjstewart -- r.e. What's the Spack best practice? Default to running the tests (my world view...) or skip them and trust to luck (I think I've been listening to too much convention coverage...)? But seriously, my bias is to run the and perhaps give people a way to skip them. It sounds as if Spack tends the other way. Would leaving it as is block getting this included? |
@hartzell What you're describing sounds fairly similar to the way Python's extensions work. Let me try to explain how Spack handles Python and clear up any misconceptions.
Yep. So if you build a Perl extension with Spack and activate it, it can only be activated to the Perl that it was built with. Does that address your concerns? Unfortunately we don't yet hash the phase of the moon, but I've heard talk of adding that to the spec 😜
If you were to create a
Spack does not allow you to deactivate an extension without deactivating the extensions that rely on it. For example, if you activate
No way around that unfortunately. The same problem could theoretically happen with Python, although I haven't yet run into it. Honestly, this could happen with any software, not just extensions.
Most packages are like that. If they don't specify a version, I don't constrain it until I find one that breaks. If they do say it "must be at least X", you can add that to the dependency: extends('perl')
depends_on('perl-moose@1.2.3:', type=nolink)
And proper Python-based things are installed with pip. Or easy_install. Or Spack. Or any of a thousand other package managers. The difference is that you can control what version Spack installs, but that may be more difficult with perl tools that are outside of your control.
We can do that for you. If you don't want to make Perl extendable yourself, then I don't think that should hold up this PR. It's kind of a lot of work to setup the first time (see the monstrous Python package), but once it's working, it's a thing of beauty. And even if someone else implements Perl extensions, there's no reason that you have to use them. You can install Perl, cpanm, and any other perl packages that get added with Spack. If you don't activate those extensions, you'll just have to add them to your PERL5LIB path by hand. Of course, doing it this way doesn't prevent your users from matching incompatible libraries like you said. If you activate the extensions, then the Perl you distribute just comes with the right packages, without any user intervention required. |
I think Spack's best practice will change a bit when #1186 is merged, but as of right now, there are two accepted practices. Always run the test (I do this a lot if the test is quick and rarely fails) or use There is no way to make the test optional and default to True as of right now without using a variant. And we've all come to an agreement not to use variants for this purpose because it results in two different installations with the only difference being that tests were performed on one and not the other. I think once #1186 is merged, all tests will eventually get moved to their own special function and will only be activated when |
I don't think cpanm should even be included in this package. If it is a separate software package with a version, it deserves it's own package. It can depend on perl. |
Those aren't language things, they're toolchain things. Perl's tooling has been improving over the last 5 or so years (e.g. cpanm) and gaining that type of control. E.g. carton (aka Ruby's Bundler for Perl) and it's The language itself though, can only say things like this:
which constrains it to use version '2.1804' or newer. That might be '3.001', which includes a completely different API. This means that tools like A common solution seems to be to just produce a known good set of prereqs and specify them exactly. I gather (citation needed) that there are other languages that give you more control at the "import statement" level. Sadly, I don't work with them.... |
I'm up for digging into it too just want to move in small steps. |
For what it's worth (a bit of data to go with all of the words):
After years of apologizing for Perl to people who have tried to wire up a hairball, and being told that other languages (usually Python, these days often node.js) don't have these problems, this quote in the EasyBuild docs made me smile:
The left-pad incident shook a lot of people too. In the end, it's a hard problem and I am so thankful for tools like EasyBuild, Spack and {home,linux}brew (and their creators) for struggling with it |
Thanks for this:
Since tests can take a while, I'll use @everyone -- Is there a way to document something like this for a package. Best idea that I've come up with is to add prose to the package's description so that it shows up in |
Nah, I wouldn't worry about documenting it in the package. It's not like it only applies to that package, it applies to all Spack packages that feature tests. After #1186 is merged, all Autotools packages will have test suites via make check (whether or not it is in the package.py). Since --run-tests is in the Spack documentation, you're good to go. |
I disagree, as do e.g. the PerlBrew [the most commonly used perl installer] team:
(patchperl's not relevant if you're not supporting ancient Perls). This is not an uncommon technique for enabling loosely coupled perl installs. For what it's worth, there is already an older CPAN tool in the core, In my years of supporting Perl I've found life is way simpler if I include it alongside the core (and I say that as someone who has come to loathe coupled things). When I install it as a separate thing, people neglect to load it and use the There are other perl-based "stand-alone" tools, e.g. App::Ack and Pinto that can nicely stand on their own (they work hard to divorce themselves from the external world) but Would a compromise be to leave it an option but have the variant default to False? |
ps. Thank you all for the discussion! |
This commit changes the git package to depend_on('perl'). The system perl is not always sufficient to install git (e.g. a CentOS7 system with the development tools group installed has perl but not the ExtUtils::MakeMaker package that git needs) and one can't always update the system's perl. This PR depends_on PR spack#1339, which adds a perl package to spack.
Oh. My. God. That sounds awful. If this is a common thing, then it might be best not to make Perl extendable. Otherwise, you would have to add all 221 dependencies just to add that package. Probably best to take advantage of cpanm in that case. No sense in keeping track of our own set of dependencies and version constraints. |
Perl, the language I hate to love... |
I think that this is ready to be considered for merging.
Once this is merged I'll update my git PR (#1345), which depends on it. |
8694ad4
to
5f3f182
Compare
Rebased to the tip of develop |
Why, oh why, is the "close and comment" button bigger that the "comment" button. I did not mean to close that..... |
@hartzell Eheh, anyhow close and reopen is a useful trick to trigger a Travis rebuild if you don't have write permission upstream... |
I always just rebase and force push to trigger a Travis rebuild, but that works too. Looks much better now, thanks! |
This commit changes the git package to depend_on('perl'). The system perl is not always sufficient to install git (e.g. a CentOS7 system with the development tools group installed has perl but not the ExtUtils::MakeMaker package that git needs) and one can't always update the system's perl. This PR depends_on PR spack#1339, which adds a perl package to spack.
Add perl package, based on [work by justintoo](spack#105). He had too many things pulled into that pull request, this just adds a perl package. Support the current releases on the past three minor branches. Run perl's tests before installing. Install cpanm into the core (makes building on top of this perl *much* simpler). Controlled by a variant.
Rather than hard-coding the verison of `cpanm` that's [optionally] installed into the core, make it a variant with a default value of '1.7042'. Also discovered that `prefix + 'bin'` is the same as `prefix.bin`, so embetter that bit of code.
Make running perl's tests conditional, one must now specify the `--run-tests` flag to the `spack install` command in order to run the tests. On one system (8 core, 16GB Digital Ocean Droplet), installing without tests takes 3 minutes, with tests takes 16 minutes.
Stole the example header from antlr/package.py, included it at the top of perl/package.py.
Use the resource machinery to fetch/cache/unpack/... the App::cpanminus tarball. - this hardcodes the version, I can't figure out how to use a variant to hold/set the value and access it in the resource(). - change up the install to use the `with working_dir()` meme.
bac7af3
to
c994565
Compare
Now that you have the cpanm installer as a resource, please delete the hard-included installer from the PR. |
This is handled as a resource in the package now.
@becker33 -- done, thank you! |
There are also a few flake8 errors in the travis output now, please fix those. |
Did you accidentally add the cabal stuff? |
Yep. I'm going to sit down and have a talk with my intra-cranial QA personality. He's been slacking off this AM. Sorry for making you folks clean up after me. |
@becker33 -- flake 8 is clean for me. It might have been tripping up on the mistakenly committed cabal bits.
|
This commit changes the git package to depend_on('perl'). The system perl is not always sufficient to install git (e.g. a CentOS7 system with the development tools group installed has perl but not the ExtUtils::MakeMaker package that git needs) and one can't always update the system's perl. This PR depends_on PR spack#1339, which adds a perl package to spack.
This commit changes the git package to depend_on('perl'). The system perl is not always sufficient to install git (e.g. a CentOS7 system with the development tools group installed has perl but not the ExtUtils::MakeMaker package that git needs) and one can't always update the system's perl. This PR depends_on PR spack#1339, which adds a perl package to spack.
This commit changes the git package to depend_on('perl'). The system perl is not always sufficient to install git (e.g. a CentOS7 system with the development tools group installed has perl but not the ExtUtils::MakeMaker package that git needs) and one can't always update the system's perl. This PR depends_on PR spack#1339, which adds a perl package to spack.
This commit changes the git package to depend_on('perl'). The system perl is not always sufficient to install git (e.g. a CentOS7 system with the development tools group installed has perl but not the ExtUtils::MakeMaker package that git needs) and one can't always update the system's perl. This PR depends_on PR spack#1339, which adds a perl package to spack.
This commit changes the git package to depend_on('perl'). The system perl is not always sufficient to install git (e.g. a CentOS7 system with the development tools group installed has perl but not the ExtUtils::MakeMaker package that git needs) and one can't always update the system's perl. This PR depends_on PR spack#1339, which adds a perl package to spack.
* cuda: new versions 11.4.1, 11.4.2 and 11.5.0. * deploy: cuda: deploy 11.4.2, drop 10.1.243.
This needs feedback, see my questions below (thanks!)
Add perl package, based on work by justintoo. He had too many things lumped into his pull request, this just adds a perl package.
W.r.t. extentions: I need to understand Spack's extension mechanism and see if it makes sense for Perl.
This supports the current releases on the past three minor branches.
It runs perl's tests before installing.
It installs cpanm alongside the core (which makes building on top of this perl much simpler). Can be disabled via a variant.
Questions: