From cecbc6fb3ac6b8ae35b99cb1940677444cb4afc9 Mon Sep 17 00:00:00 2001 From: MilhouseVH Date: Thu, 23 Mar 2017 14:33:17 +0000 Subject: [PATCH 1/4] Revert "unpack: avoid unecessary disk io" This reverts commit 895122eb66e19c073f4aa5663856d7f07b19b914. --- scripts/unpack | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/unpack b/scripts/unpack index 28bd13bf37..581272d2a8 100755 --- a/scripts/unpack +++ b/scripts/unpack @@ -39,9 +39,9 @@ mkdir -p $BUILD 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" -if [ -d "$PKG_BUILD" ]; then - if [ -f "$STAMP" ] ; then - . "$STAMP" +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) if [ ! "$PKG_DEEPMD5" = "$STAMP_PKG_DEEPMD5" ] ; then @@ -49,7 +49,7 @@ if [ -d "$PKG_BUILD" ]; then fi fi fi -fi +done if [ -d "$PKG_BUILD" -a ! -f "$STAMP" ]; then # stale pkg build dir From 0647fa703b6018dc13db32e562f580ff4df49a3d Mon Sep 17 00:00:00 2001 From: MilhouseVH Date: Thu, 23 Mar 2017 14:33:20 +0000 Subject: [PATCH 2/4] Revert "clean: avoid unecessary disk io" This reverts commit 7bc2ed47020213ff2db0cead266040f33286d159. --- scripts/clean | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/scripts/clean b/scripts/clean index 6187f61597..ac72cf1752 100755 --- a/scripts/clean +++ b/scripts/clean @@ -29,21 +29,19 @@ clean_package() { return fi - STAMP=$PKG_BUILD/.libreelec-unpack - - if [ -d "$PKG_BUILD" ]; then - if [ -f "$STAMP" ] ; then - . "$STAMP" + for i in $BUILD/$1-*; do + if [ -d $i -a -f "$i/.libreelec-unpack" ] ; then + . "$i/.libreelec-unpack" if [ "$STAMP_PKG_NAME" = "$1" ]; then - printf "%${BUILD_INDENT}c ${boldred}*${endcolor} ${red}Removing $PKG_BUILD ...${endcolor}\n" ' '>&$SILENT_OUT - rm -rf "$PKG_BUILD" + printf "%${BUILD_INDENT}c ${boldred}*${endcolor} ${red}Removing $i ...${endcolor}\n" ' '>&$SILENT_OUT + rm -rf $i fi else # force clean if no stamp found (previous unpack failed) - printf "%${BUILD_INDENT}c * Removing $PKG_BUILD ...\n" ' '>&$SILENT_OUT - rm -rf "$PKG_BUILD" + printf "%${BUILD_INDENT}c * Removing $i ...\n" ' '>&$SILENT_OUT + rm -rf $i fi - fi + done rm -f $STAMPS/$1/build_* } From aa343ae3bf542e11e5c1dd3c071d4e79b5257de7 Mon Sep 17 00:00:00 2001 From: MilhouseVH Date: Thu, 23 Mar 2017 14:59:46 +0000 Subject: [PATCH 3/4] scripts: add comment to clarify usage --- scripts/clean | 1 + scripts/unpack | 1 + 2 files changed, 2 insertions(+) diff --git a/scripts/clean b/scripts/clean index ac72cf1752..2673b0b7f3 100755 --- a/scripts/clean +++ b/scripts/clean @@ -29,6 +29,7 @@ clean_package() { return fi + # Use a wilcard here to remove all versions of the package for i in $BUILD/$1-*; do if [ -d $i -a -f "$i/.libreelec-unpack" ] ; then . "$i/.libreelec-unpack" diff --git a/scripts/unpack b/scripts/unpack index 581272d2a8..9d16daeac4 100755 --- a/scripts/unpack +++ b/scripts/unpack @@ -39,6 +39,7 @@ mkdir -p $BUILD 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 for i in $BUILD/$1-*; do if [ -d $i -a -f "$i/.libreelec-unpack" ] ; then . "$i/.libreelec-unpack" From 2a50418845ef29cf3fc7f40a4412247a34023622 Mon Sep 17 00:00:00 2001 From: MilhouseVH Date: Thu, 23 Mar 2017 15:11:10 +0000 Subject: [PATCH 4/4] unpack: avoid calculating hash more than once --- scripts/unpack | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/unpack b/scripts/unpack index 9d16daeac4..a1fae1e211 100755 --- a/scripts/unpack +++ b/scripts/unpack @@ -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