From f68bfd65754482e65759aff4be5ff97e6261cc46 Mon Sep 17 00:00:00 2001 From: mid-kid Date: Thu, 26 Nov 2015 22:27:55 +0100 Subject: [PATCH] common/hooks: Fix hooks when build_style=meta --- .../hooks/post-install/02-remove-perl-files.sh | 2 +- .../02-remove-python-bytecode-files.sh | 4 +++- .../hooks/post-install/03-remove-empty-dirs.sh | 18 ++++++++++-------- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/common/hooks/post-install/02-remove-perl-files.sh b/common/hooks/post-install/02-remove-perl-files.sh index 24f37bf88d9..e8dad011e88 100644 --- a/common/hooks/post-install/02-remove-perl-files.sh +++ b/common/hooks/post-install/02-remove-perl-files.sh @@ -1,7 +1,7 @@ # This hook removes perl pod/.packlist files. hook() { - if [ "$pkgname" != "perl" ]; then + if [ "$pkgname" != "perl" -a -d "${PKGDESTDIR}" ]; then find ${PKGDESTDIR} -type f -name perllocal.pod -delete find ${PKGDESTDIR} -type f -name .packlist -delete fi diff --git a/common/hooks/post-install/02-remove-python-bytecode-files.sh b/common/hooks/post-install/02-remove-python-bytecode-files.sh index db4b355af32..3fa8bdc3d46 100644 --- a/common/hooks/post-install/02-remove-python-bytecode-files.sh +++ b/common/hooks/post-install/02-remove-python-bytecode-files.sh @@ -1,5 +1,7 @@ # This hook removes python bytecode files (.py[co]). hook() { - find ${PKGDESTDIR} -type f -name '*.py[co]' -delete + if [ -d "${PKGDESTDIR}" ]; then + find ${PKGDESTDIR} -type f -name '*.py[co]' -delete + fi } diff --git a/common/hooks/post-install/03-remove-empty-dirs.sh b/common/hooks/post-install/03-remove-empty-dirs.sh index dec7898744a..4b7122938ab 100644 --- a/common/hooks/post-install/03-remove-empty-dirs.sh +++ b/common/hooks/post-install/03-remove-empty-dirs.sh @@ -1,12 +1,14 @@ # This hooks removes empty dirs and warns about them. hook() { - find "${PKGDESTDIR}" -type d -empty|sort -r|while read f; do - _dir="${f##${PKGDESTDIR}}" - [ -z "${_dir}" ] && continue - rmdir --ignore-fail-on-non-empty -p "$f" &>/dev/null - msg_warn "$pkgver: removed empty dir: ${_dir}\n" - done - # Create PKGDESTDIR in case it has been removed previously. - mkdir -p ${PKGDESTDIR} + if [ -d "${PKGDESTDIR}" ]; then + find "${PKGDESTDIR}" -type d -empty|sort -r|while read f; do + _dir="${f##${PKGDESTDIR}}" + [ -z "${_dir}" ] && continue + rmdir --ignore-fail-on-non-empty -p "$f" &>/dev/null + msg_warn "$pkgver: removed empty dir: ${_dir}\n" + done + # Create PKGDESTDIR in case it has been removed previously. + mkdir -p ${PKGDESTDIR} + fi }