[v2] meta: Do not warn on usage of env vars exported to bb fetcher

Message ID 20240903184512.3684421-1-tobias.schaffner@siemens.com
State Accepted, archived
Headers show
Series [v2] meta: Do not warn on usage of env vars exported to bb fetcher | expand

Commit Message

Tobias Schaffner Sept. 3, 2024, 6:45 p.m. UTC
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.

Reference the list in bitbakes fetcher2 module instead of maintaining
a additional incomplete list.

Signed-off-by: Tobias Schaffner <tobias.schaffner@siemens.com>
---
 meta/classes/dpkg.bbclass | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

Comments

Jan Kiszka Sept. 3, 2024, 7:51 p.m. UTC | #1
On 03.09.24 20:45, 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.
> 
> Reference the list in bitbakes fetcher2 module instead of maintaining
> a additional incomplete list.
> 
> Signed-off-by: Tobias Schaffner <tobias.schaffner@siemens.com>
> ---
>  meta/classes/dpkg.bbclass | 15 +++++----------
>  1 file changed, 5 insertions(+), 10 deletions(-)
> 
> diff --git a/meta/classes/dpkg.bbclass b/meta/classes/dpkg.bbclass
> index bcc3f828..7eba7521 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 " ${@" ".join(bb.fetch2.FETCH_EXPORT_VARS)} " in
> +            *" ${var} "*) continue;;
> +        esac
>  
>          bbwarn "Export of '${line}' detected, please migrate to templates"
>      done

Much nicer!

Now bonus (if you like, on top) for appending the other vars that are
not part of FETCH_EXPORT_VARS to that list and reusing the shorter patch
statement for them as well. :)

Jan
Uladzimir Bely Sept. 9, 2024, 2:37 p.m. UTC | #2
On Tue, 2024-09-03 at 20:45 +0200, 'Tobias Schaffner' via isar-users
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.
> 
> Reference the list in bitbakes fetcher2 module instead of maintaining
> a additional incomplete list.
> 
> Signed-off-by: Tobias Schaffner <tobias.schaffner@siemens.com>
> ---
>  meta/classes/dpkg.bbclass | 15 +++++----------
>  1 file changed, 5 insertions(+), 10 deletions(-)
> 
> diff --git a/meta/classes/dpkg.bbclass b/meta/classes/dpkg.bbclass
> index bcc3f828..7eba7521 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 " ${@" ".join(bb.fetch2.FETCH_EXPORT_VARS)} " in
> +            *" ${var} "*) continue;;
> +        esac
>  
>          bbwarn "Export of '${line}' detected, please migrate to
> templates"
>      done
> -- 
> 2.40.1
> 

Applied to next, thanks.

Patch

diff --git a/meta/classes/dpkg.bbclass b/meta/classes/dpkg.bbclass
index bcc3f828..7eba7521 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 " ${@" ".join(bb.fetch2.FETCH_EXPORT_VARS)} " in
+            *" ${var} "*) continue;;
+        esac
 
         bbwarn "Export of '${line}' detected, please migrate to templates"
     done