conan-io / meta-conan

Yocto layer for the Conan project
23 stars 28 forks source link

Allow proxified network access during do_install #46

Closed Tarnyko closed 9 months ago

Tarnyko commented 9 months ago

Since 'conan install' wants to pull data from the network during the 'do_install' task, but Yocto does not preserve the PROXY environment variables during this step; building behind a proxy fails. Expose the variables.

CLAassistant commented 9 months ago

CLA assistant check
All committers have signed the CLA.

Tarnyko commented 9 months ago

Latest Yocto "dunfell" release provide Python 3.8 (and 3.6 for some time now) : https://github.com/yoctoproject/poky/blob/dunfell-23.0.28/meta/recipes-devtools/python/python3_3.8.17.bb

The proposed code uses the following features :

uilianries commented 9 months ago

@Tarnyko Thank you for your contribution! 🎉

Latest Yocto "dunfell" release provide Python 3.8 (and 3.6 for some time now)

Good, Conan 2.x uses Python 3.6, so it's totally compatible. This project is not Conan client, so it could use a newer version.

About your change, have you considered using the configuration file instead? Environment variable are messy, as they can collide with others with same name. It would be a similar change: https://docs.conan.io/1/reference/config_files/conan.conf.html#proxies

Need to populate the conan.conf file with the [proxies] entry.

Tarnyko commented 9 months ago

Hello @uilianries , and thanks a lot for your nice comment!

Good to know that it is fully compatible.

About the profile, I seem to remember I tried to put the variables in the dynamically-generated one ("meta-conan_deploy" in $WORKDIR) and it did not work. I did not try any other approach, though. I will do it tomorrow and let you know how it goes.

Tarnyko commented 9 months ago

Hi again @uilianries , it worked.

So in order to setup proxies this way, here is what one needs to do:

echo "[proxies]" >> conf/conan.conf
echo "http = $HTTP_PROXY" >> conf/conan.conf
echo "https = $HTTPS_PROXY" >> conf/conan.conf
echo "no_proxy_match = $NO_PROXY" >> conf/conan.conf

echo -e 'CONAN_CONFIG_URL = "${TOPDIR}"/conf/conan.conf' >> conf/local.conf

By the way, I notice the Conan Yocto wik does not mention it at all, although proxies are generally transparently-working in Yocto. Do you need it deserves a mention?

uilianries commented 9 months ago

@Tarnyko Thank you for your feedback! I'm glad that worked, indeed config files are much safer.

By the way, I notice the Conan Yocto wik does not mention it at all, although proxies are generally transparently-working in Yocto. Do you need it deserves a mention?

Yes, but we are about to start a support for Conan 2.x, so we will update docs.conan.io/2 in the future.