Add latest version of MPFR and patches for older versions#7545
Add latest version of MPFR and patches for older versions#7545adamjstewart merged 3 commits intospack:developfrom
Conversation
I don't have anything against this. We fetch it in some scenarios but also store them locally in Spack for other packages. |
|
Consistency (the dubious bugaboo) would suggest that having patch files stored with tarballs in a local mirror would not be too out of place. That said, checksum support of those files would also add some fun. As a complete non sequitur, I would like to have a spack function to populate my local mirror based upon the package definitions - source tarballs and patches too if that's the way this gets played. So, assuming your mirrors.yaml file is defined somewhere ... yeah, I know, "Go away kid, ya bother me" |
You mean like |
|
Almost. I already have a mirror that was established long ago. What I really need is a simple way to add things as package prerequisites change... Maybe a flag or something that tells spack to put a copy of anything it downloads into the local mirror... Right now, I tend to look through the build log for curl failures for those instances when the local mirror does not have the file required, then I use wget to fetch the same tarball spack retrieved, then compare md5sums. I guess I could take a look at the cache directory, as well, but, the build log tells me which tarball spack was looking for in the mirror and sometimes the filenames do not match what got downloaded. Especially so for packages like sqlite. |
You can checksum them, according to the directive signature: def patch(url_or_filename, level=1, when=None, working_dir=".", **kwargs):
"""Packages can declare patches to apply to source. You can
optionally provide a when spec to indicate that a particular
patch should only be applied when the package's spec meets
certain conditions (e.g. a particular version).
Args:
url_or_filename (str): url or filename of the patch
level (int): patch level (as in the patch shell command)
when (Spec): optional anonymous spec that specifies when to apply
the patch
working_dir (str): dir to change to before applying
Keyword Args:
sha256 (str): sha256 sum of the patch, used to verify the patch
(only required for URL patches)
archive_sha256 (str): sha256 sum of the *archive*, if the patch
is compressed (only required for compressed URL patches)
"""
.... |
@adamjstewart @peetsv $ spack mirror create -d <DIR> <specs>but given that when you add a mirror you name it, I'd like to be able to say also: $ spack mirror create -name <MIRROR_NAME> <specs> |
I know, but:
Do you think it would be worth fetching anyway? The package would break every time a bug fix came out. I don't want to deal with that many issues. |
|
I agree that we should fix patching order. But there are 5-10 individual patches per version of this package, so that may lead to clutter. |
|
Off the top of my head, I think it makes sense to store the cumulative patch if we are dealing with an old version for which it's not going to change anymore. If the version is recent enough to be maintained (and thus could be subject to further patching), probably we should apply individual patches. Does that seem sensible to you?
I think we have a similar problem with resources in |
|
@alalazo I was thinking something along the same lines. I just checked and it looks like they don't release patches for old releases after a new release comes out. So it should be safe to fetch and checksum patches for old releases. For the current release, we could either fetch individual patches or store cumulative patches. There are no patches for the current release so far, so we can dodge this question for now. I still vote we use cumulative patches wherever possible. Version 3.1.3 for example includes 17 individual patches. |
|
Well, that saves us from adding 8,000 lines of patches. Unfortunately (fortunately?) it has uncovered a much more severe bug: There are a couple of terrifying things to note here.
4 is a long-standing bug that I haven't really paid that much attention to, but we should probably fix it. 1 and 2 don't make any sense to me, but they remind me of #3129. I suspect that the same bug is causing both of these problems. |
| '3.1.2': '9f96a5c7cac1d6cd983ed9cf7d997074', | ||
| } | ||
|
|
||
| for version, checksum in patches.items(): |
There was a problem hiding this comment.
And here's the culprit! A for cycle here using the name "version" leaves a version attribute defined at class level, that overrides the version property in the base class. The last version you iterate on is 3.1.2, and the discrepancy between self.spec.versions[0] and self.version does the rest.
There was a problem hiding this comment.
Using:
for v, c in patches.items():
...should help avoiding troubles, as I am pretty sure we don't define those attributes in base classes (joy and pain of dynamic typing).
There was a problem hiding this comment.
In #7563 I ended up adding a double underscore to loop variables. Not sure what's the worst choice between very short names and names that starts with a double underscore. Should we set an informal style policy for the few packages that have logic at class level?
There was a problem hiding this comment.
How silly of me, fixed in the latest commit. I wonder if there's any way we can make this idiot proof.
There was a problem hiding this comment.
I wonder if there's any way we can make this idiot proof.
Maybe using a descriptor and intercepting the redefinition at class level. Not sure it's worth the effort though. Just refreshed the __set__ signature, and that's not possible. If we want to intercept rebinding at class level we probably need to add some logic in a metaclass - definitely too much for a bug like this 😄
👏 for remembering things like that more than one year later 😅 |
* Add latest version of MPFR and patches for older versions * Fetch and checksum patches instead of storing them * Fix bug, version attribute was being overridden
Fixes #7543. @peetsv
Adds the latest version of MPFR, which builds and passes all tests for me on macOS 10.13.3 with Clang 9.0.0.
The MPFR developers are some of the few people I've seen who actually release patches to fix bugs in older versions of software. They release these patches in two forms: individual patches and cumulative patches. I was using individual patches in #3506, but after #7193 was merged, the order in which patches are applied is no longer the order in which they are listed in the package, causing them to conflict (see #7543). This PR replaces the individual patches with cumulative patches and adds patches for older releases as well.
Note that some of these patches are fairly large. Spack does support fetching patches from the internet, but I don't think I'm comfortable fetching patches remotely without checksumming them. And since the cumulative patches are updated continuously as bugs are discovered, checksumming them would just lead to headaches.
Pinging @alalazo and @davydden who have had opinions on long patches in the past.