From: "'Jan Kiszka' via isar-users" <isar-users@googlegroups.com>
To: Tobias Schaffner <tobias.schaffner@siemens.com>,
isar-users@googlegroups.com
Subject: Re: [PATCH] meta: Do not warn on usage of env vars exported to bb fetcher
Date: Tue, 3 Sep 2024 15:33:54 +0200 [thread overview]
Message-ID: <ee4e04fe-4054-41c2-81df-a6bf8368f2d5@siemens.com> (raw)
In-Reply-To: <20240903132705.3404585-1-tobias.schaffner@siemens.com>
On 03.09.24 15:27, Tobias Schaffner wrote:
> Only a few of the variables allowed to be exported to the bitbake
> fetcher, are ignored when warning about env exports in the
> dpkg.bbclass.
>
> Move the list of exported variables to the bitbake.conf and reference
> these variables for ignores instead of maintaining an additional one.
>
> Signed-off-by: Tobias Schaffner <tobias.schaffner@siemens.com>
> ---
> bitbake/lib/bb/fetch2/__init__.py | 36 ++-----------------------------
You can't change bitbake, that's an unmodified import. And I suppose we
also cannot easily convince upstream to take such a modification.
If you can't include that file, we need to carry a copy of the variable,
I'm afraid.
Jan
> meta/classes/dpkg.bbclass | 15 +++++--------
> meta/conf/bitbake.conf | 20 +++++++++++++++++
> 3 files changed, 27 insertions(+), 44 deletions(-)
>
> diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py
> index 5bf2c4b8..ce16250b 100644
> --- a/bitbake/lib/bb/fetch2/__init__.py
> +++ b/bitbake/lib/bb/fetch2/__init__.py
> @@ -848,42 +848,10 @@ def localpath(url, d):
> fetcher = bb.fetch2.Fetch([url], d)
> return fetcher.localpath(url)
>
> -# Need to export PATH as binary could be in metadata paths
> -# rather than host provided
> -# Also include some other variables.
> -FETCH_EXPORT_VARS = ['HOME', 'PATH',
> - 'HTTP_PROXY', 'http_proxy',
> - 'HTTPS_PROXY', 'https_proxy',
> - 'FTP_PROXY', 'ftp_proxy',
> - 'FTPS_PROXY', 'ftps_proxy',
> - 'NO_PROXY', 'no_proxy',
> - 'ALL_PROXY', 'all_proxy',
> - 'GIT_PROXY_COMMAND',
> - 'GIT_SSH',
> - 'GIT_SSH_COMMAND',
> - 'GIT_SSL_CAINFO',
> - 'GIT_SMART_HTTP',
> - 'SSH_AUTH_SOCK', 'SSH_AGENT_PID',
> - 'SOCKS5_USER', 'SOCKS5_PASSWD',
> - 'DBUS_SESSION_BUS_ADDRESS',
> - 'P4CONFIG',
> - 'SSL_CERT_FILE',
> - 'NODE_EXTRA_CA_CERTS',
> - 'AWS_PROFILE',
> - 'AWS_ACCESS_KEY_ID',
> - 'AWS_SECRET_ACCESS_KEY',
> - 'AWS_ROLE_ARN',
> - 'AWS_WEB_IDENTITY_TOKEN_FILE',
> - 'AWS_DEFAULT_REGION',
> - 'AWS_SESSION_TOKEN',
> - 'GIT_CACHE_PATH',
> - 'REMOTE_CONTAINERS_IPC',
> - 'SSL_CERT_DIR']
> -
> def get_fetcher_environment(d):
> newenv = {}
> origenv = d.getVar("BB_ORIGENV")
> - for name in bb.fetch2.FETCH_EXPORT_VARS:
> + for name in d.getVar("BB_FETCH_EXPORT_VARS").split():
> value = d.getVar(name)
> if not value and origenv:
> value = origenv.getVar(name)
> @@ -899,7 +867,7 @@ def runfetchcmd(cmd, d, quiet=False, cleanup=None, log=None, workdir=None):
> Optionally remove the files/directories listed in cleanup upon failure
> """
>
> - exportvars = FETCH_EXPORT_VARS
> + exportvars = d.getVar("BB_FETCH_EXPORT_VARS").split()
>
> if not cleanup:
> cleanup = []
> diff --git a/meta/classes/dpkg.bbclass b/meta/classes/dpkg.bbclass
> index bcc3f828..094acb4f 100644
> --- a/meta/classes/dpkg.bbclass
> +++ b/meta/classes/dpkg.bbclass
> @@ -57,7 +57,7 @@ dpkg_runbuild() {
> value=$(echo "${line}" | cut -d '=' -f2-)
> sbuild_export $var "$value"
>
> - # Don't warn some variables
> + # Don't warn dpkg specific environment variables
> [ "${var}" = "PARALLEL_MAKE" ] && continue
> [ "${var}" = "CCACHE_DIR" ] && continue
> [ "${var}" = "CCACHE_DEBUGDIR" ] && continue
> @@ -66,15 +66,10 @@ dpkg_runbuild() {
> [ "${var}" = "PATH_PREPEND" ] && continue
> [ "${var}" = "DEB_BUILD_OPTIONS" ] && continue
>
> - [ "${var}" = "http_proxy" ] && continue
> - [ "${var}" = "HTTP_PROXY" ] && continue
> - [ "${var}" = "https_proxy" ] && continue
> - [ "${var}" = "HTTPS_PROXY" ] && continue
> - [ "${var}" = "ftp_proxy" ] && continue
> - [ "${var}" = "FTP_PROXY" ] && continue
> - [ "${var}" = "no_proxy" ] && continue
> - [ "${var}" = "NO_PROXY" ] && continue
> - [ "${var}" = "GIT_PROXY_COMMAND" ] && continue
> + # Don't warn environment variables exported to the bitbake fetcher
> + case " ${BB_FETCH_EXPORT_VARS} " in
> + *" ${var} "*) continue;;
> + esac
>
> bbwarn "Export of '${line}' detected, please migrate to templates"
> done
> diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
> index cda98035..82486248 100644
> --- a/meta/conf/bitbake.conf
> +++ b/meta/conf/bitbake.conf
> @@ -100,6 +100,26 @@ THIRD_PARTY_APT_KEYRING = "/etc/apt/trusted.gpg.d/third_party.gpg"
> REPO_BASE_DIR = "${DEPLOY_DIR}/base-apt/${DISTRO}/apt"
> REPO_BASE_DB_DIR = "${DEPLOY_DIR}/base-apt/${DISTRO}/db"
>
> +# Environment variables exported to the bitbake fetcher.
> +# Export PATH as binary could be in metadata paths rather than host provided.
> +BB_FETCH_EXPORT_VARS = "HOME PATH \
> + HTTP_PROXY http_proxy \
> + HTTPS_PROXY https_proxy \
> + FTP_PROXY ftp_proxy \
> + FTPS_PROXY ftps_proxy \
> + NO_PROXY no_proxy \
> + ALL_PROXY all_proxy \
> + GIT_PROXY_COMMAND GIT_SSH GIT_SSH_COMMAND GIT_SSL_CAINFO GIT_SMART_HTTP GIT_CACHE_PATH \
> + SSH_AUTH_SOCKSSH_AGENT_PID \
> + SOCKS5_USERSOCKS5_PASSWD \
> + DBUS_SESSION_BUS_ADDRESS \
> + P4CONFIG \
> + SSL_CERT_FILE SSL_CERT_DIR \
> + NODE_EXTRA_CA_CERTS \
> + AWS_PROFILE AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_ROLE_ARN \
> + AWS_WEB_IDENTITY_TOKEN_FILE AWS_DEFAULT_REGION AWS_SESSION_TOKEN \
> + REMOTE_CONTAINERS_IPC"
> +
> # Setup our default hash policy
> BB_SIGNATURE_HANDLER ?= "OEBasicHash"
> BB_HASHEXCLUDE_ISAR ?= "CCACHE_DEBUG LAYERDIR_core SCRIPTSDIR TOPDIR ISAR_BUILD_UUID"
--
Siemens AG, Technology
Linux Expert Center
--
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/isar-users/ee4e04fe-4054-41c2-81df-a6bf8368f2d5%40siemens.com.
prev parent reply other threads:[~2024-09-03 13:34 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-03 13:27 'Tobias Schaffner' via isar-users
2024-09-03 13:33 ` 'Jan Kiszka' via isar-users [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ee4e04fe-4054-41c2-81df-a6bf8368f2d5@siemens.com \
--to=isar-users@googlegroups.com \
--cc=jan.kiszka@siemens.com \
--cc=tobias.schaffner@siemens.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox