[Aboriginal] aboriginal changes

Rob Landley rob at landley.net
Tue Nov 17 06:55:23 PST 2015

On 11/16/2015 03:11 PM, Geoff Salmon wrote:
> Hi Rob
> There's a problem with my original patch that this thread stared with.
> In sources/download_functions.sh, I made this change
> -    for i in "$SHA1TAR" $(sha1file "$PATCHDIR/$PACKAGE"-*.patch
> 2>/dev/null)
> +    for i in "$SHA1TAR" $(sha1file $(gather_patches))
> but if there are no patches for a package then gather_patches will
> return nothing and sha1file will hang because sha1sum is waiting for
> input. This happens when building busybox. The original version relied on
>   sha1sum 'sources/busybox-*.patch'
> failing immediately and ignored the error with 2>/dev/null.
> An alternate way to deal with gather_patches returning nothing would be
> to modify sha1file like this:
>  sha1file()
>  {
> -  sha1sum "$@" | awk '{print $1}'
> +  sha1sum /dev/null "$@" | tail -n +2 | awk '{print $1}'
>  }
> Except then you can't pipe input into sha1file. I don't see this being
> done anywhere, but maybe it's something you want to support.

sha1sum /dev/null gives an sha1sum, probably doesn't hurt anything in
this case but it's a behavior change. Sounds like an existence test is
needed somewhere.

sha1file exists because there's no "just give me the darn hash without
appending the filename to it" command line option for sha1sum. (Ok, I
added sha1sum -b to toybox, but I shouldn't assume that's there...)

Ok, let's say sha1file outputs the sha1sums of its arguments, and with
no arguments outputs nothing. That means the existence test needs to go
in sha1file, so a for loop over the returned values. (Which would break
if a filename has a space in it but that's already the case...)

I'll try to check in a fix today.



More information about the Aboriginal mailing list