Add Licensed Software Support#558
Conversation
|
Now that I think about it, it might be useful to override |
|
I'm going to expand upon the original intent of this PR and provide more general support for software that requires a license. Here is what I propose: Some licensed software needs to be downloaded manually and added to a repository. I will let @xjrc handle this part of the process in #705. Once the download is in a mirror, things are pretty straightforward. The only thing that makes licensed software special is that a license needs to be setup. As part of this PR, I'm adding packages for the PGI and NAG compilers. These have fairly simple licenses that work in similar ways. Once we start dealing with more esoteric/complicated licenses, my design may need to change. But for now, I propose adding the following package attributes:
These would be the only attributes necessary in a package. The rest of the magic will happen in the install logic. If a package requires a license and has license_files set, the first file is used. It will create the file and print the following message template to it:
Obviously, the format of this file will change depending on whether or not If If you have any further suggestions or modifications, please let me know. Here is my progress on this task:
|
|
@tgamblin: Let me know what you think of my solution. The only thing I have left to do is add documentation. |
|
Great. PGI (FlexNet) uses Alternatively, I could replace that with a |
|
@lee218llnl: How do you feel about my proposed solution in regards to an Intel compiler package? I took a brief look at the Intel compiler installation instructions and you can use a configuration file to build the package silently. The only stumbling block will be, as you mentioned, the fact that there are various product suites. Do each of these suites have a different license or can we just install the most complete one by default? We certainly need better support for allowing multiple urls and checksums per version, since a lot of packages differ based on OS/arch/suite, but that could be saved for another day. If you think my design looks decent then I'm willing to get started on an Intel compiler package. |
|
I created a new issue #761 to track the packaging of Intel compilers. Feedback would be appreciated. |
|
@adamjstewart I have an initial implementation of the intel compiler package. What's the best way to test integration with your license file additions? Can you push your branch to the repo so I can check it out? |
|
Looking at the current implementation, I'm not sure if this completely handles the way we normally deal with licenses for the Intel compiler. We have a file in /usr/local/etc/license.client.intel.lic who's contents point to our license server. Usually when I install an Intel compiler, I point the installation script to this file (it needs a license to install). After the installation is done, I then create a symlink in the compiler's bin or license directory that points to the .lic file. The nice thing about doing it this way is that only that one file has to be edited if something changes in the license server configuration. Does this setup sound generally useful enough to implement in Spack for other sites and software? |
I don't believe I have permission to push it to the Spack repo. But you should be able to clone the branch from my repo and test it locally. Let me know if you don't have permission to do this.
My attempt with this PR was to provide a flexible method of allowing users to set up licenses. By printing a list of various files and environmental variables that the compiler looks at, I allow the user to decide the best method for them to setup licenses.
Now this could be a serious stumbling block. Is there really no way to install it and point it to the license later? If not, then yes, my current setup won't work. I can imagine that there is probably other licensed software that behaves this way as well. My license logic always goes after installation. I could change it so that the set_up_license function isn't called unless someone specifies it in a package's install function. That seems reasonable. Then you could call it at the begging of install. The problem will be that the installation directory won't exist until after installation, so you won't be able to use a relative file path unless the set_up_license function is called at the end.
I'm not sure if it's possible to automate the process that you are describing. I agree that the way you do things is easy, but I don't think it's compatible with Spack. I could add logic to allow license files to be specified outside of the installation directory, but then when I printed the license file, it would overwrite the original when you install again. I see several possible solutions:
How do you feel about these? Can you think of any better solutions? |
|
If passed license information via silent.cfg at install time the Intel installer will install a license file in the |
|
@adamjstewart perhaps Spack can have a license directory that each user/site can populate with their own licences. Packages that require licenses could then look in there and create the appropriate copies or symlinks. This could also be a configuration file that points to other existing licenses on the system. |
|
@lee218llnl: I love it! To avoid naming confusion, how about this. If I'll implement these changes on Monday if they sound good to you. Let me know if you have any suggestions for where to put this Spack license directory. I'm thinking |
|
@lee218llnl: When I try moving the call to set_up_license from build_process to each package's install method, I run into the same problem I was having before. Opening the file with spack.editor causes Spack to hang without displaying the editor. I think it's because the output of install is being suppressed. Do you have any suggestions for a workaround? I guess I could always call set_up_license before install, but I'll have to create any directories that don't exist before writing the license symlink. Or just write the global license before install and add the symlink after install. Alternatively, I could add a flag that decides whether to run set_up_license before or after install, but I feel like that's a messy solution. |
merge of spack#558 licennsed sw
|
@adamjstewart sorry for the delayed response, I was busy packaging up the Intel compilers in yet another packaging system that we have to deal with here (I'll leave my rant at that and spare you the details). Anyway, I think your naming and symlink ideas sound good to me. Regarding the editor, I think @tgamblin knows the ins and outs of Spack better and can find you a solution. For me, though, I don't imagine hand typing a license when installing things on Spack, so I don't have a strong desire for this. |
|
@lee218llnl: Nice timing. I'm actually pretty much done with the changes. Give me 10 minutes for testing and I'll commit them. |
|
Ok, I think I've implemented everything as mentioned. It now creates a global license file, then installs the package, and then creates a local symlink that points to the global license. @lee218llnl: For your Intel package, when you need to tell it where your license can be found during installation, you should be able to use: Package.global_license_file()Let me know if you catch any bugs. It works for me for NAG. It doesn't delete the global license if you uninstall the package, but it allows you to use the same global license for multiple versions of a package without overwriting it if it already exists. |
| self.license_vars = [] | ||
|
|
||
| if not hasattr(self, 'license_url'): | ||
| self.license_url = None |
There was a problem hiding this comment.
Hi, just a style question : why are you conditionally setting attributes on Package? Wouldn't just setting them work?
There was a problem hiding this comment.
I was just following what was already there. But I was pretty sure the if-statement part wasn't necessary because it would never have that attribute upon initialization and would always get overwritten later. I'll remove the if-statements for these and the list_url/list_depth so that they always get set.
There was a problem hiding this comment.
@alalazo: I tried removing these if-statements and always setting them, but I think it overwrote the package specific settings. Looks like they are important after all.
There was a problem hiding this comment.
@adamjstewart I wonder in which way (the spec-package mechanics are still somewhat obscure to me...). I guess I'll need to go through the code with a debugger to get a better grasp 😄
There was a problem hiding this comment.
Spack could probably do a better job with instance vs. class attributes in Package. Basically spack.repo.get('<pkgname>') is what Spack typically uses to get an instance just for package-level metadata. The Package constructor above just does a few sanity checks to make sure subclasses set the right variables. We could probably clean this up a bit.
|
Added a couple of Allinea packages. Works perfectly with my current setup. |
2be0cab to
bc085fa
Compare
|
@tgamblin: I moved everything except |
|
The only consequence that I've noticed so far is that now Spack counts the time it takes for the user to look up and add their license as part of the build time. But that's probably not that important. |
cf281a8 to
358ddb2
Compare
b6e2bfd to
5879f82
Compare
|
@tgamblin: Not sure how to add coverage for this one, but flake8 is happy and everything should be working as I would expect. |
|
@lee218llnl: does this look good to you? |
|
@tgamblin @adamjstewart This looks like it will satisfy my needs for the Intel compilers and tools. |
|
Merged! |
scotch: remove oneapi conflict
With this package, users will be able to install and use PGI compilers with ease. They will still have to download the file manually since you need to create an account and login. But the build is automated, and Spack walks you through the license setup. Spack can locate the package in two ways: it will find the file if it is in the user's current directory and it will find it if it is in a mirror.
See #553 for a previous conversation regarding the installation of licensed software.
Remaining potential problems to tackle:
Currently the installation hangs atspack.editor(license_path). It installs the software properly and writes to license.dat, but doesn't open an editor likespack createdoes. Guess that's what I get for trying to be fancy. Also,tty.msg()prints tospack-build.out. Is there a way to get it to print to STDOUT?pgilinux-2016-163-x86_64.tar.gz. I think it's safe to require users to rename this file topgi-16.3.tar.gz, but they will have to install with--no-checksumunless we can find a way to add a list of checksums for a single version.pgcc -V, it gets 16.3-0. I believe PGI numbers updates with the dash number. Should we add this to the version I used? Should we remove this from Spack's PGI version regex?+networkvariant to be enabled on Linux by default. But network installations don't work on OS X. The+singlevariant should be enabled by default on Darwin instead.