unpack: avoid calculating hash more than once

This commit is contained in:
MilhouseVH 2017-03-23 15:11:10 +00:00
parent b1c2191a20
commit 4bfb206432

View File

@ -40,11 +40,12 @@ STAMP_DEPENDS="$PKG_DIR $PKG_NEED_UNPACK $PROJECT_DIR/$PROJECT/patches/$PKG_NAME
[ -n "$DEVICE" ] && STAMP_DEPENDS="$STAMP_DEPENDS $PROJECT_DIR/$PROJECT/devices/$DEVICE/patches/$PKG_NAME"
# Perform a wildcard match on the package to ensure old versions are cleaned too
PKG_DEEPMD5=
for i in $BUILD/$1-*; do
if [ -d $i -a -f "$i/.libreelec-unpack" ] ; then
. "$i/.libreelec-unpack"
if [ "$STAMP_PKG_NAME" = "$1" ]; then
PKG_DEEPMD5=$(find $STAMP_DEPENDS -exec md5sum {} \; 2>/dev/null | sort | md5sum | cut -d" " -f1)
[ -z "${PKG_DEEPMD5}" ] && PKG_DEEPMD5=$(find $STAMP_DEPENDS -exec md5sum {} \; 2>/dev/null | sort | md5sum | cut -d" " -f1)
if [ ! "$PKG_DEEPMD5" = "$STAMP_PKG_DEEPMD5" ] ; then
$SCRIPTS/clean $1
fi