build: fix calculate_stamp() for multiple corner cases

- follow symlinks (as used by RPi/Slice)
- don't include hidden files like vi swap files (lol)
- remove duplicates (like $LINUX_DEPENDS for linux itself)
- sort by filename, not by hash
- don't use one sha256sum process per file, use xargs to pass all files to
  one process.
This commit is contained in:
Andre Heider 2019-12-02 08:01:49 +01:00
parent b56c0f0619
commit ae663c98e9

View File

@ -851,10 +851,10 @@ calculate_stamp() {
[ -n "$DEVICE" ] && stamp+=" $PROJECT_DIR/$PROJECT/devices/$DEVICE/patches/$PKG_NAME" [ -n "$DEVICE" ] && stamp+=" $PROJECT_DIR/$PROJECT/devices/$DEVICE/patches/$PKG_NAME"
[ -n "$PKG_NEED_UNPACK" ] && stamp+=" $PKG_NEED_UNPACK" [ -n "$PKG_NEED_UNPACK" ] && stamp+=" $PKG_NEED_UNPACK"
data="$(find ${stamp} -exec sha256sum {} \; 2>/dev/null | sed "s/ ${ROOT//\//\\/}\// /")" data="$(find -L ${stamp} -type f -not -name '.*' 2>/dev/null | sed "s|^${ROOT}/||" | LC_ALL=C sort -u | xargs sha256sum)"
[ -n "${PKG_STAMP}" ] && data+=$'\n'"$(echo "${PKG_STAMP}" | sha256sum)" [ -n "${PKG_STAMP}" ] && data+=$'\n'"$(echo "${PKG_STAMP}" | sha256sum)"
echo "${data}" | sort | sha256sum | cut -d" " -f1 echo "${data}" | sha256sum | cut -d" " -f1
} }
target_has_feature() { target_has_feature() {