Re: [PATCH master] scripts: setlocalversion: sync with Linux

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Nov 09, 2023 at 12:38:35PM +0100, Ahmad Fatoum wrote:
> We are using an older version of setlocalversion that sources the
> config. This is wrong as there's no guarantee that it's ok to source the
> config, e.g.:
> 
>   CONFIG_DEFAULT_ENVIRONMENT_PATH="$(objtree)/.ptxdist-defaultenv"
> 
> when sourced will lead to:
> 
>   scripts/setlocalversion: 15: include/config/auto.conf: objtree: not found
> 
> Fix this by grepping the file instead.
> 
> Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx>
> ---
>  scripts/setlocalversion | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)

Applied, thanks

Sascha

> 
> diff --git a/scripts/setlocalversion b/scripts/setlocalversion
> index 6b54e46a0f12..cbd3883df9ae 100755
> --- a/scripts/setlocalversion
> +++ b/scripts/setlocalversion
> @@ -111,13 +111,14 @@ if $scm_only; then
>  	exit
>  fi
>  
> -if test -e include/config/auto.conf; then
> -	. include/config/auto.conf
> -else
> +if ! test -e include/config/auto.conf; then
>  	echo "Error: kernelrelease not valid - run 'make prepare' to update it" >&2
>  	exit 1
>  fi
>  
> +# version string from CONFIG_LOCALVERSION
> +config_localversion=$(sed -n 's/^CONFIG_LOCALVERSION=\(.*\)$/\1/p' include/config/auto.conf)
> +
>  # localversion* files in the build and source directory
>  res="$(collect_files localversion*)"
>  if test ! "$srctree" -ef .; then
> @@ -125,10 +126,10 @@ if test ! "$srctree" -ef .; then
>  fi
>  
>  # CONFIG_LOCALVERSION and LOCALVERSION (if set)
> -res="${res}${CONFIG_LOCALVERSION}${LOCALVERSION}"
> +res="${res}${config_localversion}${LOCALVERSION}"
>  
>  # scm version string if not at a tagged commit
> -if test "$CONFIG_LOCALVERSION_AUTO" = "y"; then
> +if grep -q "^CONFIG_LOCALVERSION_AUTO=y$" include/config/auto.conf; then
>  	# full scm version string
>  	res="$res$(scm_version)"
>  elif [ "${LOCALVERSION+set}" != "set" ]; then
> -- 
> 2.39.2
> 
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |




[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux