Return-Path: Received: from mail-io0-f194.google.com (mail-io0-f194.google.com [209.85.223.194]) by mail.openembedded.org (Postfix) with ESMTP id 017AE60603 for ; Mon, 4 Jun 2018 18:20:40 +0000 (UTC) Received: by mail-io0-f194.google.com with SMTP id g7-v6so70718ioh.11 for ; Mon, 04 Jun 2018 11:20:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:message-id:subject:to:cc:date:in-reply-to:references :mime-version:content-transfer-encoding; bh=HNUPjSMaRCdMHIMgk/kc0PXLuO+kRIXv4Fmphk02B2k=; b=QhTHhtXnQchCVuEMsKDXSWd8F7CNQnYyvwvcuNpNmptjLJvoGkdKDzwF2+W0g1Z3BZ SlNtStYaxBUITiNxFJh2eufWSOM/rRNcPoKMBZbB9TvqrEOeiN2SOhGv+de0NgS9waNH cSqgfesHTmFnBuWGKJtwC0gvV3sa25LK4mRvFWEJ9Sy9TepDE4ZSYfSsuNpHUQUxufGc hBI5hu/bm1eApBS5zKpLXBUNGFwMl+s+IHlWe5a2D+4yPSFeZWbFnlgtEtINj9BDDR15 pu/Yxwd3nkn9PMfv2KIrlTL+0Ghc8eOPO1NbCIG2YU6FNhmYS2AaWLczpcyVGWOD2gxX feJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:subject:to:cc:date:in-reply-to :references:mime-version:content-transfer-encoding; bh=HNUPjSMaRCdMHIMgk/kc0PXLuO+kRIXv4Fmphk02B2k=; b=Db+OWT/Tla2wgQrG5HIeL9jzPy2bsM6TsenGGA3wWSvdhpb8R/wQzjxQdpiNtuoJvL BawPbib2eGphxiZR+nSy8xRUEKLCgmgsB6L744ahGF54MeKAhtRjv3zOU6+OFozoo30R V9bH0DPL1ZNekSn5NGCY6jW8zEx2hzW09D3qaBmKye+nw0oNYTGEL6yaU6gggOCX8G5f nrmeVVc17yxJmkF9+TdwP5Eaqmm3d895OlnuxsBpDM8l4UN5E0uG818gpBIzulZG5ZjE 5jZDz1FeOYFOrzos3UVp1YoZPWSxHaUx2+fzCFW46xBdSP2CpV7NCu1bZoGEWzdI5Cfr S6bA== X-Gm-Message-State: APt69E3xBU87wbtHs73S1vRuj7z2raPZnvf7GPGLja3vKx+sU1/2jg1X To7W68MXxZCXYhX2bYu5yZQ= X-Google-Smtp-Source: ADUXVKJjSM8uaocxihJ4EE0DtlrV7PT4tym4f2v5BCQ0I2zRIfMQ1FSR2ru6/Mcrq96b7FjN/HMWlg== X-Received: by 2002:a6b:6401:: with SMTP id t1-v6mr419276iog.114.1528136441940; Mon, 04 Jun 2018 11:20:41 -0700 (PDT) Received: from ola-842mrw1.ad.garmin.com ([204.77.163.55]) by smtp.googlemail.com with ESMTPSA id r6-v6sm4681874iog.16.2018.06.04.11.20.41 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 04 Jun 2018 11:20:41 -0700 (PDT) From: Joshua Watt X-Google-Original-From: Joshua Watt Message-ID: To: Martin Kelly , openembedded-core@lists.openembedded.org Date: Mon, 04 Jun 2018 13:20:40 -0500 In-Reply-To: <0994b61a-1465-e227-81ff-6ef60e055656@xevo.com> References: <20180601210240.14969-1-mkelly@xevo.com> <20180601210240.14969-6-mkelly@xevo.com> <1fa5f19ad4ac398de0dc6da40c46ead935133dbe.camel@gmail.com> <5c2bc7c4-6a79-2775-af6a-30fb6d693296@xevo.com> <79a9b2f1db65d8cc4233f93b7b5213d025a6d262.camel@gmail.com> <0994b61a-1465-e227-81ff-6ef60e055656@xevo.com> X-Mailer: Evolution 3.28.2 (3.28.2-1.fc28) Mime-Version: 1.0 Subject: Re: [PATCH v2 5/7] toolchain-shar-extract: pass env to post-relocate X-BeenThere: openembedded-core@lists.openembedded.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Patches and discussions about the oe-core layer List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 04 Jun 2018 18:20:41 -0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit On Mon, 2018-06-04 at 11:10 -0700, Martin Kelly wrote: > On 06/04/2018 10:20 AM, Joshua Watt wrote: > > On Fri, 2018-06-01 at 15:24 -0700, Martin Kelly wrote: > > > On 06/01/2018 03:08 PM, Joshua Watt wrote: > > > > On Fri, 2018-06-01 at 14:02 -0700, Martin Kelly wrote: > > > > > It's useful for the post-relocate scripts to be able to see > > > > > the > > > > > SDK > > > > > environment, for example to see the values of CC, CXX etc. in > > > > > order > > > > > to > > > > > dynamically generate toolchain files. > > > > > > > > > > To enable this, source the SDK environment script prior to > > > > > calling > > > > > the > > > > > relocate scripts. > > > > > > > > > > Signed-off-by: Martin Kelly > > > > > --- > > > > > meta/classes/toolchain-scripts.bbclass | 17 > > > > > +++++++++++++ > > > > > ---- > > > > > meta/recipes-core/meta/meta-environment.bb | 5 +++-- > > > > > 2 files changed, 16 insertions(+), 6 deletions(-) > > > > > > > > > > diff --git a/meta/classes/toolchain-scripts.bbclass > > > > > b/meta/classes/toolchain-scripts.bbclass > > > > > index ae7bbef034..5f99fd8c03 100644 > > > > > --- a/meta/classes/toolchain-scripts.bbclass > > > > > +++ b/meta/classes/toolchain-scripts.bbclass > > > > > @@ -118,11 +118,20 @@ EOF > > > > > } > > > > > > > > > > toolchain_create_post_relocate_script() { > > > > > - script=$1 > > > > > - rm -f $script > > > > > - touch $script > > > > > + relocate_script=$1 > > > > > + sdk_script=$2 > > > > > + rm -f $relocate_script > > > > > + touch $relocate_script > > > > > + > > > > > + cat >> $relocate_script < > > > > +# Source the SDK env script in case it is needed for the > > > > > relocate > > > > > scripts. > > > > > +. $sdk_script > > > > > > > > I had originally done something similar to this when I added > > > > support > > > > for the post-relocate scripts with icecream. However, it is > > > > insufficent > > > > because there can be multiple SDK environment scripts that need > > > > to > > > > be > > > > sourced. In order to get a fully correct environment, I had to > > > > do: > > > > > > > > # Setup environment > > > > for env_setup_script in `ls $1/environment-setup-*`; do > > > > . $env_setup_script > > > > done > > > > > > > > see meta/recipes-devtools/icecc-toolchain/icecc- > > > > toolchain/icecc- > > > > setup.sh > > > > > > > > > > > > > > There's one overall "SDK environment" script (the one you source > > > as > > > a > > > user to enter the SDK environment), and also customizable ones > > > installed > > > by nativesdk-* packages (e.g. one that cmake uses). In this > > > patch, I > > > had > > > not intended that post-relocate scripts should be able to see the > > > environment scripts for every project but instead just for the > > > global > > > SDK enivorment (to get at variables like OECORE_NATIVE_SYSROOT). > > > > (Almost) All of the code I can find that deals with the SDK > > environment > > supports multiple top level environment-setup-* files. If you > > happen to > > have more than one, the relocation script will relocate all of them > > (meta/files/toolchain-shar-relocate.sh), and the extraction script > > will > > give you instructions to source them all (meta/files/toolchain- > > shar- > > extract.sh). > > > > It's possible this is some left over anachronism and it has no > > actual > > use, but we should either fix it everywhere else or be consistent > > here. > > > > OK, that's good to know. > > > > > > > Let me know if I have missed something and not including the > > > other > > > environments could cause breakage. > > > > > > Here's what I mean from an example extracted SDK: > > > > > > martin@columbia:~$ ls /opt/xos/nanopi-neo-plus2/*environment* > > > /opt/xos/nanopi-neo-plus2/environment-setup-aarch64-poky-linux > > > > > > martin@columbia:~$ ls > > > /opt/xos/nanopi-neo-plus2/sysroots/x86_64-xevo-linux/environment- > > > setup.d/ > > > cmake.sh > > > > > > In the above example, we are currently sourcing only > > > /opt/xos/nanopi-neo-plus2/environment-setup-aarch64-poky-linux > > > and > > > not > > > cmake.sh. > > > > Sort of.... environment-setup-aarch64-poky-linux is going to > > implicitly > > source the cmake.sh script (see the for loop at the end of the > > script) > > > > Yes, I see that now. Given that the top-level environment-setup > script > implicitly sources the individual project sh scripts, isn't it > correct > to source only the top-level one? In that way, if the path to the > individual sh scripts changes, this code won't break, and it leaves > the > top-level script to the single source of truth with regard to > environment setup scripts. Yes I agree. I think there was some miscommunication, I wasn't suggesting that we should be sourcing those manually. I just wanted to handle the top level environment-setup-* scripts in a consistent manner to the rest of the code (i.e. make sure we source all of them).