From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from ptx.hi.pengutronix.de ([2001:6f8:1178:2:5054:ff:fec0:8e10] ident=Debian-exim) by metis.ext.pengutronix.de with esmtp (Exim 4.72) (envelope-from ) id 1Wc9wp-00086M-To for ptxdist@pengutronix.de; Mon, 21 Apr 2014 10:51:31 +0200 Received: from mol by ptx.hi.pengutronix.de with local (Exim 4.80) (envelope-from ) id 1Wc9wq-0001UV-NG for ptxdist@pengutronix.de; Mon, 21 Apr 2014 10:51:32 +0200 Date: Mon, 21 Apr 2014 10:51:32 +0200 From: Michael Olbrich Message-ID: <20140421085132.GB18640@pengutronix.de> References: <1392902934-21165-1-git-send-email-andreas@biessmann.de> <1397980125-86972-1-git-send-email-andreas@biessmann.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1397980125-86972-1-git-send-email-andreas@biessmann.de> Subject: Re: [ptxdist] [PATCH v2] ptxdist: check vendor for ct-ng toolchain Reply-To: ptxdist@pengutronix.de List-Id: PTXdist Development Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Sender: ptxdist-bounces@pengutronix.de Errors-To: ptxdist-bounces@pengutronix.de To: ptxdist@pengutronix.de On Sun, Apr 20, 2014 at 09:48:45AM +0200, Andreas Bie=DFmann 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=DFmann > Cc: Bernhard Walle 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=3D"$(ptxd_get_ptxconf PTXCONF_COMPILER_PREFIX)" > local vendor_should > vendor_should=3D"$(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=3D"$(readlink -f "${PTXDIST_TOOLCHAIN}/ptxconfig")" > - if [ -z "${vendor_def}" -o \! -e "${vendor_def}" ]; then > + local ptxdist_vendor_def=3D"$(readlink -f "${PTXDIST_TOOLCHAIN}/ptxcon= fig")" > + local ct_vendor_def=3D"$(readlink -f "${PTXDIST_TOOLCHAIN}/${compiler_= prefix}ct-ng.config")" > + > + local vendor_is > + if [ "${ptxdist_vendor_def}" -a -e "${ptxdist_vendor_def}" ]; then > + vendor_is=3D"$(source "${ptxdist_vendor_def}" && echo ${PTXCONF_PROJE= CT})" > + elif [ "${ct_vendor_def}" -a -x "${ct_vendor_def}" ]; then > + vendor_is=3D$(${ct_vendor_def} | awk ' \ > + /^#\s+crosstool-NG.*Configuration$/ { \ > + printf("%s %s", $2, $3) \ > + }; \ > + /^CT_TOOLCHAIN_PKGVERSION=3D/ { \ > + gsub(/\"/, ""); \ > + split($0,ary,"=3D"); \ > + if (ary[1]) { \ > + printf(" - %s", ary[2]); \ > + } \ > + }') > + else > echo > - echo "${PTXDIST_LOG_PROMPT}error: toolchain doesn't point to an OSELA= S.Toolchain" > + echo "${PTXDIST_LOG_PROMPT}error: toolchain doesn't point to an OSELA= S.Toolchain nor a crosstools-ng toolchain" > echo "${PTXDIST_LOG_PROMPT}error: leave PTXCONF_CROSSCHAIN_VENDOR emp= ty to disable vendor check" > echo > exit 1 > fi > = > # both vendor strings are present. Check them > - local vendor_is=3D"$(source "${vendor_def}" && echo ${PTXCONF_PROJECT}= )" > case "${vendor_is}" in > "${vendor_should}"*) > ;; > @@ -656,7 +679,6 @@ check_compiler() { > esac > } > = > - local compiler_prefix=3D"$(ptxd_get_ptxconf PTXCONF_COMPILER_PREFIX)" > local compiler_ver_should > compiler_ver_should=3D"$(ptxd_get_ptxconf PTXCONF_CROSSCHAIN_CHECK)" &&= { > local compiler=3D"${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