public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Bill Pringlemeir <bpringlemeir@nbsps.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] v2015.01-rc4 REGRESSION: "scripts: fix binutils-version.sh" breaks things for non Linaro toolchains
Date: Tue, 06 Jan 2015 17:01:22 -0500	[thread overview]
Message-ID: <871tn78t71.fsf@nbsps.com> (raw)
In-Reply-To: <8761cj8uj9.fsf@nbsps.com> (Bill Pringlemeir's message of "Tue, 06 Jan 2015 16:32:26 -0500")

>> On Tue, Jan 06, 2015 at 11:27:43AM +0100, Hans de Goede wrote:

>>> ping ? current master still has this regression, it is not fatal,
>>> but it is not
>>> pretty either.

> On  6 Jan 2015, trini at ti.com wrote:

>> Did you see my earlier reply?  It's OK with vanilla toolchains (see
>> ELDK) and Linaro ones, but breaking on how Fedora mangles the version
>> string.  I'm _not_ saying it's a Fedora problem, but can you poke at
>> this a bit?  If not, I'll play with echo and see if I can do it.

On  6 Jan 2015, bpringlemeir at nbsps.com wrote:

> diff --git a/scripts/binutils-version.sh b/scripts/binutils-version.sh
> index 0bc26cf..955267d 100755 --- a/scripts/binutils-version.sh +++
> b/scripts/binutils-version.sh @@ -5,7 +5,6 @@ # Prints the binutils
> version of `gas-command' in a canonical 4-digit form # such as `0222'
> for binutils 2.22 # - gas="$*"
>
> if [ ${#gas} -eq 0 ]; then
> @@ -14,9 +13,9 @@ if [ ${#gas} -eq 0 ]; then
> exit 1
> fi
>
> -version_string=$($gas --version | head -1 | sed -e 's/.*)
> *\([0-9.]*\).*/\1/' ) +version_string=$($gas --version | head -1 | sed
> -e 's/.*) *\([0-9\.]*\).*/\1/' )
>
> -MAJOR=$(echo $version_string | cut -d . -f 1)
> -MINOR=$(echo $version_string | cut -d . -f 2)
> +MAJOR=$(echo "$version_string" | cut -d . -f 1)
> +MINOR=$(echo "$version_string" | cut -d . -f 2)
>
> -printf "%02d%02d\\n" $MAJOR $MINOR
> +printf "%02d%02d\\n" "$MAJOR" "$MINOR"
>
>
> The main issue is quoting of the 'sed' expression.  We had regex
> [0-9.], but we want [0-9\.] so that we match a literal '.' as opposed
> to anything.  Or so I speculate.  I made a script that output the
> version info Hans has and after the patch it is fine.

Err none of the above. The RedHat binutils doesnt have a 'package'
string.  With brackets.  For example,

   GNU assembler (GNU Binutils for Ubuntu) 2.24
                                           ^^^^
   GNU assembler (crosstool-NG 1.20.0 - nbsps) 2.24
                                               ^^^^
It is just, 

   GNU assembler version 2.24.0-6.fc21 20140613
   -----------------------------------
                         ++++++

Below gets the first ##.## after a bracket or the first ##.## No
escaping of the . is needed inside the range of course.

diff --git a/scripts/binutils-version.sh b/scripts/binutils-version.sh
index 0bc26cf..b1afc98 100755
--- a/scripts/binutils-version.sh
+++ b/scripts/binutils-version.sh
@@ -5,7 +5,6 @@
 # Prints the binutils version of `gas-command' in a canonical 4-digit form
 # such as `0222' for binutils 2.22
 #
-
 gas="$*"
 
 if [ ${#gas} -eq 0 ]; then
@@ -15,6 +14,7 @@ if [ ${#gas} -eq 0 ]; then
 fi
 
 version_string=$($gas --version | head -1 | sed -e 's/.*) *\([0-9.]*\).*/\1/' )
+version_string=$(echo "$version_string" | sed -e 's/[^0-9]*\([0-9.]*\).*/\1/')
 
 MAJOR=$(echo $version_string | cut -d . -f 1)
 MINOR=$(echo $version_string | cut -d . -f 2)

  reply	other threads:[~2015-01-06 22:01 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-30 10:55 [U-Boot] v2015.01-rc4 REGRESSION: "scripts: fix binutils-version.sh" breaks things for non Linaro toolchains Hans de Goede
2014-12-30 13:50 ` Tom Rini
2015-01-06 10:27 ` Hans de Goede
2015-01-06 15:46   ` Tom Rini
2015-01-06 21:32     ` Bill Pringlemeir
2015-01-06 22:01       ` Bill Pringlemeir [this message]
2015-01-06 22:07         ` Tom Rini
2015-01-06 22:25           ` [U-Boot] [PATCH] scripts: fix binutils-version.sh for 'as' without a package Bill Pringlemeir
2015-01-06 22:38             ` Bill Pringlemeir
2015-01-07 12:01               ` Masahiro Yamada
2015-01-07 15:34                 ` [U-Boot] [PATCH v3] " Bill Pringlemeir
2015-01-08  8:56                   ` Masahiro Yamada
2015-01-08 10:18                   ` Hans de Goede
2015-01-09 13:34                   ` [U-Boot] [U-Boot, " Tom Rini
2015-01-07 15:42                 ` [U-Boot] [PATCH] " Bill Pringlemeir

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=871tn78t71.fsf@nbsps.com \
    --to=bpringlemeir@nbsps.com \
    --cc=u-boot@lists.denx.de \
    /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