mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
* [ptxdist] [PATCH] ptxdist: check vendor for ct-ng toolchain
@ 2014-02-20 13:28 Andreas Bießmann
  2014-03-16 16:07 ` Andreas Bießmann
  2014-04-20  7:48 ` [ptxdist] [PATCH v2] " Andreas Bießmann
  0 siblings, 2 replies; 7+ messages in thread
From: Andreas Bießmann @ 2014-02-20 13:28 UTC (permalink / raw)
  To: PTXdist ML; +Cc: Andreas Bießmann

Before the toolchain vendor check was dedicated to OSELAS.Toolchain.
This patch introduces this feature to a toolchain built with ct-ng.

Signed-off-by: Andreas Bießmann <andreas@biessmann.de>

---
I know that Pengutronix develops and distributes OSELAS.Toolchain. I switched
however for some targets to the ct-ng toolchain and found the really useful
feature of toolchain versioning broken when using that other toolchain. This
patch is hopefully even so accepted ;)

 bin/ptxdist |   26 +++++++++++++++++++-------
 1 file changed, 19 insertions(+), 7 deletions(-)

diff --git a/bin/ptxdist b/bin/ptxdist
index 663c41e..67fa28d 100755
--- a/bin/ptxdist
+++ b/bin/ptxdist
@@ -608,11 +608,18 @@ check_compiler() {
 	# 3) Correct compiler version if a specific compiler version is given
 	#
 
+	local compiler_prefix="$(ptxd_get_ptxconf PTXCONF_COMPILER_PREFIX)"
 	local vendor_should
 	vendor_should="$(ptxd_get_ptxconf PTXCONF_CROSSCHAIN_VENDOR)" && {
 		# yea! A toolchain vendor was specified in the ptxconfig file.
-		# So we check for a 'ptxconfig' file in the toolchain directory
-		# and test the PTXCONF_PROJECT string therein.
+		#
+		# We have two options now:
+		#  a) the provided toolchain is an OSELAS.Toolchain which contains a
+		#     'ptxconfig', so test the PTXCONF_PROJECT string therein.
+		#  b) the provided toolchain is a crosstool-ng one which contains a
+		#     ${compiler_prefix}-ct-ng.config, so test the
+		#     CT_TOOLCHAIN_PKGVERSION therein.
+		#
 
 		if [ ! -d "${PTXDIST_TOOLCHAIN}" ]; then
 			echo
@@ -622,17 +629,23 @@ check_compiler() {
 			exit 1
 		fi
 
-		local vendor_def="$(readlink -f "${PTXDIST_TOOLCHAIN}/ptxconfig")"
-		if [ -z "${vendor_def}" -o \! -e "${vendor_def}" ]; then
+		local ptxdist_vendor_def="$(readlink -f "${PTXDIST_TOOLCHAIN}/ptxconfig")"
+		local ct_vendor_def="$(readlink -f "${PTXDIST_TOOLCHAIN}/${compiler_prefix}ct-ng.config")"
+
+		local vendor_is
+		if [ "${ptxdist_vendor_def}" -a -e "${ptxdist_vendor_def}" ]; then
+			vendor_is="$(source "${ptxdist_vendor_def}" && echo ${PTXCONF_PROJECT})"
+		elif [ "${ct_vendor_def}" -a -x "${ct_vendor_def}" ]; then
+			vendor_is=$(${ct_vendor_def} | sed -n -e 's/"//g' -e 's/^CT_TOOLCHAIN_PKGVERSION=//p')
+		else
 			echo
-			echo "${PTXDIST_LOG_PROMPT}error: toolchain doesn't point to an OSELAS.Toolchain"
+			echo "${PTXDIST_LOG_PROMPT}error: toolchain doesn't point to an OSELAS.Toolchain nor a crosstools-ng toolchain"
 			echo "${PTXDIST_LOG_PROMPT}error: leave PTXCONF_CROSSCHAIN_VENDOR empty to disable vendor check"
 			echo
 			exit 1
 		fi
 
 		# both vendor strings are present. Check them
-		local vendor_is="$(source "${vendor_def}" && echo ${PTXCONF_PROJECT})"
 		case "${vendor_is}" in
 		"${vendor_should}"*)
 			;;
@@ -647,7 +660,6 @@ check_compiler() {
 		esac
 	}
 
-	local compiler_prefix="$(ptxd_get_ptxconf PTXCONF_COMPILER_PREFIX)"
 	local compiler_ver_should
 	compiler_ver_should="$(ptxd_get_ptxconf PTXCONF_CROSSCHAIN_CHECK)" && {
 		local compiler="${compiler_prefix}gcc"
-- 
1.7.10.4


-- 
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [ptxdist] [PATCH] ptxdist: check vendor for ct-ng toolchain
  2014-02-20 13:28 [ptxdist] [PATCH] ptxdist: check vendor for ct-ng toolchain Andreas Bießmann
@ 2014-03-16 16:07 ` Andreas Bießmann
  2014-03-18  9:07   ` Bernhard Walle
  2014-04-20  7:48 ` [ptxdist] [PATCH v2] " Andreas Bießmann
  1 sibling, 1 reply; 7+ messages in thread
From: Andreas Bießmann @ 2014-03-16 16:07 UTC (permalink / raw)
  To: ptxdist

On 20.02.14 14:28, Andreas Bießmann wrote:
> Before the toolchain vendor check was dedicated to OSELAS.Toolchain.
> This patch introduces this feature to a toolchain built with ct-ng.
> 
> Signed-off-by: Andreas Bießmann <andreas@biessmann.de>
> 
> ---
> I know that Pengutronix develops and distributes OSELAS.Toolchain. I switched
> however for some targets to the ct-ng toolchain and found the really useful
> feature of toolchain versioning broken when using that other toolchain. This
> patch is hopefully even so accepted ;)
> 

any comments?


-- 
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [ptxdist] [PATCH] ptxdist: check vendor for ct-ng toolchain
  2014-03-16 16:07 ` Andreas Bießmann
@ 2014-03-18  9:07   ` Bernhard Walle
  2014-03-18 15:13     ` Andreas Bießmann
  0 siblings, 1 reply; 7+ messages in thread
From: Bernhard Walle @ 2014-03-18  9:07 UTC (permalink / raw)
  To: ptxdist

Hi,

since I'm also using ct-ng toolchains, I like that feature. However,
in my case CT_TOOLCHAIN_PKGVERSION was empty, so wouldn't it make sense
to add the line

    [ -z "$vendor_is" ] && vendor_is=crosstool-NG

after

   vendor_is=$(${ct_vendor_def} | sed -n -e 's/"//g' -e 
's/^CT_TOOLCHAIN_PKGVERSION=//p')

(sorry, I don't have the original patch in my mail box).

 From the ct-ng help text:

  │           ┌── Toolchain ID string 
─────────────────────────────────────────────────┐           │
  │           │                                                           
              │           │
  │           │ CT_TOOLCHAIN_PKGVERSION:                                  
              │           │
  │           │                                                           
              │           │
  │           │ Specify a string that identifies your package. You may 
wish to include │           │
  │           │ a build number or build date. This version string will be 
included in  │           │
  │           │ the output of gcc --version, and also in binutils, 
eglibc, gdb and     │           │
  │           │ gdbserver.                                                
              │           │
  │           │                                                           
              │           │
  │           │ If this string is left empty, the actual package version 
will be:      │           │
  │           │     "crosstool-NG ${CT_VERSION}"                          
              │           │
  │           │ Otherwise, it will be:                                    
              │           │
  │           │     "crosstool-NG ${CT_VERSION} - 
${CT_TOOLCHAIN_PKGVERSION}"          │           │
  │           │                                                           
              │           │
  │           │ This is passed to the configure flag --with-pkgversion.   
              │           │
  │           │                                                           
              │           │
  │           │ Symbol: TOOLCHAIN_PKGVERSION [=]                          
              │           │
  │           │ Type  : string                                            
              │           │
  │           │ Prompt: Toolchain ID string                               
              │           │
  │           │   Defined at config/toolchain.in:73                       
              │           │
  │           │   Location:                                               
              │           │
  │           │     -> Toolchain options                                  
              │           │
  │           │                                                           
              │           │
  │           │                                                           
              │           │
  │           │                                                           
              │           │
  │           │                                 <OK>                      
              │           │
  │           
└────────────────────────────────────────────────────────────────────────┘           │

Maybe it would be nice to include the version in the check, but the only 
line
where I could find the version of ct-ng in ${TARGET}-ct-ng.config is the
header comment:

   # crosstool-NG 1.19.0 Configuration

Don't know if it makes sense to parse that.

Regards,
Bernhard


Am 2014-03-16 17:07, schrieb Andreas Bießmann:
> On 20.02.14 14:28, Andreas Bießmann wrote:
>> Before the toolchain vendor check was dedicated to OSELAS.Toolchain.
>> This patch introduces this feature to a toolchain built with ct-ng.
>> 
>> Signed-off-by: Andreas Bießmann <andreas@biessmann.de>
>> 
>> ---
>> I know that Pengutronix develops and distributes OSELAS.Toolchain. I 
>> switched
>> however for some targets to the ct-ng toolchain and found the really 
>> useful
>> feature of toolchain versioning broken when using that other 
>> toolchain. This
>> patch is hopefully even so accepted ;)
>> 
> 
> any comments?


-- 
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [ptxdist] [PATCH] ptxdist: check vendor for ct-ng toolchain
  2014-03-18  9:07   ` Bernhard Walle
@ 2014-03-18 15:13     ` Andreas Bießmann
  2014-03-18 15:49       ` Michael Olbrich
  0 siblings, 1 reply; 7+ messages in thread
From: Andreas Bießmann @ 2014-03-18 15:13 UTC (permalink / raw)
  To: Bernhard Walle; +Cc: ptxdist

Hi Bernhard,

thanks for your feedback.

On 18.03.14 10:07, Bernhard Walle wrote:
> Hi,
> 
> since I'm also using ct-ng toolchains, I like that feature. However,
> in my case CT_TOOLCHAIN_PKGVERSION was empty, so wouldn't it make sense
> to add the line
> 
>    [ -z "$vendor_is" ] && vendor_is=crosstool-NG
> 
> after
> 
>   vendor_is=$(${ct_vendor_def} | sed -n -e 's/"//g' -e
> 's/^CT_TOOLCHAIN_PKGVERSION=//p')
> 
> (sorry, I don't have the original patch in my mail box).

I think we should use the whole ct-ng version string. As you also
mentioned we need some specific parsing then but I think it's worth.
My intention for that patch was to identify our specific ct-ng builds
which are tagged with a vendor string. But as you pointed out most ct-ng
toolchains will not have this parameter set.
I'd provide a reworked patch if some pengutronix guy (mol?) would
indicate if such a ct-ng version check would be applied generally.

Best regards

Andreas Bießmann

-- 
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [ptxdist] [PATCH] ptxdist: check vendor for ct-ng toolchain
  2014-03-18 15:13     ` Andreas Bießmann
@ 2014-03-18 15:49       ` Michael Olbrich
  0 siblings, 0 replies; 7+ messages in thread
From: Michael Olbrich @ 2014-03-18 15:49 UTC (permalink / raw)
  To: ptxdist

Hi,

On Tue, Mar 18, 2014 at 04:13:49PM +0100, Andreas Bießmann wrote:
> thanks for your feedback.
> 
> On 18.03.14 10:07, Bernhard Walle wrote:
> > Hi,
> > 
> > since I'm also using ct-ng toolchains, I like that feature. However,
> > in my case CT_TOOLCHAIN_PKGVERSION was empty, so wouldn't it make sense
> > to add the line
> > 
> >    [ -z "$vendor_is" ] && vendor_is=crosstool-NG
> > 
> > after
> > 
> >   vendor_is=$(${ct_vendor_def} | sed -n -e 's/"//g' -e
> > 's/^CT_TOOLCHAIN_PKGVERSION=//p')
> > 
> > (sorry, I don't have the original patch in my mail box).
> 
> I think we should use the whole ct-ng version string. As you also
> mentioned we need some specific parsing then but I think it's worth.
> My intention for that patch was to identify our specific ct-ng builds
> which are tagged with a vendor string. But as you pointed out most ct-ng
> toolchains will not have this parameter set.
> I'd provide a reworked patch if some pengutronix guy (mol?) would
> indicate if such a ct-ng version check would be applied generally.

I'd be happy to apply it. It may some time, because testing something like
that takes a bit more time.

Michael

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

-- 
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [ptxdist] [PATCH v2] ptxdist: check vendor for ct-ng toolchain
  2014-02-20 13:28 [ptxdist] [PATCH] ptxdist: check vendor for ct-ng toolchain Andreas Bießmann
  2014-03-16 16:07 ` Andreas Bießmann
@ 2014-04-20  7:48 ` Andreas Bießmann
  2014-04-21  8:51   ` Michael Olbrich
  1 sibling, 1 reply; 7+ messages in thread
From: Andreas Bießmann @ 2014-04-20  7:48 UTC (permalink / raw)
  To: ptxdist; +Cc: Bernhard Walle

Before the toolchain vendor check was dedicated to OSELAS.Toolchain.
This patch introduces this feature to a toolchain built with ct-ng.

Signed-off-by: Andreas Bießmann <andreas@biessmann.de>
Cc: Bernhard Walle <bernhard@bwalle.de>
---

Changes in v2:
* use full ct-ng version string in favour of just CT_TOOLCHAIN_PKGVERSION

 bin/ptxdist | 36 +++++++++++++++++++++++++++++-------
 1 file changed, 29 insertions(+), 7 deletions(-)

diff --git a/bin/ptxdist b/bin/ptxdist
index d83d98d..43dad58 100755
--- a/bin/ptxdist
+++ b/bin/ptxdist
@@ -617,11 +617,18 @@ check_compiler() {
 	# 3) Correct compiler version if a specific compiler version is given
 	#
 
+	local compiler_prefix="$(ptxd_get_ptxconf PTXCONF_COMPILER_PREFIX)"
 	local vendor_should
 	vendor_should="$(ptxd_get_ptxconf PTXCONF_CROSSCHAIN_VENDOR)" && {
 		# yea! A toolchain vendor was specified in the ptxconfig file.
-		# So we check for a 'ptxconfig' file in the toolchain directory
-		# and test the PTXCONF_PROJECT string therein.
+		#
+		# We have two options now:
+		#  a) the provided toolchain is an OSELAS.Toolchain which contains a
+		#     'ptxconfig', so test the PTXCONF_PROJECT string therein.
+		#  b) the provided toolchain is a crosstool-ng one which contains a
+		#     ${compiler_prefix}-ct-ng.config, so test the
+		#     CT_TOOLCHAIN_PKGVERSION therein.
+		#
 
 		if [ ! -d "${PTXDIST_TOOLCHAIN}" ]; then
 			echo
@@ -631,17 +638,33 @@ check_compiler() {
 			exit 1
 		fi
 
-		local vendor_def="$(readlink -f "${PTXDIST_TOOLCHAIN}/ptxconfig")"
-		if [ -z "${vendor_def}" -o \! -e "${vendor_def}" ]; then
+		local ptxdist_vendor_def="$(readlink -f "${PTXDIST_TOOLCHAIN}/ptxconfig")"
+		local ct_vendor_def="$(readlink -f "${PTXDIST_TOOLCHAIN}/${compiler_prefix}ct-ng.config")"
+
+		local vendor_is
+		if [ "${ptxdist_vendor_def}" -a -e "${ptxdist_vendor_def}" ]; then
+			vendor_is="$(source "${ptxdist_vendor_def}" && echo ${PTXCONF_PROJECT})"
+		elif [ "${ct_vendor_def}" -a -x "${ct_vendor_def}" ]; then
+			vendor_is=$(${ct_vendor_def} | awk ' \
+					/^#\s+crosstool-NG.*Configuration$/ { \
+						printf("%s %s", $2, $3) \
+					}; \
+					/^CT_TOOLCHAIN_PKGVERSION=/ { \
+						gsub(/\"/, ""); \
+						split($0,ary,"="); \
+						if (ary[1]) { \
+							printf(" - %s", ary[2]); \
+						} \
+					}')
+		else
 			echo
-			echo "${PTXDIST_LOG_PROMPT}error: toolchain doesn't point to an OSELAS.Toolchain"
+			echo "${PTXDIST_LOG_PROMPT}error: toolchain doesn't point to an OSELAS.Toolchain nor a crosstools-ng toolchain"
 			echo "${PTXDIST_LOG_PROMPT}error: leave PTXCONF_CROSSCHAIN_VENDOR empty to disable vendor check"
 			echo
 			exit 1
 		fi
 
 		# both vendor strings are present. Check them
-		local vendor_is="$(source "${vendor_def}" && echo ${PTXCONF_PROJECT})"
 		case "${vendor_is}" in
 		"${vendor_should}"*)
 			;;
@@ -656,7 +679,6 @@ check_compiler() {
 		esac
 	}
 
-	local compiler_prefix="$(ptxd_get_ptxconf PTXCONF_COMPILER_PREFIX)"
 	local compiler_ver_should
 	compiler_ver_should="$(ptxd_get_ptxconf PTXCONF_CROSSCHAIN_CHECK)" && {
 		local compiler="${compiler_prefix}gcc"
-- 
1.9.2


-- 
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [ptxdist] [PATCH v2] ptxdist: check vendor for ct-ng toolchain
  2014-04-20  7:48 ` [ptxdist] [PATCH v2] " Andreas Bießmann
@ 2014-04-21  8:51   ` Michael Olbrich
  0 siblings, 0 replies; 7+ messages in thread
From: Michael Olbrich @ 2014-04-21  8:51 UTC (permalink / raw)
  To: ptxdist

On Sun, Apr 20, 2014 at 09:48:45AM +0200, Andreas Bießmann wrote:
> Before the toolchain vendor check was dedicated to OSELAS.Toolchain.
> This patch introduces this feature to a toolchain built with ct-ng.
> 
> Signed-off-by: Andreas Bießmann <andreas@biessmann.de>
> Cc: Bernhard Walle <bernhard@bwalle.de>

Thanks, applied.

Michael

> ---
> 
> Changes in v2:
> * use full ct-ng version string in favour of just CT_TOOLCHAIN_PKGVERSION
> 
>  bin/ptxdist | 36 +++++++++++++++++++++++++++++-------
>  1 file changed, 29 insertions(+), 7 deletions(-)
> 
> diff --git a/bin/ptxdist b/bin/ptxdist
> index d83d98d..43dad58 100755
> --- a/bin/ptxdist
> +++ b/bin/ptxdist
> @@ -617,11 +617,18 @@ check_compiler() {
>  	# 3) Correct compiler version if a specific compiler version is given
>  	#
>  
> +	local compiler_prefix="$(ptxd_get_ptxconf PTXCONF_COMPILER_PREFIX)"
>  	local vendor_should
>  	vendor_should="$(ptxd_get_ptxconf PTXCONF_CROSSCHAIN_VENDOR)" && {
>  		# yea! A toolchain vendor was specified in the ptxconfig file.
> -		# So we check for a 'ptxconfig' file in the toolchain directory
> -		# and test the PTXCONF_PROJECT string therein.
> +		#
> +		# We have two options now:
> +		#  a) the provided toolchain is an OSELAS.Toolchain which contains a
> +		#     'ptxconfig', so test the PTXCONF_PROJECT string therein.
> +		#  b) the provided toolchain is a crosstool-ng one which contains a
> +		#     ${compiler_prefix}-ct-ng.config, so test the
> +		#     CT_TOOLCHAIN_PKGVERSION therein.
> +		#
>  
>  		if [ ! -d "${PTXDIST_TOOLCHAIN}" ]; then
>  			echo
> @@ -631,17 +638,33 @@ check_compiler() {
>  			exit 1
>  		fi
>  
> -		local vendor_def="$(readlink -f "${PTXDIST_TOOLCHAIN}/ptxconfig")"
> -		if [ -z "${vendor_def}" -o \! -e "${vendor_def}" ]; then
> +		local ptxdist_vendor_def="$(readlink -f "${PTXDIST_TOOLCHAIN}/ptxconfig")"
> +		local ct_vendor_def="$(readlink -f "${PTXDIST_TOOLCHAIN}/${compiler_prefix}ct-ng.config")"
> +
> +		local vendor_is
> +		if [ "${ptxdist_vendor_def}" -a -e "${ptxdist_vendor_def}" ]; then
> +			vendor_is="$(source "${ptxdist_vendor_def}" && echo ${PTXCONF_PROJECT})"
> +		elif [ "${ct_vendor_def}" -a -x "${ct_vendor_def}" ]; then
> +			vendor_is=$(${ct_vendor_def} | awk ' \
> +					/^#\s+crosstool-NG.*Configuration$/ { \
> +						printf("%s %s", $2, $3) \
> +					}; \
> +					/^CT_TOOLCHAIN_PKGVERSION=/ { \
> +						gsub(/\"/, ""); \
> +						split($0,ary,"="); \
> +						if (ary[1]) { \
> +							printf(" - %s", ary[2]); \
> +						} \
> +					}')
> +		else
>  			echo
> -			echo "${PTXDIST_LOG_PROMPT}error: toolchain doesn't point to an OSELAS.Toolchain"
> +			echo "${PTXDIST_LOG_PROMPT}error: toolchain doesn't point to an OSELAS.Toolchain nor a crosstools-ng toolchain"
>  			echo "${PTXDIST_LOG_PROMPT}error: leave PTXCONF_CROSSCHAIN_VENDOR empty to disable vendor check"
>  			echo
>  			exit 1
>  		fi
>  
>  		# both vendor strings are present. Check them
> -		local vendor_is="$(source "${vendor_def}" && echo ${PTXCONF_PROJECT})"
>  		case "${vendor_is}" in
>  		"${vendor_should}"*)
>  			;;
> @@ -656,7 +679,6 @@ check_compiler() {
>  		esac
>  	}
>  
> -	local compiler_prefix="$(ptxd_get_ptxconf PTXCONF_COMPILER_PREFIX)"
>  	local compiler_ver_should
>  	compiler_ver_should="$(ptxd_get_ptxconf PTXCONF_CROSSCHAIN_CHECK)" && {
>  		local compiler="${compiler_prefix}gcc"
> -- 
> 1.9.2
> 
> 
> -- 
> ptxdist mailing list
> ptxdist@pengutronix.de

-- 
Pengutronix e.K.                           |                             |
ndustrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

-- 
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-04-21  8:51 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-20 13:28 [ptxdist] [PATCH] ptxdist: check vendor for ct-ng toolchain Andreas Bießmann
2014-03-16 16:07 ` Andreas Bießmann
2014-03-18  9:07   ` Bernhard Walle
2014-03-18 15:13     ` Andreas Bießmann
2014-03-18 15:49       ` Michael Olbrich
2014-04-20  7:48 ` [ptxdist] [PATCH v2] " Andreas Bießmann
2014-04-21  8:51   ` Michael Olbrich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox