[pacman-dev] [PATCH 2/2] makepkg: add sodepends support

Florian Pritz bluewind at server-speed.net
Tue Feb 1 09:51:54 EST 2011


On 31.01.2011 22:35, dave reisner wrote:
>> +               soarch=$(LC_ALL=C readelf -h "$filename" 2>/dev/null | sed
>> -n 's/.*Class.*ELF\(32\|64\)/\1/p')
>>
> 
> Can I suggest using a lower level approach less prone to breakage because of
> a change in output format? It's a little more verbose, but it directly
> follows the ELF standard:
> 
> magic=$(dd if="$filename" bs=1 skip=1 count=3 2>/dev/null)
> [[ "$magic" = ELF ]] || continue
> read _ elfclass < <(hexdump -s5 -n1 "$filename")
> case $elfclass in
>   *(0)1) soarch=32 ;;
>   *(0)2) soarch=64 ;;
> esac
> [[ $soarch ]] || continue

And I already though the current implementation is too obfuscated...

If you really want to do that, please move it to a script/binary with a
few options so we can just get exactly the strings we need, but keep
makepkg readable.


-- 
Florian Pritz -- {flo,bluewind}@server-speed.net

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <http://mailman.archlinux.org/pipermail/pacman-dev/attachments/20110201/26e9ce5f/attachment.asc>


More information about the pacman-dev mailing list