[sbopkg-users] md5sum of cached source

David Spencer nobbutl at yahoo.co.uk
Fri May 22 16:17:19 UTC 2009


> The attached is a much smaller change targeting the stable branch, making
> the md5 check unconditional (but with no "download again" option). Any
> chance you can give it a spin before the commit?

Hi Mauro, many thanks for such a quick response!  The patch *almost*
works ;-)

Unfortunately the current directory isn't changed to $SRCDIR when the
body of 'if [ ( -z $SRCNAME ... fi' is skipped, so the md5sum check then
fails (file not found).

I'd suggest adding 'cd $SRCDIR' up before that 'if' statement (just
after '. "$INFO"' which you also had to move), so that the current
directory is the same whether or not the body of the 'if' statement has
been executed.  In other words

    SRCNAME=$(get_source_names "$INFO")
    . "$INFO"
    cd $SRCDIR
    if [[ (-z "$SRCNAME") || (! -f "$SRCDIR/$SRCNAME") ]]; then
        mkdir -p $DLDIR
        cd $DLDIR
        ...
        cd $SRCDIR
        rm -rf $DLDIR
    fi

That seems slightly better than the alternative solution, which is to
add $SRCDIR to the pathname in the md5sum command

        MD5CHK=$(md5sum "$SRCDIR/$SRCNAME" | cut -d' ' -f1)

Hope this helps, sorry not to do a proper patch but such things are
dangerous in the hands of amateurs like me :-)

Thanks again!
-Dave Spencer


More information about the sbopkg-users mailing list