diff mbox

[U-Boot] scripts: fix binutils-version.sh for 'as' without a package.

Message ID 1420583133-15012-1-git-send-email-bpringlemeir@nbsps.com
State Superseded
Delegated to: Tom Rini
Headers show

Commit Message

Bill Pringlemeir Jan. 6, 2015, 10:25 p.m. UTC
Commit 73c25753 fixed the common issue that binutil packages (tool/organization
that packaged or built the bin-utils) are included in brackets and this may
falsely be recognized as a version.  However, some tools do not provide a
'package' and previously we add the 'Gnu assembler..' to the version.

Run a 2nd pass on the 'version_string' to strip off any leading characters when
a package is not provided in brackets.

Signed-off-by: Bill Pringlemeir <bpringlemeir@nbsps.com>
---
 scripts/binutils-version.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/scripts/binutils-version.sh b/scripts/binutils-version.sh
index 0bc26cf..68cd0fe 100755
--- a/scripts/binutils-version.sh
+++ b/scripts/binutils-version.sh
@@ -5,7 +5,7 @@ 
 # Prints the binutils version of `gas-command' in a canonical 4-digit form
 # such as `0222' for binutils 2.22
 #
-
+set -x
 gas="$*"
 
 if [ ${#gas} -eq 0 ]; then
@@ -15,6 +15,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)