Previously sanity checker required all uri listed in CONNECTIVITY_CHECK_URIS to be available for networking check. It caused selftests failures due to temprorary example.com unavailability. Add CONNECTIVITY_CHECK_ALL variable to change this behaviour and check for any host from the list to be available it allows to specify "failover" uri and/or speed checker up if few uris have been specified.
Default value is set to "1" for backward compatibility. Signed-off-by: Pavel Zhukov <[email protected]> --- meta/classes/sanity.bbclass | 44 ++++++++++++------- .../distro/include/default-distrovars.inc | 5 ++- 2 files changed, 32 insertions(+), 17 deletions(-) diff --git a/meta/classes/sanity.bbclass b/meta/classes/sanity.bbclass index f288b4c84c..695776bba3 100644 --- a/meta/classes/sanity.bbclass +++ b/meta/classes/sanity.bbclass @@ -326,6 +326,7 @@ def check_connectivity(d): # using the same syntax as for SRC_URI. If the variable is not set # the check is skipped test_uris = (d.getVar('CONNECTIVITY_CHECK_URIS') or "").split() + check_all = (d.getVar('CONNECTIVITY_CHECK_ALL') or "1") == "1" retval = "" bbn = d.getVar('BB_NO_NETWORK') @@ -341,22 +342,33 @@ def check_connectivity(d): data = bb.data.createCopy(d) data.delVar('PREMIRRORS') data.delVar('MIRRORS') - try: - fetcher = bb.fetch2.Fetch(test_uris, data) - fetcher.checkstatus() - except Exception as err: - # Allow the message to be configured so that users can be - # pointed to a support mechanism. - msg = data.getVar('CONNECTIVITY_CHECK_MSG') or "" - if len(msg) == 0: - msg = "%s.\n" % err - msg += " Please ensure your host's network is configured correctly.\n" - msg += " If your ISP or network is blocking the above URL,\n" - msg += " try with another domain name, for example by setting:\n" - msg += " CONNECTIVITY_CHECK_URIS = \"https://www.yoctoproject.org/\"" - msg += " You could also set BB_NO_NETWORK = \"1\" to disable network\n" - msg += " access if all required sources are on local disk.\n" - retval = msg + err = None + for uri in test_uris: + try: + if check_all: + fetcher = bb.fetch2.Fetch(test_uris, data) + else: + fetcher = bb.fetch2.Fetch([uri], data) + fetcher.checkstatus() + return retval + except Exception as e: + err = "{} \n {}".format(err, e) + if check_all: + break + + + # Allow the message to be configured so that users can be + # pointed to a support mechanism. + msg = data.getVar('CONNECTIVITY_CHECK_MSG') or "" + if len(msg) == 0: + msg = "%s.\n" % err + msg += " Please ensure your host's network is configured correctly.\n" + msg += " If your ISP or network is blocking the above URL,\n" + msg += " try with another domain name, for example by setting:\n" + msg += " CONNECTIVITY_CHECK_URIS = \"https://www.yoctoproject.org/\"" + msg += " You could also set BB_NO_NETWORK = \"1\" to disable network\n" + msg += " access if all required sources are on local disk.\n" + retval = msg return retval diff --git a/meta/conf/distro/include/default-distrovars.inc b/meta/conf/distro/include/default-distrovars.inc index fb0f1097da..867d694146 100644 --- a/meta/conf/distro/include/default-distrovars.inc +++ b/meta/conf/distro/include/default-distrovars.inc @@ -54,4 +54,7 @@ KERNEL_IMAGETYPES ??= "${KERNEL_IMAGETYPE}" # fetch from the network (and warn you if not). To disable the test set # the variable to be empty. # Git example url: git://git.yoctoproject.org/yocto-firewall-test;protocol=git;rev=master;branch=master -CONNECTIVITY_CHECK_URIS ?= "https://www.example.com/" +CONNECTIVITY_CHECK_URIS ?= "https://www.example.com/ https://www.yoctoproject.org" +# Define is all CONNECTIVITY_CHECK_URIS are required to be available or it's enough to have some +# of them reachable for networking check +CONNECTIVITY_CHECK_ALL ?= "0" -- 2.34.1
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#161637): https://lists.openembedded.org/g/openembedded-core/message/161637 Mute This Topic: https://lists.openembedded.org/mt/89066994/21656 Group Owner: [email protected] Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
