What's the best way for distributing zipped packages via export-pkg?
Conan: Conan 1.6.0
OS:
Linux version 4.15.0-29-generic (buildd@lcy01-amd64-024) (gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.10)) #31~16.04.1-Ubuntu SMP Wed Jul 18 08:54:04 UTC 2018 (Ubuntu 4.15.0-29.31~16.04.1-generic 4.15.18)
I'd like to use a 3rd party tool for generating packages in a so-called *.zpkg files. For that, i create the package (let's say, _a/0.1@asier/testing) and I use export-pkg with the followingpackage() in the conanfile.py
def package(self):
print("--- package()")
self.copy("*.zpkg")
self.copy("*.cfg")
Then, when installing, using conan install . in a package which requires the first one (let's say, _b/0.1@asier/testing with the following requirements)
[requires]
_a/0.1@asier/testing
Then, i'd expect to have the content of the zpkg via
def deploy(self):
print("--- deploy()")
for clib in glob.glob("*.clib"):
# lib/ and include/ will be deployed
unzip(clib)
Without needing to force the build since export-pkg should not install it (https://docs.conan.io/en/latest/reference/commands/creator/export-pkg.html). However, i realized that after exporting the package, Conan thinks that the package is installed
Requirements
_a/0.1@asier/testing from local cache - Cache
Packages
_a/0.1@asier/testing:597601ab50a5598dbec0df9a06662246b125fe08 - Cache
_a/0.1@asier/testing: Already installed!
and then the deploy() method is not called.
Hi @alacasta,
I am not sure I understood your use case regarding the distribution of zipped packages but there are some things that can help:
When you use conan export-packge you are just telling Conan to put the files form your user space to the cache and store them with a hash computed from the settings of your default profile (if not indicated otherwise). This means after files are copied to the cache, the package is installed.
Deploy method is only used if you are installing the package explicitly: conan install _a/0.1@asier/testing, not as dependency. It will not be called if the package is installed as a dependency. This is meant for deployable packages such as apps as documented here: https://docs.conan.io/en/latest/devtools/running_packages.html#deployable-packages
Packaging format in Conan is done copying header or compiled artifacts so it is able to distribute them later in the server. A custom zipfile will work for packaging something but consumers of the package will not be able to find the artifacts as they will not know how to unzip it. Moreover, package_info() will not be able to propagate the location of the lib dirs and include dirs...
Hope this helps
Thanks for your response.
I鈥檇 like to find a manner for distributing packages in some kind of zipped format so that people just download and uncompress them before installing and afterwards the package content is ready to be used.
I鈥檒l anyway rethink if this is the more convenient approach for me.
Thanks!
Glad you find the info useful. However I am kind of missing the point of having everything compressed by your 3rd party tool as Conan already compress packages when uploading to the server (check this example in conan-center: https://dl.bintray.com/conan-community/conan/conan/libalsa/1.1.5/stable/package/07cef9b814129a2635324999ac50e12ef3c560e8/)
If users want to download contents manually, they can go to de server and download the conan_package.tgz. However, the best way would be to not mess with manual compression/uncompression/installation and let Conan do the job!
Good point!!!
I didn鈥檛 realize that packages are already compressed... i will reformulate my solution though. 馃憤