[U-Boot] [PATCH v4 1/2] tools, config.mk: add binutils-version

Tom Rini trini at ti.com
Thu Jul 19 18:54:37 CEST 2012


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 07/19/2012 09:43 AM, Mike Frysinger wrote:
> On Thursday 19 July 2012 11:38:39 Tom Rini wrote:
>> On 07/19/2012 08:21 AM, Mike Frysinger wrote:
>>> On Thursday 19 July 2012 11:08:10 Tom Rini wrote:
>>>> On 07/18/2012 08:11 PM, Mike Frysinger wrote:
>>>>> On Wednesday 18 July 2012 19:45:52 Allen Martin wrote:
>>>>>> +MAJOR=$($gas --version | head -1 | awk '{print $NF}' |
>>>>>> cut -d . -f 1) +MINOR=$($gas --version | head -1 | awk
>>>>>> '{print $NF}' | cut -d . -f 2) + +printf "%02d%02d\\n"
>>>>>> $MAJOR $MINOR
>>>>> 
>>>>> can be replaced with a single awk script:
>>>>> 
>>>>> $gas --version | awk '{ gsub(/[.]/, " ", $NF) $0 = $NF
>>>>> printf "%02d%02d\n", $1, $2 exit }'
>>>> 
>>>> That looks much longer and we call this once so a few execs
>>>> is noise.
>>> 
>>> here's a shorter version: $gas --version | awk '{ gsub(/[.]/, "
>>> ", $NF); $0 = $NF; printf "%02d%02d\n", $1, $2; exit }'
>> 
>> And still over 80 chars before we assign it to a variable.  I
>> could get it to 77 chars with all whitespace removed.
> 
> which is why i unrolled it to make it readable.  i don't know what
> metrics you're using here, but i don't think the awk version is
> "longer" by really any of them.

The metric of 'wc -c' and "what fits in a single line, unwrapped on an
80x24 terminal."  awk is great and awesome, don't get me wrong, but
it's not doing the job as compactly as the original.

- -- 
Tom
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBAgAGBQJQCDvNAAoJENk4IS6UOR1WzRsP/ikEjUCPX593aZxLqHh7oGZO
novK94mu/ThO8pApYs17Lhh77wh9Bn/lbRrqwjRrFZAKqGN6gPYpknvvmxD31AkV
K72xz19ut7S/zBAVZIgMcnuHDvz5LEEBZBRjinmKM+7nMRMvaqi2rEhs+PUj00xP
IPeQvqttfAB1iblVhU+07at6vhsKRM2fXS45crXztGXYfeYzT90hMM4NrGXuiJ+G
4aav8FK4nHM+DgOAjzwYlZ7Ty1okm0F7mAwM9+nJE5WiUPI8G9nPzcWt3IeVa6JF
XmRkaZH7cTAz/qrWjbVKd7rLnZ75jqoez1Wv4FVescrJ6Mu5oH7QUXfciYJrGwQ8
VHBBvI+Hf1W2YICBHTeO9wdfMOuVl7Jj6K7+CunczJ7qA5VjUHyr0Q3gCnr3UoTW
9tUblOT39zRLIs57IWN7cio2RdIPdzd1N5sGh3S1UxGhM+dnUTeM3faVxoI8LJyU
/Fb+kmv1LhMPPMjqxyzbFROjGZVXx0T4K5ERqrZ+k4jP/r3t6QOAMsJhvypZHkQf
WeMyldYIwlbeflMYKjxA729C/CdN0MJttYMbnBRhcmWM/VJR41Cuh2GSOhN635Z3
N3IYxb9V8txAfq308rEp9Hwj1oJ9DjnEw3xBvjBLYCcFncJSER6dMajuFK6qXqay
PR+q3ZquMwPWcYlWQRyk
=sxrC
-----END PGP SIGNATURE-----


More information about the U-Boot mailing list