-
Notifications
You must be signed in to change notification settings - Fork 993
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
[question] Non-relocatable packages don't work in 2.0. Is this a supported use case? #13237
Comments
Relates to #11601 |
Looking into this a bit more, I'm not filled with a great deal of confidence that non-relocatable packages will be easily supported without modification to the source/new features to support it. The temporary path is defined here: conan/conan/internal/cache/cache.py Lines 56 to 60 in dc6eb51
Before being used here conan/conan/internal/cache/cache.py Lines 70 to 77 in dc6eb51
And then ultimately finds its way to be used here conan/conans/client/cmd/export.py Line 31 in dc6eb51
@memsharded is this something that you see could be supported going forward? This is a reasonably critical function for python virtualenvs, if they are to be installed into the cache. From memory this also applies to a number of gnu packages that embed their installation directory into the compiled binary, which isn't easily circumvented. Any other alternatives you might suggest would also be appreciated. |
From a UX perspective, perhaps this would be useful to define as a new Is it currently possible to have a tuple of package types? class Pkg(ConanFile):
settings = "os"
package_type = ["executable", "non-relocatable"] |
Thanks for your question:
The thing is that Conan packages must be relocatable by definition otherwise it is not possible to upload and download them in different machines, or even the same machine, different cache. For the case of custom relocation of things, the 2 recipes approach in #13169 would probably be the way to go. Were you aware of this? Regarding the |
Hi @memsharded, I apologize, but I don't think I understand your proposed solution. As an example:
As I understood it, this would not work, since I can see why you chose the new immutable package approach and do see it's benefits, but from my point of view this specific problem is not solvable with the way conan currently works (without resorting to undefined behavior, e.g. performing the relocation in the |
Thanks for the explanation @memsharded, that makes the reasoning behind the new method a bit clearer. To address some of your comments:
I'm not sure that this must be the case though. I think that there might be a perfectly valid use case where a package recipe is provided, but it always must be built from source on the machine it's going to be used on. This is not as desirable as being able to store/share prebuilt binaries, but in lieu of being able to do that, at least some things would be package-able.
Thanks for that - I wasn't aware of this. I'm not certain it solves my issue though. Perhaps I'll provide you with a concrete example of my use case, and you can point out what I might be missing. The immediate use case I have is essentially to support creation of a python virtual environment in the conan cache (the utility of which relates closely to #11601). Python virtual environments, unfortunately, are non-relocatable. The way this manifests is that, for example, if #!/home/user/.conan2/p/t/pytho3f5a78aab9a55/p/bin/python
# -*- coding: utf-8 -*-
import re
import sys
from sphinx.cmd.build import main
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(main()) Unfortunately, as you can see, the shebang line contains the temporary directory as this is where the virtualenv was created. When attempting to execute /home/user/.conan2/p/pytho78374f2951a04/p/bin/sphinx-build --help
zsh: /home/user/.conan2/p/pytho78374f2951a04/p/bin/sphinx-build: bad interpreter: /home/user/.conan2/p/t/pytho3f5a78aab9a55/p/bin/python: no such file or directory You can see this in action in this failed CI run for the conan 2 pipeline. Given the nature of the failure, it's seems unlikely to me that using a second package to copy the contents of the first package to a second package folder would resolve the issue. Even if this operation of moving the contents from It seems to me this would be the case since the whole problem here is that the final |
Thanks for the feedback @koeleck and @samuel-emrys Now I understand better what you mean, and this would certainly be complicated. It would have been great to have this discussion pre-2.0 launch in one of the alphas or betas, now it will be more challenging to address this, because the way this works in the Conan 2.0 cache is very structural and might need some important changes. I am marking this for investigation and discussion for 2.0.2 (just the investigation), and hopefully we will be able to provide better insights about this then. |
+1 (voting for this change, since yocto toolchains are not usable this way) |
New proposal in #13833, hopefully 2.0.5 |
Fixed in #13833, from Conan 2.0.5, packages built in the local cache will not be relocated to a different folder. Any package built locally, and that includes packages with |
What is your question?
Is there a way to force packages to be built directly into their final cache location in conan 2.0? I have a number of non-relocatable packages, and they have
~/.conan2/p/t/<id>
rather than~/.conan2/p/<id>
embedded into the files which makes everything non functional because the path witht
in it doesn't exist when it comes time to consume the packages.My assumption is that the
t
in the path here is shorthand fortemporary
. What would resolve my problem would be to be able to force all operations in thepackage(self)
method to operate on the~/.conan2/p/<id>
directory rather than~/.conan2/p/t/<id>
.Have you read the CONTRIBUTING guide?
The text was updated successfully, but these errors were encountered: