From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1RKiz2-0005y7-Jf for garchives@archives.gentoo.org; Mon, 31 Oct 2011 03:56:24 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 3875F21C035 for ; Mon, 31 Oct 2011 03:56:24 +0000 (UTC) Received: from mail.pnpitalia.it (85-18-21-122.ip.fastwebnet.it [85.18.21.122]) by robin.gentoo.org (8.13.5/8.13.5) with ESMTP id j939UGO6000471 for ; Mon, 3 Oct 2005 09:30:16 GMT Received: from localhost (localhost [127.0.0.1]) by mail.pnpitalia.it (Postfix) with ESMTP id B87FE7AD6F8 for ; Mon, 3 Oct 2005 11:38:19 +0200 (CEST) Received: from mail.pnpitalia.it ([127.0.0.1]) by localhost (db [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 23673-03 for ; Mon, 3 Oct 2005 11:38:19 +0200 (CEST) Received: from [192.168.4.153] (host-4-153.pnpitalia.it [192.168.4.153]) by mail.pnpitalia.it (Postfix) with ESMTP id 36E727AD6F6 for ; Mon, 3 Oct 2005 11:38:19 +0200 (CEST) Message-ID: <4340FC94.8090101@gentoo.org> Date: Mon, 03 Oct 2005 11:40:36 +0200 From: Francesco R User-Agent: Mozilla Thunderbird 1.0.6 (Windows/20050716) X-Accept-Language: en-us, en Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@gentoo.org Reply-to: gentoo-dev@lists.gentoo.org MIME-Version: 1.0 To: gentoo-dev@lists.gentoo.org Subject: Re: [gentoo-dev] lights on internals References: <43404C01.4070309@gentoo.org> <20051003064252.GE27872@nightcrawler> In-Reply-To: <20051003064252.GE27872@nightcrawler> X-Enigmail-Version: 0.92.1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: amavisd-new at db X-Archives-Salt: 141e634b-4e21-42de-a250-8b6412a811f0 X-Archives-Hash: ecffda49cfadedde01b4da7fcac46816 Brian Harring wrote: >On Sun, Oct 02, 2005 at 11:07:13PM +0200, Francesco R wrote: > > >>The ready to cut ebuild at the bottom print it's environment (variable >>and functions) to a bunch of files into /var/tmp/fakebuild/. >>May be useful for who want to have a look at "what" and "when" is >>avaible during the various emerge phases (but not limited to). >>print_env() { >> local fakebuild_output_dir="/var/tmp/fakebuild" >> mkdir -p "${fakebuild_output_dir}" || die >> >> [[ -z "${fakebuild_progr}" ]] && fakebuild_progr=100 >> fakebuild_progr=$(( $fakebuild_progr +1 )) >> export fakebuild_progr >> >> local fakebuild_ext="${1}.${fakebuild_progr}" >> >> # not sorting, break multiline vars >> einfo "${fakebuild_output_dir}/env_${fakebuild_ext}" >> env \ >> &> "${fakebuild_output_dir}/env_${fakebuild_ext}" >> >> # Remove egrep and sort to see the source of every fx >> einfo "${fakebuild_output_dir}/fxlist_${fakebuild_ext}" >> typeset \ >> | egrep '^\b.* \(\)' \ >> | sort \ >> &> "${fakebuild_output_dir}/fxlist_${fakebuild_ext}" >>} >> >> > >This won't work as you expect. Env is a binary, it only gets >the exported env. > > > Got the point (maybe), "typeset" is a Bash built-in. The first part of the "typeset" output command give the variable list *and* it's different from the output of "env" binary. The output is different in two ways, first the vars are differently formatted, missing apices " ' " for example. env also is missing all .bashrc defined vars (speaking of a normal environment not of a portage/emerge one). ==> the "env" command should be replaced by typeset &> tmpfile tmpfile | grep -B10000 "$(egrep "^\b.* \(\)" tmpfile | head -n 1)" | head -n '-1' (basically the output of typeset cutted at first function) >Elaborate on the "what and when" bit also, since the env that's dumped >to ebuild.sh varies depending on a lot of things. >~harring > > > The environment is changing between the various predefined functions and in the global scope of an ebuild, at the moment only for vars, not for functions. example of variable vars are: SANDBOX_* PORTAGE_RESTRICT TMP EBUILD_PHASE TMPDIR PWORKDIR DISTCC_DIR LD_PRELOAD All variables that must stay readonly, or not readed at all, inside an ebuild but may explain at the human that's writing one, what's happening and when. better ? -- gentoo-dev@gentoo.org mailing list